@flakiness/sdk 2.3.1 → 2.4.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
@@ -10,7 +10,7 @@ The Flakiness SDK provides a comprehensive set of tools for creating and managin
10
10
  npm i @flakiness/sdk @flakiness/flakiness-report
11
11
  ```
12
12
 
13
- Requires Node.js 22+.
13
+ Requires Node.js ^20.17.0 or >=22.9.0.
14
14
 
15
15
  ## Quick Start
16
16
 
package/lib/browser.js CHANGED
@@ -13,162 +13,8 @@ __export(reportUtilsBrowser_exports, {
13
13
  visitTests: () => visitTests
14
14
  });
15
15
 
16
- // node_modules/.pnpm/@flakiness+flakiness-report@0.28.0_zod@4.3.5/node_modules/@flakiness/flakiness-report/lib/flakinessReport.js
17
- var FlakinessReport;
18
- ((FlakinessReport22) => {
19
- FlakinessReport22.CATEGORY_PLAYWRIGHT = "playwright";
20
- FlakinessReport22.CATEGORY_PYTEST = "pytest";
21
- FlakinessReport22.CATEGORY_JUNIT = "junit";
22
- FlakinessReport22.STREAM_STDOUT = 1;
23
- FlakinessReport22.STREAM_STDERR = 2;
24
- })(FlakinessReport || (FlakinessReport = {}));
25
-
26
- // node_modules/.pnpm/@flakiness+flakiness-report@0.28.0_zod@4.3.5/node_modules/@flakiness/flakiness-report/lib/schema.js
27
- import z from "zod/v4";
28
- var Schema;
29
- ((Schema2) => {
30
- Schema2.CommitId = z.string().min(40).max(40);
31
- Schema2.AttachmentId = z.string().min(1).max(1024);
32
- Schema2.UnixTimestampMS = z.number().min(0);
33
- Schema2.DurationMS = z.number().min(0);
34
- Schema2.Number1Based = z.number();
35
- Schema2.GitFilePath = z.string().min(0);
36
- Schema2.Location = z.object({
37
- file: Schema2.GitFilePath,
38
- line: Schema2.Number1Based,
39
- // Note: Locations for file suites are (0, 0).
40
- column: Schema2.Number1Based
41
- });
42
- Schema2.TestStatus = z.enum(["passed", "failed", "timedOut", "skipped", "interrupted"]);
43
- Schema2.Environment = z.object({
44
- name: z.string().min(1).max(512),
45
- systemData: z.object({
46
- osName: z.string().optional(),
47
- osVersion: z.string().optional(),
48
- osArch: z.string().optional()
49
- }).optional(),
50
- metadata: z.any().optional(),
51
- userSuppliedData: z.any().optional()
52
- });
53
- Schema2.STDIOEntry = z.union([
54
- z.object({ text: z.string() }),
55
- z.object({ buffer: z.string() })
56
- ]);
57
- Schema2.STREAM_STDOUT = z.literal(FlakinessReport.STREAM_STDOUT);
58
- Schema2.STREAM_STDERR = z.literal(FlakinessReport.STREAM_STDERR);
59
- Schema2.TimedSTDIOEntry = z.object({
60
- stream: z.union([Schema2.STREAM_STDOUT, Schema2.STREAM_STDERR]).optional(),
61
- dts: Schema2.DurationMS
62
- }).and(z.union([
63
- z.object({ text: z.string() }),
64
- z.object({ buffer: z.string() })
65
- ]));
66
- Schema2.ReportError = z.object({
67
- location: Schema2.Location.optional(),
68
- message: z.string().optional(),
69
- stack: z.string().optional(),
70
- snippet: z.string().optional(),
71
- value: z.string().optional()
72
- });
73
- Schema2.SuiteType = z.enum(["file", "anonymous suite", "suite"]);
74
- Schema2.TestStep = z.object({
75
- title: z.string(),
76
- duration: Schema2.DurationMS.optional(),
77
- location: Schema2.Location.optional(),
78
- snippet: z.string().optional(),
79
- error: Schema2.ReportError.optional(),
80
- get steps() {
81
- return z.array(Schema2.TestStep).optional();
82
- }
83
- });
84
- Schema2.Attachment = z.object({
85
- name: z.string(),
86
- contentType: z.string(),
87
- id: Schema2.AttachmentId
88
- });
89
- Schema2.Annotation = z.object({
90
- type: z.string(),
91
- description: z.string().optional(),
92
- location: Schema2.Location.optional()
93
- });
94
- Schema2.RunAttempt = z.object({
95
- // Index of the environment in the environments array (must be >= 0).
96
- environmentIdx: z.number().min(0).optional(),
97
- expectedStatus: Schema2.TestStatus.optional(),
98
- status: Schema2.TestStatus.optional(),
99
- startTimestamp: Schema2.UnixTimestampMS,
100
- duration: Schema2.DurationMS.optional(),
101
- timeout: Schema2.DurationMS.optional(),
102
- annotations: z.array(Schema2.Annotation).optional(),
103
- errors: z.array(Schema2.ReportError).optional(),
104
- parallelIndex: z.number().optional(),
105
- steps: z.array(Schema2.TestStep).optional(),
106
- stdio: z.array(Schema2.TimedSTDIOEntry).optional(),
107
- stdout: z.array(Schema2.STDIOEntry).optional(),
108
- stderr: z.array(Schema2.STDIOEntry).optional(),
109
- attachments: z.array(Schema2.Attachment).optional()
110
- });
111
- Schema2.Suite = z.object({
112
- type: Schema2.SuiteType,
113
- title: z.string(),
114
- location: Schema2.Location.optional(),
115
- get suites() {
116
- return z.array(Schema2.Suite).optional();
117
- },
118
- get tests() {
119
- return z.array(Schema2.Test).optional();
120
- }
121
- });
122
- Schema2.Test = z.object({
123
- title: z.string(),
124
- location: Schema2.Location.optional(),
125
- tags: z.array(z.string()).optional(),
126
- attempts: z.array(Schema2.RunAttempt)
127
- });
128
- Schema2.SystemUtilizationSample = z.object({
129
- dts: Schema2.DurationMS,
130
- // Must be between 0 and 100 (inclusive). Can be a rational number.
131
- cpuUtilization: z.number().min(0).max(100),
132
- // Must be between 0 and 100 (inclusive). Can be a rational number.
133
- memoryUtilization: z.number().min(0).max(100)
134
- });
135
- Schema2.SystemUtilization = z.object({
136
- totalMemoryBytes: z.number().min(0),
137
- startTimestamp: Schema2.UnixTimestampMS,
138
- samples: z.array(Schema2.SystemUtilizationSample)
139
- });
140
- Schema2.UtilizationTelemetry = z.tuple([Schema2.DurationMS, z.number().min(0).max(100)]);
141
- Schema2.Source = z.object({
142
- filePath: Schema2.GitFilePath,
143
- text: z.string(),
144
- lineOffset: z.number().optional(),
145
- contentType: z.string().optional()
146
- });
147
- Schema2.FlakinessProject = z.string();
148
- Schema2.Report = z.object({
149
- sources: z.array(Schema2.Source).optional(),
150
- flakinessProject: Schema2.FlakinessProject.optional(),
151
- category: z.string().min(1).max(100),
152
- commitId: Schema2.CommitId,
153
- relatedCommitIds: z.array(Schema2.CommitId).optional(),
154
- configPath: Schema2.GitFilePath.optional(),
155
- url: z.string().optional(),
156
- environments: z.array(Schema2.Environment).min(1),
157
- suites: z.array(Schema2.Suite).optional(),
158
- tests: z.array(Schema2.Test).optional(),
159
- unattributedErrors: z.array(Schema2.ReportError).optional(),
160
- startTimestamp: Schema2.UnixTimestampMS,
161
- duration: Schema2.DurationMS,
162
- systemUtilization: z.optional(Schema2.SystemUtilization),
163
- cpuCount: z.number().min(0).optional(),
164
- cpuAvg: z.array(Schema2.UtilizationTelemetry).optional(),
165
- cpuMax: z.array(Schema2.UtilizationTelemetry).optional(),
166
- ram: z.array(Schema2.UtilizationTelemetry).optional(),
167
- ramBytes: z.number().min(0).optional()
168
- });
169
- })(Schema || (Schema = {}));
170
-
171
16
  // src/normalizeReport.ts
17
+ import { FlakinessReport } from "@flakiness/flakiness-report";
172
18
  import stableObjectHash from "stable-hash";
173
19
  var Multimap = class {
174
20
  _map = /* @__PURE__ */ new Map();
@@ -327,7 +173,8 @@ function computeTestId(test, suiteId) {
327
173
  }
328
174
 
329
175
  // src/validateReport.ts
330
- import z2 from "zod/v4";
176
+ import { Schema } from "@flakiness/flakiness-report";
177
+ import z from "zod/v4";
331
178
  function validateReport(report) {
332
179
  const validation = Schema.Report.safeParse(report);
333
180
  if (!validation.success) {
@@ -335,7 +182,7 @@ function validateReport(report) {
335
182
  const allIssues = validation.error.issues;
336
183
  const shownIssues = allIssues.slice(0, MAX_ISSUES);
337
184
  const remaining = allIssues.length - shownIssues.length;
338
- const base = [z2.prettifyError(new z2.ZodError(shownIssues))];
185
+ const base = [z.prettifyError(new z.ZodError(shownIssues))];
339
186
  if (remaining > 0)
340
187
  base.push(`... and ${remaining} more issue${remaining === 1 ? "" : "s"} ...`);
341
188
  return base.join("\n");
package/lib/index.js CHANGED
@@ -679,162 +679,8 @@ function createEnvironment(options) {
679
679
  };
680
680
  }
681
681
 
682
- // node_modules/.pnpm/@flakiness+flakiness-report@0.28.0_zod@4.3.5/node_modules/@flakiness/flakiness-report/lib/flakinessReport.js
683
- var FlakinessReport;
684
- ((FlakinessReport22) => {
685
- FlakinessReport22.CATEGORY_PLAYWRIGHT = "playwright";
686
- FlakinessReport22.CATEGORY_PYTEST = "pytest";
687
- FlakinessReport22.CATEGORY_JUNIT = "junit";
688
- FlakinessReport22.STREAM_STDOUT = 1;
689
- FlakinessReport22.STREAM_STDERR = 2;
690
- })(FlakinessReport || (FlakinessReport = {}));
691
-
692
- // node_modules/.pnpm/@flakiness+flakiness-report@0.28.0_zod@4.3.5/node_modules/@flakiness/flakiness-report/lib/schema.js
693
- import z from "zod/v4";
694
- var Schema;
695
- ((Schema2) => {
696
- Schema2.CommitId = z.string().min(40).max(40);
697
- Schema2.AttachmentId = z.string().min(1).max(1024);
698
- Schema2.UnixTimestampMS = z.number().min(0);
699
- Schema2.DurationMS = z.number().min(0);
700
- Schema2.Number1Based = z.number();
701
- Schema2.GitFilePath = z.string().min(0);
702
- Schema2.Location = z.object({
703
- file: Schema2.GitFilePath,
704
- line: Schema2.Number1Based,
705
- // Note: Locations for file suites are (0, 0).
706
- column: Schema2.Number1Based
707
- });
708
- Schema2.TestStatus = z.enum(["passed", "failed", "timedOut", "skipped", "interrupted"]);
709
- Schema2.Environment = z.object({
710
- name: z.string().min(1).max(512),
711
- systemData: z.object({
712
- osName: z.string().optional(),
713
- osVersion: z.string().optional(),
714
- osArch: z.string().optional()
715
- }).optional(),
716
- metadata: z.any().optional(),
717
- userSuppliedData: z.any().optional()
718
- });
719
- Schema2.STDIOEntry = z.union([
720
- z.object({ text: z.string() }),
721
- z.object({ buffer: z.string() })
722
- ]);
723
- Schema2.STREAM_STDOUT = z.literal(FlakinessReport.STREAM_STDOUT);
724
- Schema2.STREAM_STDERR = z.literal(FlakinessReport.STREAM_STDERR);
725
- Schema2.TimedSTDIOEntry = z.object({
726
- stream: z.union([Schema2.STREAM_STDOUT, Schema2.STREAM_STDERR]).optional(),
727
- dts: Schema2.DurationMS
728
- }).and(z.union([
729
- z.object({ text: z.string() }),
730
- z.object({ buffer: z.string() })
731
- ]));
732
- Schema2.ReportError = z.object({
733
- location: Schema2.Location.optional(),
734
- message: z.string().optional(),
735
- stack: z.string().optional(),
736
- snippet: z.string().optional(),
737
- value: z.string().optional()
738
- });
739
- Schema2.SuiteType = z.enum(["file", "anonymous suite", "suite"]);
740
- Schema2.TestStep = z.object({
741
- title: z.string(),
742
- duration: Schema2.DurationMS.optional(),
743
- location: Schema2.Location.optional(),
744
- snippet: z.string().optional(),
745
- error: Schema2.ReportError.optional(),
746
- get steps() {
747
- return z.array(Schema2.TestStep).optional();
748
- }
749
- });
750
- Schema2.Attachment = z.object({
751
- name: z.string(),
752
- contentType: z.string(),
753
- id: Schema2.AttachmentId
754
- });
755
- Schema2.Annotation = z.object({
756
- type: z.string(),
757
- description: z.string().optional(),
758
- location: Schema2.Location.optional()
759
- });
760
- Schema2.RunAttempt = z.object({
761
- // Index of the environment in the environments array (must be >= 0).
762
- environmentIdx: z.number().min(0).optional(),
763
- expectedStatus: Schema2.TestStatus.optional(),
764
- status: Schema2.TestStatus.optional(),
765
- startTimestamp: Schema2.UnixTimestampMS,
766
- duration: Schema2.DurationMS.optional(),
767
- timeout: Schema2.DurationMS.optional(),
768
- annotations: z.array(Schema2.Annotation).optional(),
769
- errors: z.array(Schema2.ReportError).optional(),
770
- parallelIndex: z.number().optional(),
771
- steps: z.array(Schema2.TestStep).optional(),
772
- stdio: z.array(Schema2.TimedSTDIOEntry).optional(),
773
- stdout: z.array(Schema2.STDIOEntry).optional(),
774
- stderr: z.array(Schema2.STDIOEntry).optional(),
775
- attachments: z.array(Schema2.Attachment).optional()
776
- });
777
- Schema2.Suite = z.object({
778
- type: Schema2.SuiteType,
779
- title: z.string(),
780
- location: Schema2.Location.optional(),
781
- get suites() {
782
- return z.array(Schema2.Suite).optional();
783
- },
784
- get tests() {
785
- return z.array(Schema2.Test).optional();
786
- }
787
- });
788
- Schema2.Test = z.object({
789
- title: z.string(),
790
- location: Schema2.Location.optional(),
791
- tags: z.array(z.string()).optional(),
792
- attempts: z.array(Schema2.RunAttempt)
793
- });
794
- Schema2.SystemUtilizationSample = z.object({
795
- dts: Schema2.DurationMS,
796
- // Must be between 0 and 100 (inclusive). Can be a rational number.
797
- cpuUtilization: z.number().min(0).max(100),
798
- // Must be between 0 and 100 (inclusive). Can be a rational number.
799
- memoryUtilization: z.number().min(0).max(100)
800
- });
801
- Schema2.SystemUtilization = z.object({
802
- totalMemoryBytes: z.number().min(0),
803
- startTimestamp: Schema2.UnixTimestampMS,
804
- samples: z.array(Schema2.SystemUtilizationSample)
805
- });
806
- Schema2.UtilizationTelemetry = z.tuple([Schema2.DurationMS, z.number().min(0).max(100)]);
807
- Schema2.Source = z.object({
808
- filePath: Schema2.GitFilePath,
809
- text: z.string(),
810
- lineOffset: z.number().optional(),
811
- contentType: z.string().optional()
812
- });
813
- Schema2.FlakinessProject = z.string();
814
- Schema2.Report = z.object({
815
- sources: z.array(Schema2.Source).optional(),
816
- flakinessProject: Schema2.FlakinessProject.optional(),
817
- category: z.string().min(1).max(100),
818
- commitId: Schema2.CommitId,
819
- relatedCommitIds: z.array(Schema2.CommitId).optional(),
820
- configPath: Schema2.GitFilePath.optional(),
821
- url: z.string().optional(),
822
- environments: z.array(Schema2.Environment).min(1),
823
- suites: z.array(Schema2.Suite).optional(),
824
- tests: z.array(Schema2.Test).optional(),
825
- unattributedErrors: z.array(Schema2.ReportError).optional(),
826
- startTimestamp: Schema2.UnixTimestampMS,
827
- duration: Schema2.DurationMS,
828
- systemUtilization: z.optional(Schema2.SystemUtilization),
829
- cpuCount: z.number().min(0).optional(),
830
- cpuAvg: z.array(Schema2.UtilizationTelemetry).optional(),
831
- cpuMax: z.array(Schema2.UtilizationTelemetry).optional(),
832
- ram: z.array(Schema2.UtilizationTelemetry).optional(),
833
- ramBytes: z.number().min(0).optional()
834
- });
835
- })(Schema || (Schema = {}));
836
-
837
682
  // src/normalizeReport.ts
683
+ import { FlakinessReport } from "@flakiness/flakiness-report";
838
684
  import stableObjectHash from "stable-hash";
839
685
  var Multimap = class {
840
686
  _map = /* @__PURE__ */ new Map();
@@ -993,7 +839,8 @@ function computeTestId(test, suiteId) {
993
839
  }
994
840
 
995
841
  // src/validateReport.ts
996
- import z2 from "zod/v4";
842
+ import { Schema } from "@flakiness/flakiness-report";
843
+ import z from "zod/v4";
997
844
  function validateReport(report) {
998
845
  const validation = Schema.Report.safeParse(report);
999
846
  if (!validation.success) {
@@ -1001,7 +848,7 @@ function validateReport(report) {
1001
848
  const allIssues = validation.error.issues;
1002
849
  const shownIssues = allIssues.slice(0, MAX_ISSUES);
1003
850
  const remaining = allIssues.length - shownIssues.length;
1004
- const base = [z2.prettifyError(new z2.ZodError(shownIssues))];
851
+ const base = [z.prettifyError(new z.ZodError(shownIssues))];
1005
852
  if (remaining > 0)
1006
853
  base.push(`... and ${remaining} more issue${remaining === 1 ? "" : "s"} ...`);
1007
854
  return base.join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flakiness/sdk",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "author": "Degu Labs, Inc",
26
26
  "license": "MIT",
27
27
  "engines": {
28
- "node": ">=22"
28
+ "node": "^20.17.0 || >=22.9.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@flakiness/flakiness-report": "^0.28.0",
@@ -11,9 +11,7 @@
11
11
  *
12
12
  * @example
13
13
  * ```typescript
14
- * import { styleText } from 'node:util';
15
- *
16
- * const clean = stripAnsi(styleText('red', 'Error: test failed'));
14
+ * const clean = stripAnsi('\u001B[31mError: test failed\u001B[39m');
17
15
  * // Returns: 'Error: test failed' (without color codes)
18
16
  * ```
19
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"stripAnsi.d.ts","sourceRoot":"","sources":["../../src/stripAnsi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
1
+ {"version":3,"file":"stripAnsi.d.ts","sourceRoot":"","sources":["../../src/stripAnsi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}