@bigbinary/neeto-playwright-reporter 1.3.17 → 1.3.19

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
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { Reporter, FullConfig, Suite, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
2
3
 
3
4
  interface ReporterOptionParams {
@@ -19,6 +20,7 @@ declare class MyReporter implements Reporter {
19
20
  unreportedAttemptCount: number;
20
21
  hasRunStarted: boolean;
21
22
  testAttemptIds: string[];
23
+ heartbeatInterval: NodeJS.Timeout | null;
22
24
  constructor(options: ReporterOptionParams);
23
25
  onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
24
26
  onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
package/index.js CHANGED
@@ -18627,11 +18627,11 @@ const testEntitiesApi = { create };
18627
18627
  class MyReporter {
18628
18628
  constructor(options) {
18629
18629
  this.onBegin = async (config, rootSuite) => {
18630
- var _a, _b;
18630
+ var _a, _b, _c;
18631
18631
  const shard = config.shard;
18632
18632
  this.config = config;
18633
18633
  this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
18634
- let attempts;
18634
+ let attempts = {};
18635
18635
  this.totalTestCount = rootSuite.allTests().length;
18636
18636
  try {
18637
18637
  const runDetails = {
@@ -18655,11 +18655,12 @@ class MyReporter {
18655
18655
  }));
18656
18656
  }
18657
18657
  catch (error) {
18658
- const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
18659
- consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : error.message);
18658
+ const axiosError = error;
18659
+ const data = (_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data;
18660
+ consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : axiosError.message);
18660
18661
  consoleLogFormatted.error(ERRORS.onBegin.failedToInitializeRun);
18661
18662
  process.kill(process.pid, "SIGKILL");
18662
- process.exit(1);
18663
+ ((_c = axiosError.response) === null || _c === void 0 ? void 0 : _c.status) === 422 && process.exit(1);
18663
18664
  }
18664
18665
  consoleLogFormatted.underline(MESSAGES.onBegin.testStarted);
18665
18666
  consoleLogFormatted.dim(MESSAGES.onBegin.ciBuildId(this.ciBuildId));
@@ -18668,7 +18669,7 @@ class MyReporter {
18668
18669
  consoleLogFormatted.dim(MESSAGES.onBegin.currentShard(shard.current));
18669
18670
  }
18670
18671
  await sendHeartBeatSignal(this.ciBuildId);
18671
- setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 60000);
18672
+ this.heartbeatInterval = setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 45000);
18672
18673
  this.attempts = attempts;
18673
18674
  };
18674
18675
  this.onTestBegin = async ({ id, title }, { retry }) => {
@@ -18775,6 +18776,7 @@ class MyReporter {
18775
18776
  }
18776
18777
  finally {
18777
18778
  consoleLogFormatted.invertBackground(MESSAGES.onEnd.runReported);
18779
+ clearInterval(this.heartbeatInterval);
18778
18780
  }
18779
18781
  };
18780
18782
  initializeAxios(options);
@@ -18787,6 +18789,7 @@ class MyReporter {
18787
18789
  this.unreportedAttemptCount = 0;
18788
18790
  this.hasRunStarted = false;
18789
18791
  this.testAttemptIds = [];
18792
+ this.heartbeatInterval = null;
18790
18793
  process.on("unhandledRejection", async (error) => {
18791
18794
  var _a, _b, _c;
18792
18795
  const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;