@bigbinary/neeto-playwright-reporter 1.3.7 → 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 CHANGED
@@ -18489,7 +18489,7 @@ const ERRORS = {
18489
18489
 
18490
18490
  const MESSAGES = {
18491
18491
  onBegin: {
18492
- testStarted: "Run has started reporting to neetoPlaywrightReporter",
18492
+ testStarted: "Run has started reporting to neetoPlaydash",
18493
18493
  ciBuildId: (currentCiBuildId) => `CI BUILD ID: ${currentCiBuildId}`,
18494
18494
  totalShards: (totalShards) => `Total shards: ${totalShards}`,
18495
18495
  currentShard: (currentShard) => `Current shard: ${currentShard}`,
@@ -18500,6 +18500,9 @@ const MESSAGES = {
18500
18500
  onTestEnd: {
18501
18501
  reportedTest: (title) => `Reported ${title} to neetoPlaywrightReporter`,
18502
18502
  },
18503
+ onEnd: {
18504
+ runReported: "Run completed and reported to neetoPlaydash 🎉",
18505
+ },
18503
18506
  };
18504
18507
 
18505
18508
  const consoleLogFormatted = {
@@ -18639,6 +18642,7 @@ class MyReporter {
18639
18642
  };
18640
18643
  this.onTestBegin = async ({ id, title }, { retry }) => {
18641
18644
  var _a, _b;
18645
+ this.unreportedAttemptCount++;
18642
18646
  consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title));
18643
18647
  try {
18644
18648
  this.retryAttemptStartedAt = new Date();
@@ -18703,21 +18707,23 @@ class MyReporter {
18703
18707
  while (!this.attempts[id][retry])
18704
18708
  await waitUntilTimeout(100);
18705
18709
  this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][retry], testResult));
18706
- consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
18707
18710
  }
18708
18711
  catch (error) {
18709
18712
  consoleLogFormatted.error(error.message);
18710
18713
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18711
18714
  }
18712
18715
  finally {
18716
+ this.unreportedAttemptCount--;
18713
18717
  retry === 0 && this.reportedTestCount++;
18718
+ consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
18714
18719
  }
18715
18720
  };
18716
18721
  this.onEnd = async ({ status, duration }) => {
18717
18722
  try {
18718
- await Promise.allSettled(this.testResultCalls);
18719
- while (this.totalTestCount !== this.reportedTestCount)
18723
+ while (this.totalTestCount !== this.reportedTestCount &&
18724
+ this.unreportedAttemptCount !== 0)
18720
18725
  await waitUntilTimeout(100);
18726
+ await Promise.allSettled(this.testResultCalls);
18721
18727
  await runsApi.update(this.ciBuildId, {
18722
18728
  shards: createShardObject({
18723
18729
  currentShard: this.currentShard,
@@ -18730,6 +18736,9 @@ class MyReporter {
18730
18736
  consoleLogFormatted.error(error.message);
18731
18737
  throw new Error(ERRORS.onEnd.failedToReportRunStatus);
18732
18738
  }
18739
+ finally {
18740
+ consoleLogFormatted.invertBackground(MESSAGES.onEnd.runReported);
18741
+ }
18733
18742
  };
18734
18743
  initializeAxios(options);
18735
18744
  this.attempts = {};
@@ -18738,6 +18747,7 @@ class MyReporter {
18738
18747
  this.testResultCalls = [];
18739
18748
  this.totalTestCount = 0;
18740
18749
  this.reportedTestCount = 0;
18750
+ this.unreportedAttemptCount = 0;
18741
18751
  process.on("unhandledRejection", error => {
18742
18752
  var _a;
18743
18753
  consoleLogFormatted.error((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : JSON.stringify(error));