@bigbinary/neeto-playwright-reporter 1.3.6 → 1.3.7

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,7 +18,7 @@ declare class MyReporter implements Reporter {
18
18
  constructor(options: ReporterOptionParams);
19
19
  onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
20
20
  onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
21
- onTestEnd: (testCase: TestCase, { status, duration, errors, retry, attachments }: TestResult) => Promise<void>;
21
+ onTestEnd: (testCase: TestCase, { status, duration, errors, error, retry, attachments }: TestResult) => Promise<void>;
22
22
  onEnd: ({ status, duration }: FullResult) => Promise<void>;
23
23
  }
24
24
 
package/index.js CHANGED
@@ -18451,6 +18451,7 @@ const uploadToS3 = (data, { url, headers }) => axios.put(url, data, { headers })
18451
18451
 
18452
18452
  const ERRORS = {
18453
18453
  onBegin: {
18454
+ noTestsToReport: "No tests to report",
18454
18455
  failedToGetCommitSha: "Failed to get current commit SHA.",
18455
18456
  failedToGetBranch: "Failed to get current branch.",
18456
18457
  failedToGetCommitMessage: "Failed to get current commit message.",
@@ -18583,6 +18584,10 @@ class MyReporter {
18583
18584
  const shard = config.shard;
18584
18585
  let attempts;
18585
18586
  this.totalTestCount = rootSuite.allTests().length;
18587
+ if (this.totalTestCount === 0) {
18588
+ consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18589
+ process.exit(0);
18590
+ }
18586
18591
  try {
18587
18592
  const runDetails = {
18588
18593
  commit_id: getCurrentCommitSha(),
@@ -18644,8 +18649,9 @@ class MyReporter {
18644
18649
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18645
18650
  }
18646
18651
  };
18647
- this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
18652
+ this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
18648
18653
  const completedAt = new Date();
18654
+ const errorLocation = error === null || error === void 0 ? void 0 : error.location;
18649
18655
  const { id, title, expectedStatus } = testCase;
18650
18656
  try {
18651
18657
  const testResult = {
@@ -18658,6 +18664,7 @@ class MyReporter {
18658
18664
  videos: [],
18659
18665
  traces: [],
18660
18666
  completed_at: completedAt.toString(),
18667
+ error_snippet: `# ${errorLocation === null || errorLocation === void 0 ? void 0 : errorLocation.file} (${errorLocation === null || errorLocation === void 0 ? void 0 : errorLocation.line}:${errorLocation === null || errorLocation === void 0 ? void 0 : errorLocation.column}) \n\n\n ${error === null || error === void 0 ? void 0 : error.snippet}`,
18661
18668
  };
18662
18669
  consoleLogFormatted.underline(title);
18663
18670
  await Promise.all(attachments.map(async ({ name, path, body, contentType, }) => {