@bigbinary/neeto-playwright-reporter 1.3.5 → 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.",
@@ -18577,19 +18578,18 @@ const sendHeartBeatSignal = async (ciBuildId) => {
18577
18578
  }
18578
18579
  };
18579
18580
 
18580
- const setAuthHeaders = (projectKey) => {
18581
- var _a;
18581
+ const setAuthHeaders = ({ projectKey, apiKey, }) => {
18582
18582
  axios.defaults.headers = {
18583
18583
  ...axios.defaults.headers,
18584
18584
  [HEADERS_KEYS.projectKey]: projectKey,
18585
- [HEADERS_KEYS.apiKey]: (_a = process.env.API_KEY) !== null && _a !== void 0 ? _a : "",
18585
+ [HEADERS_KEYS.apiKey]: apiKey !== null && apiKey !== void 0 ? apiKey : "",
18586
18586
  [HEADERS_KEYS.accept]: "application/json",
18587
18587
  [HEADERS_KEYS.contentType]: "application/json",
18588
18588
  };
18589
18589
  };
18590
- function initializeAxios({ projectKey, baseURL, }) {
18590
+ function initializeAxios({ projectKey, baseURL, apiKey, }) {
18591
18591
  axios.defaults.baseURL = baseURL !== null && baseURL !== void 0 ? baseURL : "https://connect.neetoplaydash.net";
18592
- setAuthHeaders(projectKey);
18592
+ setAuthHeaders({ projectKey, apiKey });
18593
18593
  }
18594
18594
 
18595
18595
  const create = (ciBuildId, payload) => axios.post(`${API_BASE_URL}/reporter/runs/${ciBuildId}/test_entities`, {
@@ -18603,6 +18603,10 @@ class MyReporter {
18603
18603
  const shard = config.shard;
18604
18604
  let attempts;
18605
18605
  this.totalTestCount = rootSuite.allTests().length;
18606
+ if (this.totalTestCount === 0) {
18607
+ consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
18608
+ process.exit(0);
18609
+ }
18606
18610
  try {
18607
18611
  const runDetails = {
18608
18612
  commit_id: getCurrentCommitSha(),
@@ -18664,8 +18668,9 @@ class MyReporter {
18664
18668
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18665
18669
  }
18666
18670
  };
18667
- this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
18671
+ this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
18668
18672
  const completedAt = new Date();
18673
+ const errorLocation = error === null || error === void 0 ? void 0 : error.location;
18669
18674
  const { id, title, expectedStatus } = testCase;
18670
18675
  try {
18671
18676
  const testResult = {
@@ -18678,6 +18683,7 @@ class MyReporter {
18678
18683
  videos: [],
18679
18684
  traces: [],
18680
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}`,
18681
18687
  };
18682
18688
  consoleLogFormatted.underline(title);
18683
18689
  await Promise.all(attachments.map(async ({ name, path, body, contentType, }) => {