@flakiness/sdk 0.155.0 → 1.0.1
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 +6 -10
- package/lib/browser.js +134 -135
- package/lib/index.js +2 -2
- package/package.json +6 -6
- package/types/src/browser.d.ts +0 -1
- package/types/src/browser.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ The Flakiness SDK provides a comprehensive set of tools for creating and managin
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm i @flakiness/sdk
|
|
8
|
+
npm i @flakiness/sdk @flakiness/flakiness-report
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
@@ -13,11 +13,11 @@ npm i @flakiness/sdk
|
|
|
13
13
|
Here's a minimal example of creating a Flakiness JSON Report:
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
GitWorktree,
|
|
19
|
-
ReportUtils,
|
|
20
|
-
writeReport,
|
|
16
|
+
import { FlakinessReport } from '@flakiness/flakiness-report';
|
|
17
|
+
import {
|
|
18
|
+
GitWorktree,
|
|
19
|
+
ReportUtils,
|
|
20
|
+
writeReport,
|
|
21
21
|
uploadReport,
|
|
22
22
|
CIUtils
|
|
23
23
|
} from '@flakiness/sdk';
|
|
@@ -71,16 +71,12 @@ The main entry point for Node.js environments. Provides full access to all SDK f
|
|
|
71
71
|
### `@flakiness/sdk/browser`
|
|
72
72
|
|
|
73
73
|
A browser-compatible entry point with a subset of utilities that work in browser environments. Exports:
|
|
74
|
-
- `FlakinessReport` - Type definitions for the report format
|
|
75
74
|
- `ReportUtils` - Browser-safe utilities (normalizeReport, stripAnsi, visitTests)
|
|
76
75
|
|
|
77
76
|
Use this entry point when you need to process or manipulate reports in browser-based tools or web applications.
|
|
78
77
|
|
|
79
78
|
## Top-Level Exports
|
|
80
79
|
|
|
81
|
-
### Report Type & Validation
|
|
82
|
-
- **`FlakinessReport`** - Type definitions and validation for the [Flakiness JSON Report](https://github.com/flakiness/flakiness-report) format
|
|
83
|
-
|
|
84
80
|
### Building Reports
|
|
85
81
|
- **`CIUtils`** - Utilities to extract CI/CD information (run URLs, environment detection)
|
|
86
82
|
- **`GitWorktree`** - Git repository utilities for path conversion and commit information
|
package/lib/browser.js
CHANGED
|
@@ -4,140 +4,6 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// node_modules/@flakiness/flakiness-report/lib/flakinessReport.js
|
|
8
|
-
var FlakinessReport;
|
|
9
|
-
((FlakinessReport22) => {
|
|
10
|
-
FlakinessReport22.CATEGORY_PLAYWRIGHT = "playwright";
|
|
11
|
-
FlakinessReport22.CATEGORY_PYTEST = "pytest";
|
|
12
|
-
FlakinessReport22.CATEGORY_JUNIT = "junit";
|
|
13
|
-
})(FlakinessReport || (FlakinessReport = {}));
|
|
14
|
-
|
|
15
|
-
// node_modules/@flakiness/flakiness-report/lib/schema.js
|
|
16
|
-
import z from "zod/v4";
|
|
17
|
-
var Schema;
|
|
18
|
-
((Schema2) => {
|
|
19
|
-
Schema2.CommitId = z.string().min(40).max(40);
|
|
20
|
-
Schema2.AttachmentId = z.string().min(1).max(1024);
|
|
21
|
-
Schema2.UnixTimestampMS = z.number().min(0);
|
|
22
|
-
Schema2.DurationMS = z.number().min(0);
|
|
23
|
-
Schema2.Number1Based = z.number();
|
|
24
|
-
Schema2.GitFilePath = z.string().min(0);
|
|
25
|
-
Schema2.Location = z.object({
|
|
26
|
-
file: Schema2.GitFilePath,
|
|
27
|
-
line: Schema2.Number1Based,
|
|
28
|
-
// Note: Locations for file suites are (0, 0).
|
|
29
|
-
column: Schema2.Number1Based
|
|
30
|
-
});
|
|
31
|
-
Schema2.TestStatus = z.enum(["passed", "failed", "timedOut", "skipped", "interrupted"]);
|
|
32
|
-
Schema2.Environment = z.object({
|
|
33
|
-
name: z.string().min(1).max(512),
|
|
34
|
-
systemData: z.object({
|
|
35
|
-
osName: z.string().optional(),
|
|
36
|
-
osVersion: z.string().optional(),
|
|
37
|
-
osArch: z.string().optional()
|
|
38
|
-
}).optional(),
|
|
39
|
-
metadata: z.any().optional(),
|
|
40
|
-
userSuppliedData: z.any().optional()
|
|
41
|
-
});
|
|
42
|
-
Schema2.STDIOEntry = z.union([
|
|
43
|
-
z.object({ text: z.string() }),
|
|
44
|
-
z.object({ buffer: z.string() })
|
|
45
|
-
]);
|
|
46
|
-
Schema2.ReportError = z.object({
|
|
47
|
-
location: Schema2.Location.optional(),
|
|
48
|
-
message: z.string().optional(),
|
|
49
|
-
stack: z.string().optional(),
|
|
50
|
-
snippet: z.string().optional(),
|
|
51
|
-
value: z.string().optional()
|
|
52
|
-
});
|
|
53
|
-
Schema2.SuiteType = z.enum(["file", "anonymous suite", "suite"]);
|
|
54
|
-
Schema2.TestStep = z.object({
|
|
55
|
-
title: z.string(),
|
|
56
|
-
duration: Schema2.DurationMS.optional(),
|
|
57
|
-
location: Schema2.Location.optional(),
|
|
58
|
-
snippet: z.string().optional(),
|
|
59
|
-
error: Schema2.ReportError.optional(),
|
|
60
|
-
get steps() {
|
|
61
|
-
return z.array(Schema2.TestStep).optional();
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
Schema2.Attachment = z.object({
|
|
65
|
-
name: z.string(),
|
|
66
|
-
contentType: z.string(),
|
|
67
|
-
id: Schema2.AttachmentId
|
|
68
|
-
});
|
|
69
|
-
Schema2.Annotation = z.object({
|
|
70
|
-
type: z.string(),
|
|
71
|
-
description: z.string().optional(),
|
|
72
|
-
location: Schema2.Location.optional()
|
|
73
|
-
});
|
|
74
|
-
Schema2.RunAttempt = z.object({
|
|
75
|
-
// Index of the environment in the environments array (must be >= 0).
|
|
76
|
-
environmentIdx: z.number().min(0).optional(),
|
|
77
|
-
expectedStatus: Schema2.TestStatus.optional(),
|
|
78
|
-
status: Schema2.TestStatus.optional(),
|
|
79
|
-
startTimestamp: Schema2.UnixTimestampMS,
|
|
80
|
-
duration: Schema2.DurationMS.optional(),
|
|
81
|
-
timeout: Schema2.DurationMS.optional(),
|
|
82
|
-
annotations: z.array(Schema2.Annotation).optional(),
|
|
83
|
-
errors: z.array(Schema2.ReportError).optional(),
|
|
84
|
-
parallelIndex: z.number().optional(),
|
|
85
|
-
steps: z.array(Schema2.TestStep).optional(),
|
|
86
|
-
stdout: z.array(Schema2.STDIOEntry).optional(),
|
|
87
|
-
stderr: z.array(Schema2.STDIOEntry).optional(),
|
|
88
|
-
attachments: z.array(Schema2.Attachment).optional()
|
|
89
|
-
});
|
|
90
|
-
Schema2.Suite = z.object({
|
|
91
|
-
type: Schema2.SuiteType,
|
|
92
|
-
title: z.string(),
|
|
93
|
-
location: Schema2.Location.optional(),
|
|
94
|
-
get suites() {
|
|
95
|
-
return z.array(Schema2.Suite).optional();
|
|
96
|
-
},
|
|
97
|
-
get tests() {
|
|
98
|
-
return z.array(Schema2.Test).optional();
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
Schema2.Test = z.object({
|
|
102
|
-
title: z.string(),
|
|
103
|
-
location: Schema2.Location.optional(),
|
|
104
|
-
tags: z.array(z.string()).optional(),
|
|
105
|
-
attempts: z.array(Schema2.RunAttempt)
|
|
106
|
-
});
|
|
107
|
-
Schema2.SystemUtilizationSample = z.object({
|
|
108
|
-
dts: Schema2.DurationMS,
|
|
109
|
-
// Must be between 0 and 100 (inclusive). Can be a rational number.
|
|
110
|
-
cpuUtilization: z.number().min(0).max(100),
|
|
111
|
-
// Must be between 0 and 100 (inclusive). Can be a rational number.
|
|
112
|
-
memoryUtilization: z.number().min(0).max(100)
|
|
113
|
-
});
|
|
114
|
-
Schema2.SystemUtilization = z.object({
|
|
115
|
-
totalMemoryBytes: z.number().min(0),
|
|
116
|
-
startTimestamp: Schema2.UnixTimestampMS,
|
|
117
|
-
samples: z.array(Schema2.SystemUtilizationSample)
|
|
118
|
-
});
|
|
119
|
-
Schema2.UtilizationTelemetry = z.tuple([Schema2.DurationMS, z.number().min(0).max(100)]);
|
|
120
|
-
Schema2.Report = z.object({
|
|
121
|
-
category: z.string().min(1).max(100),
|
|
122
|
-
commitId: Schema2.CommitId,
|
|
123
|
-
relatedCommitIds: z.array(Schema2.CommitId).optional(),
|
|
124
|
-
configPath: Schema2.GitFilePath.optional(),
|
|
125
|
-
url: z.string().optional(),
|
|
126
|
-
environments: z.array(Schema2.Environment).min(1),
|
|
127
|
-
suites: z.array(Schema2.Suite).optional(),
|
|
128
|
-
tests: z.array(Schema2.Test).optional(),
|
|
129
|
-
unattributedErrors: z.array(Schema2.ReportError).optional(),
|
|
130
|
-
startTimestamp: Schema2.UnixTimestampMS,
|
|
131
|
-
duration: Schema2.DurationMS,
|
|
132
|
-
systemUtilization: z.optional(Schema2.SystemUtilization),
|
|
133
|
-
cpuCount: z.number().min(0).optional(),
|
|
134
|
-
cpuAvg: z.array(Schema2.UtilizationTelemetry).optional(),
|
|
135
|
-
cpuMax: z.array(Schema2.UtilizationTelemetry).optional(),
|
|
136
|
-
ram: z.array(Schema2.UtilizationTelemetry).optional(),
|
|
137
|
-
ramBytes: z.number().min(0).optional()
|
|
138
|
-
});
|
|
139
|
-
})(Schema || (Schema = {}));
|
|
140
|
-
|
|
141
7
|
// src/reportUtilsBrowser.ts
|
|
142
8
|
var reportUtilsBrowser_exports = {};
|
|
143
9
|
__export(reportUtilsBrowser_exports, {
|
|
@@ -305,6 +171,140 @@ function computeTestId(test, suiteId) {
|
|
|
305
171
|
});
|
|
306
172
|
}
|
|
307
173
|
|
|
174
|
+
// node_modules/.pnpm/@flakiness+flakiness-report@0.22.0/node_modules/@flakiness/flakiness-report/lib/flakinessReport.js
|
|
175
|
+
var FlakinessReport;
|
|
176
|
+
((FlakinessReport22) => {
|
|
177
|
+
FlakinessReport22.CATEGORY_PLAYWRIGHT = "playwright";
|
|
178
|
+
FlakinessReport22.CATEGORY_PYTEST = "pytest";
|
|
179
|
+
FlakinessReport22.CATEGORY_JUNIT = "junit";
|
|
180
|
+
})(FlakinessReport || (FlakinessReport = {}));
|
|
181
|
+
|
|
182
|
+
// node_modules/.pnpm/@flakiness+flakiness-report@0.22.0/node_modules/@flakiness/flakiness-report/lib/schema.js
|
|
183
|
+
import z from "zod/v4";
|
|
184
|
+
var Schema;
|
|
185
|
+
((Schema2) => {
|
|
186
|
+
Schema2.CommitId = z.string().min(40).max(40);
|
|
187
|
+
Schema2.AttachmentId = z.string().min(1).max(1024);
|
|
188
|
+
Schema2.UnixTimestampMS = z.number().min(0);
|
|
189
|
+
Schema2.DurationMS = z.number().min(0);
|
|
190
|
+
Schema2.Number1Based = z.number();
|
|
191
|
+
Schema2.GitFilePath = z.string().min(0);
|
|
192
|
+
Schema2.Location = z.object({
|
|
193
|
+
file: Schema2.GitFilePath,
|
|
194
|
+
line: Schema2.Number1Based,
|
|
195
|
+
// Note: Locations for file suites are (0, 0).
|
|
196
|
+
column: Schema2.Number1Based
|
|
197
|
+
});
|
|
198
|
+
Schema2.TestStatus = z.enum(["passed", "failed", "timedOut", "skipped", "interrupted"]);
|
|
199
|
+
Schema2.Environment = z.object({
|
|
200
|
+
name: z.string().min(1).max(512),
|
|
201
|
+
systemData: z.object({
|
|
202
|
+
osName: z.string().optional(),
|
|
203
|
+
osVersion: z.string().optional(),
|
|
204
|
+
osArch: z.string().optional()
|
|
205
|
+
}).optional(),
|
|
206
|
+
metadata: z.any().optional(),
|
|
207
|
+
userSuppliedData: z.any().optional()
|
|
208
|
+
});
|
|
209
|
+
Schema2.STDIOEntry = z.union([
|
|
210
|
+
z.object({ text: z.string() }),
|
|
211
|
+
z.object({ buffer: z.string() })
|
|
212
|
+
]);
|
|
213
|
+
Schema2.ReportError = z.object({
|
|
214
|
+
location: Schema2.Location.optional(),
|
|
215
|
+
message: z.string().optional(),
|
|
216
|
+
stack: z.string().optional(),
|
|
217
|
+
snippet: z.string().optional(),
|
|
218
|
+
value: z.string().optional()
|
|
219
|
+
});
|
|
220
|
+
Schema2.SuiteType = z.enum(["file", "anonymous suite", "suite"]);
|
|
221
|
+
Schema2.TestStep = z.object({
|
|
222
|
+
title: z.string(),
|
|
223
|
+
duration: Schema2.DurationMS.optional(),
|
|
224
|
+
location: Schema2.Location.optional(),
|
|
225
|
+
snippet: z.string().optional(),
|
|
226
|
+
error: Schema2.ReportError.optional(),
|
|
227
|
+
get steps() {
|
|
228
|
+
return z.array(Schema2.TestStep).optional();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
Schema2.Attachment = z.object({
|
|
232
|
+
name: z.string(),
|
|
233
|
+
contentType: z.string(),
|
|
234
|
+
id: Schema2.AttachmentId
|
|
235
|
+
});
|
|
236
|
+
Schema2.Annotation = z.object({
|
|
237
|
+
type: z.string(),
|
|
238
|
+
description: z.string().optional(),
|
|
239
|
+
location: Schema2.Location.optional()
|
|
240
|
+
});
|
|
241
|
+
Schema2.RunAttempt = z.object({
|
|
242
|
+
// Index of the environment in the environments array (must be >= 0).
|
|
243
|
+
environmentIdx: z.number().min(0).optional(),
|
|
244
|
+
expectedStatus: Schema2.TestStatus.optional(),
|
|
245
|
+
status: Schema2.TestStatus.optional(),
|
|
246
|
+
startTimestamp: Schema2.UnixTimestampMS,
|
|
247
|
+
duration: Schema2.DurationMS.optional(),
|
|
248
|
+
timeout: Schema2.DurationMS.optional(),
|
|
249
|
+
annotations: z.array(Schema2.Annotation).optional(),
|
|
250
|
+
errors: z.array(Schema2.ReportError).optional(),
|
|
251
|
+
parallelIndex: z.number().optional(),
|
|
252
|
+
steps: z.array(Schema2.TestStep).optional(),
|
|
253
|
+
stdout: z.array(Schema2.STDIOEntry).optional(),
|
|
254
|
+
stderr: z.array(Schema2.STDIOEntry).optional(),
|
|
255
|
+
attachments: z.array(Schema2.Attachment).optional()
|
|
256
|
+
});
|
|
257
|
+
Schema2.Suite = z.object({
|
|
258
|
+
type: Schema2.SuiteType,
|
|
259
|
+
title: z.string(),
|
|
260
|
+
location: Schema2.Location.optional(),
|
|
261
|
+
get suites() {
|
|
262
|
+
return z.array(Schema2.Suite).optional();
|
|
263
|
+
},
|
|
264
|
+
get tests() {
|
|
265
|
+
return z.array(Schema2.Test).optional();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
Schema2.Test = z.object({
|
|
269
|
+
title: z.string(),
|
|
270
|
+
location: Schema2.Location.optional(),
|
|
271
|
+
tags: z.array(z.string()).optional(),
|
|
272
|
+
attempts: z.array(Schema2.RunAttempt)
|
|
273
|
+
});
|
|
274
|
+
Schema2.SystemUtilizationSample = z.object({
|
|
275
|
+
dts: Schema2.DurationMS,
|
|
276
|
+
// Must be between 0 and 100 (inclusive). Can be a rational number.
|
|
277
|
+
cpuUtilization: z.number().min(0).max(100),
|
|
278
|
+
// Must be between 0 and 100 (inclusive). Can be a rational number.
|
|
279
|
+
memoryUtilization: z.number().min(0).max(100)
|
|
280
|
+
});
|
|
281
|
+
Schema2.SystemUtilization = z.object({
|
|
282
|
+
totalMemoryBytes: z.number().min(0),
|
|
283
|
+
startTimestamp: Schema2.UnixTimestampMS,
|
|
284
|
+
samples: z.array(Schema2.SystemUtilizationSample)
|
|
285
|
+
});
|
|
286
|
+
Schema2.UtilizationTelemetry = z.tuple([Schema2.DurationMS, z.number().min(0).max(100)]);
|
|
287
|
+
Schema2.Report = z.object({
|
|
288
|
+
category: z.string().min(1).max(100),
|
|
289
|
+
commitId: Schema2.CommitId,
|
|
290
|
+
relatedCommitIds: z.array(Schema2.CommitId).optional(),
|
|
291
|
+
configPath: Schema2.GitFilePath.optional(),
|
|
292
|
+
url: z.string().optional(),
|
|
293
|
+
environments: z.array(Schema2.Environment).min(1),
|
|
294
|
+
suites: z.array(Schema2.Suite).optional(),
|
|
295
|
+
tests: z.array(Schema2.Test).optional(),
|
|
296
|
+
unattributedErrors: z.array(Schema2.ReportError).optional(),
|
|
297
|
+
startTimestamp: Schema2.UnixTimestampMS,
|
|
298
|
+
duration: Schema2.DurationMS,
|
|
299
|
+
systemUtilization: z.optional(Schema2.SystemUtilization),
|
|
300
|
+
cpuCount: z.number().min(0).optional(),
|
|
301
|
+
cpuAvg: z.array(Schema2.UtilizationTelemetry).optional(),
|
|
302
|
+
cpuMax: z.array(Schema2.UtilizationTelemetry).optional(),
|
|
303
|
+
ram: z.array(Schema2.UtilizationTelemetry).optional(),
|
|
304
|
+
ramBytes: z.number().min(0).optional()
|
|
305
|
+
});
|
|
306
|
+
})(Schema || (Schema = {}));
|
|
307
|
+
|
|
308
308
|
// src/validateReport.ts
|
|
309
309
|
import z2 from "zod/v4";
|
|
310
310
|
function validateReport(report) {
|
|
@@ -344,7 +344,6 @@ function visitTests(report, testVisitor) {
|
|
|
344
344
|
visitSuite(suite, []);
|
|
345
345
|
}
|
|
346
346
|
export {
|
|
347
|
-
FlakinessReport,
|
|
348
347
|
reportUtilsBrowser_exports as ReportUtils
|
|
349
348
|
};
|
|
350
349
|
//# sourceMappingURL=browser.js.map
|
package/lib/index.js
CHANGED
|
@@ -775,7 +775,7 @@ function computeTestId(test, suiteId) {
|
|
|
775
775
|
});
|
|
776
776
|
}
|
|
777
777
|
|
|
778
|
-
// node_modules/@flakiness/flakiness-report/lib/flakinessReport.js
|
|
778
|
+
// node_modules/.pnpm/@flakiness+flakiness-report@0.22.0/node_modules/@flakiness/flakiness-report/lib/flakinessReport.js
|
|
779
779
|
var FlakinessReport;
|
|
780
780
|
((FlakinessReport22) => {
|
|
781
781
|
FlakinessReport22.CATEGORY_PLAYWRIGHT = "playwright";
|
|
@@ -783,7 +783,7 @@ var FlakinessReport;
|
|
|
783
783
|
FlakinessReport22.CATEGORY_JUNIT = "junit";
|
|
784
784
|
})(FlakinessReport || (FlakinessReport = {}));
|
|
785
785
|
|
|
786
|
-
// node_modules/@flakiness/flakiness-report/lib/schema.js
|
|
786
|
+
// node_modules/.pnpm/@flakiness+flakiness-report@0.22.0/node_modules/@flakiness/flakiness-report/lib/schema.js
|
|
787
787
|
import z from "zod/v4";
|
|
788
788
|
var Schema;
|
|
789
789
|
((Schema2) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flakiness/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,10 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"description": "Comprehensive SDK for creating and managing Flakiness JSON Reports in Node.js",
|
|
23
23
|
"types": "./types/index.d.ts",
|
|
24
|
-
"scripts": {
|
|
25
|
-
"minor": "./version.mjs minor",
|
|
26
|
-
"patch": "./version.mjs patch"
|
|
27
|
-
},
|
|
28
24
|
"keywords": [],
|
|
29
25
|
"author": "Degu Labs, Inc",
|
|
30
26
|
"license": "MIT",
|
|
@@ -46,5 +42,9 @@
|
|
|
46
42
|
"open": "^10.2.0",
|
|
47
43
|
"stable-hash": "^0.0.6",
|
|
48
44
|
"zod": "^4.3.5"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"minor": "./version.mjs minor",
|
|
48
|
+
"patch": "./version.mjs patch"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
package/types/src/browser.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC"}
|