@bigbinary/neeto-playwright-reporter 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +12 -6
- package/index.cjs.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +12 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Reporter, FullConfig, Suite, TestCase, TestResult, FullResult } from '@
|
|
|
3
3
|
interface ReporterOptionParams {
|
|
4
4
|
projectKey: string;
|
|
5
5
|
baseURL: string;
|
|
6
|
+
apiKey: string;
|
|
6
7
|
ciBuildId: string;
|
|
7
8
|
}
|
|
8
9
|
declare class MyReporter implements Reporter {
|
|
@@ -17,7 +18,7 @@ declare class MyReporter implements Reporter {
|
|
|
17
18
|
constructor(options: ReporterOptionParams);
|
|
18
19
|
onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
|
|
19
20
|
onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
|
|
20
|
-
onTestEnd: (testCase: TestCase, { status, duration, errors, retry, attachments }: TestResult) => Promise<void>;
|
|
21
|
+
onTestEnd: (testCase: TestCase, { status, duration, errors, error, retry, attachments }: TestResult) => Promise<void>;
|
|
21
22
|
onEnd: ({ status, duration }: FullResult) => Promise<void>;
|
|
22
23
|
}
|
|
23
24
|
|
package/index.js
CHANGED
|
@@ -18451,6 +18451,7 @@ const uploadToS3 = (data, { url, headers }) => axios.put(url, data, { headers })
|
|
|
18451
18451
|
|
|
18452
18452
|
const ERRORS = {
|
|
18453
18453
|
onBegin: {
|
|
18454
|
+
noTestsToReport: "No tests to report",
|
|
18454
18455
|
failedToGetCommitSha: "Failed to get current commit SHA.",
|
|
18455
18456
|
failedToGetBranch: "Failed to get current branch.",
|
|
18456
18457
|
failedToGetCommitMessage: "Failed to get current commit message.",
|
|
@@ -18558,19 +18559,18 @@ const sendHeartBeatSignal = async (ciBuildId) => {
|
|
|
18558
18559
|
}
|
|
18559
18560
|
};
|
|
18560
18561
|
|
|
18561
|
-
const setAuthHeaders = (projectKey) => {
|
|
18562
|
-
var _a;
|
|
18562
|
+
const setAuthHeaders = ({ projectKey, apiKey, }) => {
|
|
18563
18563
|
axios.defaults.headers = {
|
|
18564
18564
|
...axios.defaults.headers,
|
|
18565
18565
|
[HEADERS_KEYS.projectKey]: projectKey,
|
|
18566
|
-
[HEADERS_KEYS.apiKey]:
|
|
18566
|
+
[HEADERS_KEYS.apiKey]: apiKey !== null && apiKey !== void 0 ? apiKey : "",
|
|
18567
18567
|
[HEADERS_KEYS.accept]: "application/json",
|
|
18568
18568
|
[HEADERS_KEYS.contentType]: "application/json",
|
|
18569
18569
|
};
|
|
18570
18570
|
};
|
|
18571
|
-
function initializeAxios({ projectKey, baseURL, }) {
|
|
18571
|
+
function initializeAxios({ projectKey, baseURL, apiKey, }) {
|
|
18572
18572
|
axios.defaults.baseURL = baseURL !== null && baseURL !== void 0 ? baseURL : "https://connect.neetoplaydash.net";
|
|
18573
|
-
setAuthHeaders(projectKey);
|
|
18573
|
+
setAuthHeaders({ projectKey, apiKey });
|
|
18574
18574
|
}
|
|
18575
18575
|
|
|
18576
18576
|
const create = (ciBuildId, payload) => axios.post(`${API_BASE_URL}/reporter/runs/${ciBuildId}/test_entities`, {
|
|
@@ -18584,6 +18584,10 @@ class MyReporter {
|
|
|
18584
18584
|
const shard = config.shard;
|
|
18585
18585
|
let attempts;
|
|
18586
18586
|
this.totalTestCount = rootSuite.allTests().length;
|
|
18587
|
+
if (this.totalTestCount === 0) {
|
|
18588
|
+
consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
|
|
18589
|
+
process.exit(0);
|
|
18590
|
+
}
|
|
18587
18591
|
try {
|
|
18588
18592
|
const runDetails = {
|
|
18589
18593
|
commit_id: getCurrentCommitSha(),
|
|
@@ -18645,8 +18649,9 @@ class MyReporter {
|
|
|
18645
18649
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18646
18650
|
}
|
|
18647
18651
|
};
|
|
18648
|
-
this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
|
|
18652
|
+
this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
|
|
18649
18653
|
const completedAt = new Date();
|
|
18654
|
+
const errorLocation = error === null || error === void 0 ? void 0 : error.location;
|
|
18650
18655
|
const { id, title, expectedStatus } = testCase;
|
|
18651
18656
|
try {
|
|
18652
18657
|
const testResult = {
|
|
@@ -18659,6 +18664,7 @@ class MyReporter {
|
|
|
18659
18664
|
videos: [],
|
|
18660
18665
|
traces: [],
|
|
18661
18666
|
completed_at: completedAt.toString(),
|
|
18667
|
+
error_snippet: `# ${errorLocation === null || errorLocation === void 0 ? void 0 : errorLocation.file} (${errorLocation === null || errorLocation === void 0 ? void 0 : errorLocation.line}:${errorLocation === null || errorLocation === void 0 ? void 0 : errorLocation.column}) \n\n\n ${error === null || error === void 0 ? void 0 : error.snippet}`,
|
|
18662
18668
|
};
|
|
18663
18669
|
consoleLogFormatted.underline(title);
|
|
18664
18670
|
await Promise.all(attachments.map(async ({ name, path, body, contentType, }) => {
|