@bigbinary/neeto-playwright-reporter 1.3.15 → 1.3.16
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 +17 -8
- package/index.cjs.js.map +1 -1
- package/index.js +17 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18449,6 +18449,8 @@ const getDirectUploadURL = (payload) => axios.post(`${API_BASE_URL}/reporter/dir
|
|
|
18449
18449
|
});
|
|
18450
18450
|
const uploadToS3 = (data, { url, headers }) => axios.put(url, data, { headers });
|
|
18451
18451
|
|
|
18452
|
+
const VALID_ASSET_TYPES = ["screenshot", "video", "trace"];
|
|
18453
|
+
|
|
18452
18454
|
const ERRORS = {
|
|
18453
18455
|
onBegin: {
|
|
18454
18456
|
noTestsToReport: "No tests to report",
|
|
@@ -18464,6 +18466,9 @@ const ERRORS = {
|
|
|
18464
18466
|
onEnd: {
|
|
18465
18467
|
failedToReportRunStatus: "Failed to report run status",
|
|
18466
18468
|
},
|
|
18469
|
+
onTestEnd: {
|
|
18470
|
+
attemptAlreadyReported: "Attempt was already reported",
|
|
18471
|
+
},
|
|
18467
18472
|
heartbeat: {
|
|
18468
18473
|
stopped: "Run was stopped at the reporter",
|
|
18469
18474
|
},
|
|
@@ -18471,7 +18476,7 @@ const ERRORS = {
|
|
|
18471
18476
|
|
|
18472
18477
|
const MESSAGES = {
|
|
18473
18478
|
onBegin: {
|
|
18474
|
-
testStarted: "
|
|
18479
|
+
testStarted: "Started reporting to NeetoPlaydash 🎭",
|
|
18475
18480
|
ciBuildId: (currentCiBuildId) => `CI BUILD ID: ${currentCiBuildId}`,
|
|
18476
18481
|
totalShards: (totalShards) => `Total shards: ${totalShards}`,
|
|
18477
18482
|
currentShard: (currentShard) => `Current shard: ${currentShard}`,
|
|
@@ -18480,10 +18485,10 @@ const MESSAGES = {
|
|
|
18480
18485
|
startingTest: (titlePath) => `Starting ${titlePath}`,
|
|
18481
18486
|
},
|
|
18482
18487
|
onTestEnd: {
|
|
18483
|
-
reportedTest: (title) => `Reported ${title} to
|
|
18488
|
+
reportedTest: (title) => `Reported ${title} to NeetoPlaydash`,
|
|
18484
18489
|
},
|
|
18485
18490
|
onEnd: {
|
|
18486
|
-
runReported: "Run completed and reported to
|
|
18491
|
+
runReported: "Run completed and reported to NeetoPlaydash 🎉",
|
|
18487
18492
|
},
|
|
18488
18493
|
};
|
|
18489
18494
|
|
|
@@ -18499,13 +18504,14 @@ const LOG_LEVEL_FORMATTERS = {
|
|
|
18499
18504
|
invertBackground: "\x1b[7m",
|
|
18500
18505
|
hidden: "\x1b[8m",
|
|
18501
18506
|
error: "\u001b[31m\x1b[1m",
|
|
18507
|
+
redText: "\u001b[31m\x1b[1m", // Same ANSI style as error but in log level printing important errors
|
|
18502
18508
|
warning: "\u001b[33m\x1b[1m",
|
|
18503
18509
|
};
|
|
18504
18510
|
|
|
18505
18511
|
class ConsoleLogFormatted {
|
|
18506
18512
|
constructor() {
|
|
18507
18513
|
this.LOG_LEVELS = {
|
|
18508
|
-
info: ["bold", "dim", "underline", "invertBackground", "hidden"],
|
|
18514
|
+
info: ["bold", "dim", "underline", "invertBackground", "hidden", "redText"],
|
|
18509
18515
|
get warning() {
|
|
18510
18516
|
return [...this.info, "warning"];
|
|
18511
18517
|
},
|
|
@@ -18593,7 +18599,7 @@ const sendHeartBeatSignal = async (ciBuildId) => {
|
|
|
18593
18599
|
await runsApi.heartbeat(ciBuildId);
|
|
18594
18600
|
}
|
|
18595
18601
|
catch (error) {
|
|
18596
|
-
|
|
18602
|
+
consoleLogFormatted.redText(error.message);
|
|
18597
18603
|
consoleLogFormatted.error(ERRORS.heartbeat.stopped);
|
|
18598
18604
|
process.exit(1);
|
|
18599
18605
|
}
|
|
@@ -18627,7 +18633,6 @@ class MyReporter {
|
|
|
18627
18633
|
this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
|
|
18628
18634
|
let attempts;
|
|
18629
18635
|
this.totalTestCount = rootSuite.allTests().length;
|
|
18630
|
-
consoleLogFormatted.bold("Started reporting to NeetoPlaydash 🎭");
|
|
18631
18636
|
try {
|
|
18632
18637
|
const runDetails = {
|
|
18633
18638
|
commit_id: getCurrentCommitSha(),
|
|
@@ -18653,6 +18658,7 @@ class MyReporter {
|
|
|
18653
18658
|
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
18654
18659
|
consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message);
|
|
18655
18660
|
consoleLogFormatted.error(ERRORS.onBegin.failedToInitializeRun);
|
|
18661
|
+
process.kill(process.pid, "SIGKILL");
|
|
18656
18662
|
process.exit(1);
|
|
18657
18663
|
}
|
|
18658
18664
|
consoleLogFormatted.underline(MESSAGES.onBegin.testStarted);
|
|
@@ -18696,6 +18702,7 @@ class MyReporter {
|
|
|
18696
18702
|
catch (error) {
|
|
18697
18703
|
consoleLogFormatted.error(error.message);
|
|
18698
18704
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18705
|
+
await sendHeartBeatSignal(this.ciBuildId);
|
|
18699
18706
|
}
|
|
18700
18707
|
};
|
|
18701
18708
|
this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
|
|
@@ -18720,7 +18727,7 @@ class MyReporter {
|
|
|
18720
18727
|
consoleLogFormatted.underline(title);
|
|
18721
18728
|
await Promise.all(attachments.map(async ({ name, path, body, contentType, }) => {
|
|
18722
18729
|
consoleLogFormatted.dim(`${name}: ${path}`);
|
|
18723
|
-
if (
|
|
18730
|
+
if (VALID_ASSET_TYPES.includes(name)) {
|
|
18724
18731
|
const buffer = path ? require$$6.readFileSync(path) : body;
|
|
18725
18732
|
const fileName = path
|
|
18726
18733
|
? path.split("/").slice(-1)[0]
|
|
@@ -18740,6 +18747,7 @@ class MyReporter {
|
|
|
18740
18747
|
catch (error) {
|
|
18741
18748
|
consoleLogFormatted.error(error.message);
|
|
18742
18749
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18750
|
+
await sendHeartBeatSignal(this.ciBuildId);
|
|
18743
18751
|
}
|
|
18744
18752
|
finally {
|
|
18745
18753
|
this.unreportedAttemptCount--;
|
|
@@ -18779,9 +18787,10 @@ class MyReporter {
|
|
|
18779
18787
|
this.unreportedAttemptCount = 0;
|
|
18780
18788
|
this.hasRunStarted = false;
|
|
18781
18789
|
this.testAttemptIds = [];
|
|
18782
|
-
process.on("unhandledRejection", error => {
|
|
18790
|
+
process.on("unhandledRejection", async (error) => {
|
|
18783
18791
|
var _a, _b, _c;
|
|
18784
18792
|
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
18793
|
+
await sendHeartBeatSignal(this.ciBuildId);
|
|
18785
18794
|
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));
|
|
18786
18795
|
});
|
|
18787
18796
|
}
|