@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.d.ts CHANGED
@@ -15,6 +15,7 @@ declare class MyReporter implements Reporter {
15
15
  testResultCalls: Promise<unknown>[];
16
16
  totalTestCount: number;
17
17
  reportedTestCount: number;
18
+ unreportedAttemptCount: number;
18
19
  constructor(options: ReporterOptionParams);
19
20
  onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
20
21
  onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
package/index.js CHANGED
@@ -18470,7 +18470,7 @@ const ERRORS = {
18470
18470
 
18471
18471
  const MESSAGES = {
18472
18472
  onBegin: {
18473
- testStarted: "Run has started reporting to neetoPlaywrightReporter",
18473
+ testStarted: "Run has started reporting to neetoPlaydash",
18474
18474
  ciBuildId: (currentCiBuildId) => `CI BUILD ID: ${currentCiBuildId}`,
18475
18475
  totalShards: (totalShards) => `Total shards: ${totalShards}`,
18476
18476
  currentShard: (currentShard) => `Current shard: ${currentShard}`,
@@ -18481,6 +18481,9 @@ const MESSAGES = {
18481
18481
  onTestEnd: {
18482
18482
  reportedTest: (title) => `Reported ${title} to neetoPlaywrightReporter`,
18483
18483
  },
18484
+ onEnd: {
18485
+ runReported: "Run completed and reported to neetoPlaydash 🎉",
18486
+ },
18484
18487
  };
18485
18488
 
18486
18489
  const consoleLogFormatted = {
@@ -18620,6 +18623,7 @@ class MyReporter {
18620
18623
  };
18621
18624
  this.onTestBegin = async ({ id, title }, { retry }) => {
18622
18625
  var _a, _b;
18626
+ this.unreportedAttemptCount++;
18623
18627
  consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title));
18624
18628
  try {
18625
18629
  this.retryAttemptStartedAt = new Date();
@@ -18684,21 +18688,23 @@ class MyReporter {
18684
18688
  while (!this.attempts[id][retry])
18685
18689
  await waitUntilTimeout(100);
18686
18690
  this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][retry], testResult));
18687
- consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
18688
18691
  }
18689
18692
  catch (error) {
18690
18693
  consoleLogFormatted.error(error.message);
18691
18694
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18692
18695
  }
18693
18696
  finally {
18697
+ this.unreportedAttemptCount--;
18694
18698
  retry === 0 && this.reportedTestCount++;
18699
+ consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
18695
18700
  }
18696
18701
  };
18697
18702
  this.onEnd = async ({ status, duration }) => {
18698
18703
  try {
18699
- await Promise.allSettled(this.testResultCalls);
18700
- while (this.totalTestCount !== this.reportedTestCount)
18704
+ while (this.totalTestCount !== this.reportedTestCount &&
18705
+ this.unreportedAttemptCount !== 0)
18701
18706
  await waitUntilTimeout(100);
18707
+ await Promise.allSettled(this.testResultCalls);
18702
18708
  await runsApi.update(this.ciBuildId, {
18703
18709
  shards: createShardObject({
18704
18710
  currentShard: this.currentShard,
@@ -18711,6 +18717,9 @@ class MyReporter {
18711
18717
  consoleLogFormatted.error(error.message);
18712
18718
  throw new Error(ERRORS.onEnd.failedToReportRunStatus);
18713
18719
  }
18720
+ finally {
18721
+ consoleLogFormatted.invertBackground(MESSAGES.onEnd.runReported);
18722
+ }
18714
18723
  };
18715
18724
  initializeAxios(options);
18716
18725
  this.attempts = {};
@@ -18719,6 +18728,7 @@ class MyReporter {
18719
18728
  this.testResultCalls = [];
18720
18729
  this.totalTestCount = 0;
18721
18730
  this.reportedTestCount = 0;
18731
+ this.unreportedAttemptCount = 0;
18722
18732
  process.on("unhandledRejection", error => {
18723
18733
  var _a;
18724
18734
  consoleLogFormatted.error((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : JSON.stringify(error));