@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 CHANGED
@@ -18499,7 +18499,7 @@ const MESSAGES = {
18499
18499
  startingTest: (titlePath) => `Starting ${titlePath}`,
18500
18500
  },
18501
18501
  onTestEnd: {
18502
- reportedTest: (title) => `Reported ${title} to neetoPlaywrightReporter`,
18502
+ reportedTest: (title) => `Reported ${title} to neetoPlaydash`,
18503
18503
  },
18504
18504
  onEnd: {
18505
18505
  runReported: "Run completed and reported to neetoPlaydash 🎉",
@@ -18608,13 +18608,13 @@ const testEntitiesApi = { create };
18608
18608
  class MyReporter {
18609
18609
  constructor(options) {
18610
18610
  this.onBegin = async (config, rootSuite) => {
18611
+ var _a, _b;
18611
18612
  const shard = config.shard;
18613
+ this.config = config;
18614
+ this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
18612
18615
  let attempts;
18613
18616
  this.totalTestCount = rootSuite.allTests().length;
18614
- if (this.totalTestCount === 0) {
18615
- consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18616
- return;
18617
- }
18617
+ consoleLogFormatted.bold("Started reporting to neetoPlaydash 🎭");
18618
18618
  try {
18619
18619
  const runDetails = {
18620
18620
  commit_id: getCurrentCommitSha(),
@@ -18627,12 +18627,18 @@ class MyReporter {
18627
18627
  shards: createShardObject({ currentShard: shard === null || shard === void 0 ? void 0 : shard.current }),
18628
18628
  };
18629
18629
  await runsApi.create(runDetails);
18630
+ this.hasRunStarted = true;
18631
+ if (this.totalTestCount === 0) {
18632
+ consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18633
+ return;
18634
+ }
18630
18635
  ({ data: attempts } = await testEntitiesApi.create(this.ciBuildId, {
18631
18636
  test_entities: getInitializerData(config, rootSuite),
18632
18637
  }));
18633
18638
  }
18634
18639
  catch (error) {
18635
- consoleLogFormatted.error(error.message);
18640
+ const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
18641
+ consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message);
18636
18642
  throw new Error(ERRORS.onBegin.failedToInitializeRun);
18637
18643
  }
18638
18644
  consoleLogFormatted.underline(MESSAGES.onBegin.testStarted);
@@ -18644,8 +18650,6 @@ class MyReporter {
18644
18650
  await sendHeartBeatSignal(this.ciBuildId);
18645
18651
  setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 60000);
18646
18652
  this.attempts = attempts;
18647
- this.config = config;
18648
- this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
18649
18653
  };
18650
18654
  this.onTestBegin = async ({ id, title }, { retry }) => {
18651
18655
  var _a, _b;
@@ -18728,9 +18732,11 @@ class MyReporter {
18728
18732
  }
18729
18733
  };
18730
18734
  this.onEnd = async ({ status, duration }) => {
18735
+ var _a, _b;
18731
18736
  try {
18732
- while (this.totalTestCount !== this.reportedTestCount &&
18733
- this.unreportedAttemptCount !== 0)
18737
+ while (!(this.hasRunStarted &&
18738
+ this.totalTestCount === this.reportedTestCount &&
18739
+ this.unreportedAttemptCount === 0))
18734
18740
  await waitUntilTimeout(100);
18735
18741
  await Promise.allSettled(this.testResultCalls);
18736
18742
  await runsApi.update(this.ciBuildId, {
@@ -18742,7 +18748,8 @@ class MyReporter {
18742
18748
  });
18743
18749
  }
18744
18750
  catch (error) {
18745
- consoleLogFormatted.error(error.message);
18751
+ const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
18752
+ consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message);
18746
18753
  throw new Error(ERRORS.onEnd.failedToReportRunStatus);
18747
18754
  }
18748
18755
  finally {
@@ -18758,9 +18765,11 @@ class MyReporter {
18758
18765
  this.totalTestCount = 0;
18759
18766
  this.reportedTestCount = 0;
18760
18767
  this.unreportedAttemptCount = 0;
18768
+ this.hasRunStarted = false;
18761
18769
  process.on("unhandledRejection", error => {
18762
- var _a;
18763
- consoleLogFormatted.error((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : JSON.stringify(error));
18770
+ var _a, _b, _c;
18771
+ const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
18772
+ 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));
18764
18773
  });
18765
18774
  }
18766
18775
  }