@bigbinary/neeto-playwright-reporter 1.3.10 → 1.3.12
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 +22 -13
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +22 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare class MyReporter implements Reporter {
|
|
|
18
18
|
reportedTestCount: number;
|
|
19
19
|
tags: string[] | string;
|
|
20
20
|
unreportedAttemptCount: number;
|
|
21
|
+
hasRunStarted: boolean;
|
|
21
22
|
constructor(options: ReporterOptionParams);
|
|
22
23
|
onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
|
|
23
24
|
onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
|
package/index.js
CHANGED
|
@@ -18480,7 +18480,7 @@ const MESSAGES = {
|
|
|
18480
18480
|
startingTest: (titlePath) => `Starting ${titlePath}`,
|
|
18481
18481
|
},
|
|
18482
18482
|
onTestEnd: {
|
|
18483
|
-
reportedTest: (title) => `Reported ${title} to
|
|
18483
|
+
reportedTest: (title) => `Reported ${title} to neetoPlaydash`,
|
|
18484
18484
|
},
|
|
18485
18485
|
onEnd: {
|
|
18486
18486
|
runReported: "Run completed and reported to neetoPlaydash 🎉",
|
|
@@ -18589,13 +18589,13 @@ const testEntitiesApi = { create };
|
|
|
18589
18589
|
class MyReporter {
|
|
18590
18590
|
constructor(options) {
|
|
18591
18591
|
this.onBegin = async (config, rootSuite) => {
|
|
18592
|
+
var _a, _b;
|
|
18592
18593
|
const shard = config.shard;
|
|
18594
|
+
this.config = config;
|
|
18595
|
+
this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
|
|
18593
18596
|
let attempts;
|
|
18594
18597
|
this.totalTestCount = rootSuite.allTests().length;
|
|
18595
|
-
|
|
18596
|
-
consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
|
|
18597
|
-
return;
|
|
18598
|
-
}
|
|
18598
|
+
consoleLogFormatted.bold("Started reporting to neetoPlaydash 🎭");
|
|
18599
18599
|
try {
|
|
18600
18600
|
const runDetails = {
|
|
18601
18601
|
commit_id: getCurrentCommitSha(),
|
|
@@ -18608,12 +18608,18 @@ class MyReporter {
|
|
|
18608
18608
|
shards: createShardObject({ currentShard: shard === null || shard === void 0 ? void 0 : shard.current }),
|
|
18609
18609
|
};
|
|
18610
18610
|
await runsApi.create(runDetails);
|
|
18611
|
+
this.hasRunStarted = true;
|
|
18612
|
+
if (this.totalTestCount === 0) {
|
|
18613
|
+
consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
|
|
18614
|
+
return;
|
|
18615
|
+
}
|
|
18611
18616
|
({ data: attempts } = await testEntitiesApi.create(this.ciBuildId, {
|
|
18612
18617
|
test_entities: getInitializerData(config, rootSuite),
|
|
18613
18618
|
}));
|
|
18614
18619
|
}
|
|
18615
18620
|
catch (error) {
|
|
18616
|
-
|
|
18621
|
+
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
18622
|
+
consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message);
|
|
18617
18623
|
throw new Error(ERRORS.onBegin.failedToInitializeRun);
|
|
18618
18624
|
}
|
|
18619
18625
|
consoleLogFormatted.underline(MESSAGES.onBegin.testStarted);
|
|
@@ -18625,8 +18631,6 @@ class MyReporter {
|
|
|
18625
18631
|
await sendHeartBeatSignal(this.ciBuildId);
|
|
18626
18632
|
setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 60000);
|
|
18627
18633
|
this.attempts = attempts;
|
|
18628
|
-
this.config = config;
|
|
18629
|
-
this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
|
|
18630
18634
|
};
|
|
18631
18635
|
this.onTestBegin = async ({ id, title }, { retry }) => {
|
|
18632
18636
|
var _a, _b;
|
|
@@ -18709,9 +18713,11 @@ class MyReporter {
|
|
|
18709
18713
|
}
|
|
18710
18714
|
};
|
|
18711
18715
|
this.onEnd = async ({ status, duration }) => {
|
|
18716
|
+
var _a, _b;
|
|
18712
18717
|
try {
|
|
18713
|
-
while (this.
|
|
18714
|
-
this.
|
|
18718
|
+
while (!(this.hasRunStarted &&
|
|
18719
|
+
this.totalTestCount === this.reportedTestCount &&
|
|
18720
|
+
this.unreportedAttemptCount === 0))
|
|
18715
18721
|
await waitUntilTimeout(100);
|
|
18716
18722
|
await Promise.allSettled(this.testResultCalls);
|
|
18717
18723
|
await runsApi.update(this.ciBuildId, {
|
|
@@ -18723,7 +18729,8 @@ class MyReporter {
|
|
|
18723
18729
|
});
|
|
18724
18730
|
}
|
|
18725
18731
|
catch (error) {
|
|
18726
|
-
|
|
18732
|
+
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
18733
|
+
consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message);
|
|
18727
18734
|
throw new Error(ERRORS.onEnd.failedToReportRunStatus);
|
|
18728
18735
|
}
|
|
18729
18736
|
finally {
|
|
@@ -18739,9 +18746,11 @@ class MyReporter {
|
|
|
18739
18746
|
this.totalTestCount = 0;
|
|
18740
18747
|
this.reportedTestCount = 0;
|
|
18741
18748
|
this.unreportedAttemptCount = 0;
|
|
18749
|
+
this.hasRunStarted = false;
|
|
18742
18750
|
process.on("unhandledRejection", error => {
|
|
18743
|
-
var _a;
|
|
18744
|
-
|
|
18751
|
+
var _a, _b, _c;
|
|
18752
|
+
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
18753
|
+
consoleLogFormatted.error((_c = (_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message) !== null && _c !== void 0 ? _c : JSON.stringify(error));
|
|
18745
18754
|
});
|
|
18746
18755
|
}
|
|
18747
18756
|
}
|