@checkly/playwright-reporter 0.1.8 → 0.1.9

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/dist/index.d.ts CHANGED
@@ -200,6 +200,12 @@ declare class ChecklyReporter implements Reporter {
200
200
  * Traverses the report structure and matches by test ID + retry
201
201
  */
202
202
  private injectDataIntoReport;
203
+ /**
204
+ * Reconstructs config.projects and test.projectId from test data
205
+ * This is necessary for blob merge scenarios where Playwright's JSON reporter
206
+ * doesn't populate projects array or projectId fields
207
+ */
208
+ private reconstructProjectsFromTests;
203
209
  /**
204
210
  * Uploads test results to Checkly API
205
211
  */
package/dist/index.js CHANGED
@@ -991,6 +991,43 @@ var ChecklyReporter = class {
991
991
  for (const suite of report.suites) {
992
992
  processSuite(suite);
993
993
  }
994
+ this.reconstructProjectsFromTests(report);
995
+ }
996
+ /**
997
+ * Reconstructs config.projects and test.projectId from test data
998
+ * This is necessary for blob merge scenarios where Playwright's JSON reporter
999
+ * doesn't populate projects array or projectId fields
1000
+ */
1001
+ reconstructProjectsFromTests(report) {
1002
+ const projectNames = /* @__PURE__ */ new Set();
1003
+ const collectProjectNames = (suite) => {
1004
+ for (const spec of suite.specs) {
1005
+ for (const test of spec.tests) {
1006
+ const testAny = test;
1007
+ if (testAny.projectName) {
1008
+ projectNames.add(testAny.projectName);
1009
+ }
1010
+ if (testAny.projectName && !testAny.projectId) {
1011
+ testAny.projectId = testAny.projectName;
1012
+ }
1013
+ }
1014
+ }
1015
+ if (suite.suites) {
1016
+ for (const nestedSuite of suite.suites) {
1017
+ collectProjectNames(nestedSuite);
1018
+ }
1019
+ }
1020
+ };
1021
+ for (const suite of report.suites) {
1022
+ collectProjectNames(suite);
1023
+ }
1024
+ const configAny = report.config;
1025
+ if ((!configAny.projects || configAny.projects.length === 0) && projectNames.size > 0) {
1026
+ configAny.projects = Array.from(projectNames).map((name) => ({
1027
+ id: name,
1028
+ name
1029
+ }));
1030
+ }
994
1031
  }
995
1032
  /**
996
1033
  * Uploads test results to Checkly API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkly/playwright-reporter",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Playwright reporter that generates ZIP archives containing JSON reports and test assets",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",