@bigbinary/neeto-playwright-reporter 1.3.6 → 1.3.8
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 -5
- package/index.cjs.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +22 -5
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -18470,6 +18470,7 @@ const uploadToS3 = (data, { url, headers }) => axios.put(url, data, { headers })
|
|
|
18470
18470
|
|
|
18471
18471
|
const ERRORS = {
|
|
18472
18472
|
onBegin: {
|
|
18473
|
+
noTestsToReport: "No tests to report",
|
|
18473
18474
|
failedToGetCommitSha: "Failed to get current commit SHA.",
|
|
18474
18475
|
failedToGetBranch: "Failed to get current branch.",
|
|
18475
18476
|
failedToGetCommitMessage: "Failed to get current commit message.",
|
|
@@ -18488,7 +18489,7 @@ const ERRORS = {
|
|
|
18488
18489
|
|
|
18489
18490
|
const MESSAGES = {
|
|
18490
18491
|
onBegin: {
|
|
18491
|
-
testStarted: "Run has started reporting to
|
|
18492
|
+
testStarted: "Run has started reporting to neetoPlaydash",
|
|
18492
18493
|
ciBuildId: (currentCiBuildId) => `CI BUILD ID: ${currentCiBuildId}`,
|
|
18493
18494
|
totalShards: (totalShards) => `Total shards: ${totalShards}`,
|
|
18494
18495
|
currentShard: (currentShard) => `Current shard: ${currentShard}`,
|
|
@@ -18499,6 +18500,9 @@ const MESSAGES = {
|
|
|
18499
18500
|
onTestEnd: {
|
|
18500
18501
|
reportedTest: (title) => `Reported ${title} to neetoPlaywrightReporter`,
|
|
18501
18502
|
},
|
|
18503
|
+
onEnd: {
|
|
18504
|
+
runReported: "Run completed and reported to neetoPlaydash 🎉",
|
|
18505
|
+
},
|
|
18502
18506
|
};
|
|
18503
18507
|
|
|
18504
18508
|
const consoleLogFormatted = {
|
|
@@ -18602,6 +18606,10 @@ class MyReporter {
|
|
|
18602
18606
|
const shard = config.shard;
|
|
18603
18607
|
let attempts;
|
|
18604
18608
|
this.totalTestCount = rootSuite.allTests().length;
|
|
18609
|
+
if (this.totalTestCount === 0) {
|
|
18610
|
+
consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
|
|
18611
|
+
process.exit(0);
|
|
18612
|
+
}
|
|
18605
18613
|
try {
|
|
18606
18614
|
const runDetails = {
|
|
18607
18615
|
commit_id: getCurrentCommitSha(),
|
|
@@ -18634,6 +18642,7 @@ class MyReporter {
|
|
|
18634
18642
|
};
|
|
18635
18643
|
this.onTestBegin = async ({ id, title }, { retry }) => {
|
|
18636
18644
|
var _a, _b;
|
|
18645
|
+
this.unreportedAttemptCount++;
|
|
18637
18646
|
consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title));
|
|
18638
18647
|
try {
|
|
18639
18648
|
this.retryAttemptStartedAt = new Date();
|
|
@@ -18663,8 +18672,9 @@ class MyReporter {
|
|
|
18663
18672
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18664
18673
|
}
|
|
18665
18674
|
};
|
|
18666
|
-
this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
|
|
18675
|
+
this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
|
|
18667
18676
|
const completedAt = new Date();
|
|
18677
|
+
const errorLocation = error === null || error === void 0 ? void 0 : error.location;
|
|
18668
18678
|
const { id, title, expectedStatus } = testCase;
|
|
18669
18679
|
try {
|
|
18670
18680
|
const testResult = {
|
|
@@ -18677,6 +18687,7 @@ class MyReporter {
|
|
|
18677
18687
|
videos: [],
|
|
18678
18688
|
traces: [],
|
|
18679
18689
|
completed_at: completedAt.toString(),
|
|
18690
|
+
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}`,
|
|
18680
18691
|
};
|
|
18681
18692
|
consoleLogFormatted.underline(title);
|
|
18682
18693
|
await Promise.all(attachments.map(async ({ name, path, body, contentType, }) => {
|
|
@@ -18696,21 +18707,23 @@ class MyReporter {
|
|
|
18696
18707
|
while (!this.attempts[id][retry])
|
|
18697
18708
|
await waitUntilTimeout(100);
|
|
18698
18709
|
this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][retry], testResult));
|
|
18699
|
-
consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
|
|
18700
18710
|
}
|
|
18701
18711
|
catch (error) {
|
|
18702
18712
|
consoleLogFormatted.error(error.message);
|
|
18703
18713
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18704
18714
|
}
|
|
18705
18715
|
finally {
|
|
18716
|
+
this.unreportedAttemptCount--;
|
|
18706
18717
|
retry === 0 && this.reportedTestCount++;
|
|
18718
|
+
consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
|
|
18707
18719
|
}
|
|
18708
18720
|
};
|
|
18709
18721
|
this.onEnd = async ({ status, duration }) => {
|
|
18710
18722
|
try {
|
|
18711
|
-
|
|
18712
|
-
|
|
18723
|
+
while (this.totalTestCount !== this.reportedTestCount &&
|
|
18724
|
+
this.unreportedAttemptCount !== 0)
|
|
18713
18725
|
await waitUntilTimeout(100);
|
|
18726
|
+
await Promise.allSettled(this.testResultCalls);
|
|
18714
18727
|
await runsApi.update(this.ciBuildId, {
|
|
18715
18728
|
shards: createShardObject({
|
|
18716
18729
|
currentShard: this.currentShard,
|
|
@@ -18723,6 +18736,9 @@ class MyReporter {
|
|
|
18723
18736
|
consoleLogFormatted.error(error.message);
|
|
18724
18737
|
throw new Error(ERRORS.onEnd.failedToReportRunStatus);
|
|
18725
18738
|
}
|
|
18739
|
+
finally {
|
|
18740
|
+
consoleLogFormatted.invertBackground(MESSAGES.onEnd.runReported);
|
|
18741
|
+
}
|
|
18726
18742
|
};
|
|
18727
18743
|
initializeAxios(options);
|
|
18728
18744
|
this.attempts = {};
|
|
@@ -18731,6 +18747,7 @@ class MyReporter {
|
|
|
18731
18747
|
this.testResultCalls = [];
|
|
18732
18748
|
this.totalTestCount = 0;
|
|
18733
18749
|
this.reportedTestCount = 0;
|
|
18750
|
+
this.unreportedAttemptCount = 0;
|
|
18734
18751
|
process.on("unhandledRejection", error => {
|
|
18735
18752
|
var _a;
|
|
18736
18753
|
consoleLogFormatted.error((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : JSON.stringify(error));
|