@flakiness/sdk 2.5.0 → 2.7.0

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/README.md CHANGED
@@ -34,7 +34,7 @@ const env = ReportUtils.createEnvironment({ name: 'CI' });
34
34
  const report: FlakinessReport.Report = {
35
35
  category: 'testreport',
36
36
  commitId: worktree.headCommitId(),
37
- title: CIUtils.runTitle(),
37
+ title: process.env.FLAKINESS_TITLE,
38
38
  url: CIUtils.runUrl(),
39
39
  environments: [env],
40
40
  suites: [{
package/lib/browser.js CHANGED
@@ -33,6 +33,7 @@ function normalizeReport(report) {
33
33
  return {
34
34
  ...step,
35
35
  duration: step.duration === 0 ? void 0 : step.duration,
36
+ attachments: step.attachments && step.attachments.length ? step.attachments : void 0,
36
37
  steps: step.steps && step.steps.length ? step.steps.map(cleanupTestStep) : void 0
37
38
  };
38
39
  }
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  var CIUtils;
9
9
  ((CIUtils2) => {
10
10
  function runTitle() {
11
- return githubActionsTitle();
11
+ return void 0;
12
12
  }
13
13
  CIUtils2.runTitle = runTitle;
14
14
  function runUrl() {
@@ -16,10 +16,6 @@ var CIUtils;
16
16
  }
17
17
  CIUtils2.runUrl = runUrl;
18
18
  })(CIUtils || (CIUtils = {}));
19
- function githubActionsTitle() {
20
- const title = process.env.GITHUB_WORKFLOW?.trim();
21
- return title || void 0;
22
- }
23
19
  function githubActions() {
24
20
  const serverUrl = process.env.GITHUB_SERVER_URL || "https://github.com";
25
21
  const repo = process.env.GITHUB_REPOSITORY;
@@ -707,6 +703,7 @@ function normalizeReport(report) {
707
703
  return {
708
704
  ...step,
709
705
  duration: step.duration === 0 ? void 0 : step.duration,
706
+ attachments: step.attachments && step.attachments.length ? step.attachments : void 0,
710
707
  steps: step.steps && step.steps.length ? step.steps.map(cleanupTestStep) : void 0
711
708
  };
712
709
  }
@@ -1105,21 +1102,31 @@ async function readReport(reportFolder) {
1105
1102
  const filenameToPath = new Map(attachmentFiles.map((file) => [path.basename(file), file]));
1106
1103
  const attachmentIdToPath = /* @__PURE__ */ new Map();
1107
1104
  const missingAttachments = /* @__PURE__ */ new Map();
1105
+ const visitAttachment = (attachment) => {
1106
+ const attachmentPath = filenameToPath.get(attachment.id);
1107
+ if (!attachmentPath) {
1108
+ missingAttachments.set(attachment.id, attachment);
1109
+ } else {
1110
+ attachmentIdToPath.set(attachment.id, {
1111
+ contentType: attachment.contentType,
1112
+ id: attachment.id,
1113
+ path: attachmentPath,
1114
+ type: "file"
1115
+ });
1116
+ }
1117
+ };
1118
+ const visitStep = (step) => {
1119
+ for (const attachment of step.attachments ?? [])
1120
+ visitAttachment(attachment);
1121
+ for (const childStep of step.steps ?? [])
1122
+ visitStep(childStep);
1123
+ };
1108
1124
  visitTests(report, (test) => {
1109
1125
  for (const attempt of test.attempts) {
1110
- for (const attachment of attempt.attachments ?? []) {
1111
- const attachmentPath = filenameToPath.get(attachment.id);
1112
- if (!attachmentPath) {
1113
- missingAttachments.set(attachment.id, attachment);
1114
- } else {
1115
- attachmentIdToPath.set(attachment.id, {
1116
- contentType: attachment.contentType,
1117
- id: attachment.id,
1118
- path: attachmentPath,
1119
- type: "file"
1120
- });
1121
- }
1122
- }
1126
+ for (const attachment of attempt.attachments ?? [])
1127
+ visitAttachment(attachment);
1128
+ for (const step of attempt.steps ?? [])
1129
+ visitStep(step);
1123
1130
  }
1124
1131
  });
1125
1132
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flakiness/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "node": "^20.17.0 || >=22.9.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@flakiness/flakiness-report": "^0.28.0",
31
+ "@flakiness/flakiness-report": "^0.31.0",
32
32
  "@flakiness/playwright": "^1.3.3",
33
33
  "@playwright/test": "^1.58.2",
34
34
  "@types/debug": "^4.1.12",
@@ -6,24 +6,10 @@
6
6
  */
7
7
  export declare namespace CIUtils {
8
8
  /**
9
- * Automatically extracts a human-readable CI run title when available.
9
+ * @deprecated Use the `title` reporter option or `FLAKINESS_TITLE` environment variable instead.
10
+ * See https://docs.flakiness.io/report/customization/#title
10
11
  *
11
- * This function attempts to detect the current CI environment and return a
12
- * stable title that identifies the workflow or pipeline generating the report.
13
- *
14
- * Supported CI providers (checked in order):
15
- * - GitHub Actions (via `GITHUB_WORKFLOW`)
16
- *
17
- * @returns {string | undefined} The CI run title, or `undefined` if no supported
18
- * CI environment exposes a stable human-readable title.
19
- *
20
- * @example
21
- * ```typescript
22
- * const report: FlakinessReport.Report = {
23
- * // ... other report properties
24
- * title: CIUtils.runTitle(),
25
- * };
26
- * ```
12
+ * @returns {undefined} Always returns `undefined`.
27
13
  */
28
14
  function runTitle(): string | undefined;
29
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ciUtils.d.ts","sourceRoot":"","sources":["../../src/ciUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,OAAO,CAAC;IACvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAgB,QAAQ,IAAI,MAAM,GAAG,SAAS,CAE7C;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3C;CACF"}
1
+ {"version":3,"file":"ciUtils.d.ts","sourceRoot":"","sources":["../../src/ciUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,OAAO,CAAC;IACvB;;;;;OAKG;IACH,SAAgB,QAAQ,IAAI,MAAM,GAAG,SAAS,CAE7C;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3C;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeReport.d.ts","sourceRoot":"","sources":["../../src/normalizeReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAyB9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAmDtF"}
1
+ {"version":3,"file":"normalizeReport.d.ts","sourceRoot":"","sources":["../../src/normalizeReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAyB9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAoDtF"}
@@ -1 +1 @@
1
- {"version":3,"file":"readReport.d.ts","sourceRoot":"","sources":["../../src/readReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9D,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,kBAAkB,EAAE,eAAe,CAAC,UAAU,EAAE,CAAC;CAClD,CAAC,CA0CD"}
1
+ {"version":3,"file":"readReport.d.ts","sourceRoot":"","sources":["../../src/readReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9D,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,kBAAkB,EAAE,eAAe,CAAC,UAAU,EAAE,CAAC;CAClD,CAAC,CAoDD"}