@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.cjs.js CHANGED
@@ -18470,6 +18470,7 @@ const uploadToS3 = (data, { url, headers }) => axios.put(url, data, { headers })
18470
18470
 
18471
18471
  const ERRORS = {
18472
18472
  onBegin: {
18473
+ noTestsToReport: "No tests to report",
18473
18474
  failedToGetCommitSha: "Failed to get current commit SHA.",
18474
18475
  failedToGetBranch: "Failed to get current branch.",
18475
18476
  failedToGetCommitMessage: "Failed to get current commit message.",
@@ -18602,6 +18603,10 @@ class MyReporter {
18602
18603
  const shard = config.shard;
18603
18604
  let attempts;
18604
18605
  this.totalTestCount = rootSuite.allTests().length;
18606
+ if (this.totalTestCount === 0) {
18607
+ consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18608
+ process.exit(0);
18609
+ }
18605
18610
  try {
18606
18611
  const runDetails = {
18607
18612
  commit_id: getCurrentCommitSha(),
@@ -18663,8 +18668,9 @@ class MyReporter {
18663
18668
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18664
18669
  }
18665
18670
  };
18666
- this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
18671
+ this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
18667
18672
  const completedAt = new Date();
18673
+ const errorLocation = error === null || error === void 0 ? void 0 : error.location;
18668
18674
  const { id, title, expectedStatus } = testCase;
18669
18675
  try {
18670
18676
  const testResult = {
@@ -18677,6 +18683,7 @@ class MyReporter {
18677
18683
  videos: [],
18678
18684
  traces: [],
18679
18685
  completed_at: completedAt.toString(),
18686
+ 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}`,
18680
18687
  };
18681
18688
  consoleLogFormatted.underline(title);
18682
18689
  await Promise.all(attachments.map(async ({ name, path, body, contentType, }) => {