@bigbinary/neeto-playwright-reporter 1.3.9 → 1.3.11

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
@@ -18,6 +18,7 @@ declare class MyReporter implements Reporter {
18
18
  reportedTestCount: number;
19
19
  tags: string[] | string;
20
20
  unreportedAttemptCount: number;
21
+ hasRunStarted: boolean;
21
22
  constructor(options: ReporterOptionParams);
22
23
  onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
23
24
  onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
package/index.js CHANGED
@@ -18592,10 +18592,6 @@ class MyReporter {
18592
18592
  const shard = config.shard;
18593
18593
  let attempts;
18594
18594
  this.totalTestCount = rootSuite.allTests().length;
18595
- if (this.totalTestCount === 0) {
18596
- consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18597
- process.exit(0);
18598
- }
18599
18595
  try {
18600
18596
  const runDetails = {
18601
18597
  commit_id: getCurrentCommitSha(),
@@ -18608,6 +18604,11 @@ class MyReporter {
18608
18604
  shards: createShardObject({ currentShard: shard === null || shard === void 0 ? void 0 : shard.current }),
18609
18605
  };
18610
18606
  await runsApi.create(runDetails);
18607
+ this.hasRunStarted = true;
18608
+ if (this.totalTestCount === 0) {
18609
+ consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18610
+ return;
18611
+ }
18611
18612
  ({ data: attempts } = await testEntitiesApi.create(this.ciBuildId, {
18612
18613
  test_entities: getInitializerData(config, rootSuite),
18613
18614
  }));
@@ -18710,8 +18711,9 @@ class MyReporter {
18710
18711
  };
18711
18712
  this.onEnd = async ({ status, duration }) => {
18712
18713
  try {
18713
- while (this.totalTestCount !== this.reportedTestCount &&
18714
- this.unreportedAttemptCount !== 0)
18714
+ while (!(this.hasRunStarted &&
18715
+ this.totalTestCount === this.reportedTestCount &&
18716
+ this.unreportedAttemptCount === 0))
18715
18717
  await waitUntilTimeout(100);
18716
18718
  await Promise.allSettled(this.testResultCalls);
18717
18719
  await runsApi.update(this.ciBuildId, {
@@ -18739,6 +18741,7 @@ class MyReporter {
18739
18741
  this.totalTestCount = 0;
18740
18742
  this.reportedTestCount = 0;
18741
18743
  this.unreportedAttemptCount = 0;
18744
+ this.hasRunStarted = false;
18742
18745
  process.on("unhandledRejection", error => {
18743
18746
  var _a;
18744
18747
  consoleLogFormatted.error((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : JSON.stringify(error));