@flakiness/playwright 0.151.0 → 0.153.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/lib/playwright-test.js
CHANGED
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
GitWorktree,
|
|
5
5
|
ReportUtils,
|
|
6
6
|
showReport,
|
|
7
|
-
|
|
7
|
+
CPUUtilization,
|
|
8
|
+
RAMUtilization,
|
|
8
9
|
uploadReport,
|
|
9
10
|
writeReport
|
|
10
11
|
} from "@flakiness/sdk";
|
|
@@ -27,16 +28,25 @@ var FlakinessReporter = class {
|
|
|
27
28
|
constructor(_options = {}) {
|
|
28
29
|
this._options = _options;
|
|
29
30
|
this._outputFolder = path.join(process.cwd(), this._options.outputFolder ?? process.env.FLAKINESS_OUTPUT_DIR ?? "flakiness-report");
|
|
31
|
+
this._sampleSystem = this._sampleSystem.bind(this);
|
|
32
|
+
this._sampleSystem();
|
|
30
33
|
}
|
|
31
34
|
_config;
|
|
32
35
|
_rootSuite;
|
|
33
36
|
_results = /* @__PURE__ */ new Map();
|
|
34
37
|
_unattributedErrors = [];
|
|
35
|
-
|
|
38
|
+
_cpuUtilization = new CPUUtilization({ precision: 10 });
|
|
39
|
+
_ramUtilization = new RAMUtilization({ precision: 10 });
|
|
36
40
|
_report;
|
|
37
41
|
_attachments = [];
|
|
38
42
|
_outputFolder;
|
|
39
43
|
_result;
|
|
44
|
+
_telemetryTimer;
|
|
45
|
+
_sampleSystem() {
|
|
46
|
+
this._cpuUtilization.sample();
|
|
47
|
+
this._ramUtilization.sample();
|
|
48
|
+
this._telemetryTimer = setTimeout(this._sampleSystem, 1e3);
|
|
49
|
+
}
|
|
40
50
|
printsToStdio() {
|
|
41
51
|
return false;
|
|
42
52
|
}
|
|
@@ -156,7 +166,9 @@ var FlakinessReporter = class {
|
|
|
156
166
|
};
|
|
157
167
|
}
|
|
158
168
|
async onEnd(result) {
|
|
159
|
-
this.
|
|
169
|
+
clearTimeout(this._telemetryTimer);
|
|
170
|
+
this._cpuUtilization.sample();
|
|
171
|
+
this._ramUtilization.sample();
|
|
160
172
|
if (!this._config || !this._rootSuite)
|
|
161
173
|
throw new Error("ERROR: failed to resolve config");
|
|
162
174
|
let commitId;
|
|
@@ -215,17 +227,17 @@ var FlakinessReporter = class {
|
|
|
215
227
|
category: "playwright",
|
|
216
228
|
commitId: worktree.headCommitId(),
|
|
217
229
|
relatedCommitIds: [],
|
|
218
|
-
systemUtilization: this._systemUtilizationSampler.result,
|
|
219
230
|
configPath,
|
|
220
231
|
url: CIUtils.runUrl(),
|
|
221
232
|
environments,
|
|
222
233
|
suites: await this._toFKSuites(context, this._rootSuite),
|
|
223
|
-
opaqueData: this._config,
|
|
224
234
|
unattributedErrors: this._unattributedErrors.map((e) => this._toFKTestError(context, e)),
|
|
225
235
|
duration: parseDurationMS(result.duration),
|
|
226
236
|
startTimestamp: +result.startTime
|
|
227
237
|
});
|
|
228
|
-
ReportUtils.
|
|
238
|
+
ReportUtils.collectSources(worktree, report);
|
|
239
|
+
this._cpuUtilization.enrich(report);
|
|
240
|
+
this._ramUtilization.enrich(report);
|
|
229
241
|
for (const unaccessibleAttachment of context.unaccessibleAttachmentPaths)
|
|
230
242
|
warn(`cannot access attachment ${unaccessibleAttachment}`);
|
|
231
243
|
this._report = report;
|
|
@@ -274,8 +286,7 @@ function createEnvironments(projects) {
|
|
|
274
286
|
delete metadata.gitDiff;
|
|
275
287
|
result.set(project, ReportUtils.createEnvironment({
|
|
276
288
|
name,
|
|
277
|
-
|
|
278
|
-
opaqueData: { project }
|
|
289
|
+
metadata
|
|
279
290
|
}));
|
|
280
291
|
}
|
|
281
292
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flakiness/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.153.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,13 +14,21 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
|
-
"description": "",
|
|
17
|
+
"description": "A custom Playwright test reporter that generates Flakiness Reports from your Playwright test runs",
|
|
18
18
|
"types": "./types/index.d.ts",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"minor": "./version.mjs minor",
|
|
21
21
|
"patch": "./version.mjs patch"
|
|
22
22
|
},
|
|
23
|
-
"keywords": [
|
|
23
|
+
"keywords": [
|
|
24
|
+
"playwright",
|
|
25
|
+
"test",
|
|
26
|
+
"reporter",
|
|
27
|
+
"flakiness",
|
|
28
|
+
"testing",
|
|
29
|
+
"e2e",
|
|
30
|
+
"test-reporting"
|
|
31
|
+
],
|
|
24
32
|
"author": "Degu Labs, Inc",
|
|
25
33
|
"license": "MIT",
|
|
26
34
|
"devDependencies": {
|
|
@@ -31,7 +39,7 @@
|
|
|
31
39
|
"typescript": "^5.9.3"
|
|
32
40
|
},
|
|
33
41
|
"dependencies": {
|
|
34
|
-
"@flakiness/sdk": "^0.
|
|
42
|
+
"@flakiness/sdk": "^0.153.0",
|
|
35
43
|
"chalk": "^5.6.2"
|
|
36
44
|
}
|
|
37
45
|
}
|
|
@@ -6,11 +6,13 @@ export default class FlakinessReporter implements Reporter {
|
|
|
6
6
|
private _rootSuite?;
|
|
7
7
|
private _results;
|
|
8
8
|
private _unattributedErrors;
|
|
9
|
-
private
|
|
9
|
+
private _cpuUtilization;
|
|
10
|
+
private _ramUtilization;
|
|
10
11
|
private _report?;
|
|
11
12
|
private _attachments;
|
|
12
13
|
private _outputFolder;
|
|
13
14
|
private _result?;
|
|
15
|
+
private _telemetryTimer?;
|
|
14
16
|
constructor(_options?: {
|
|
15
17
|
endpoint?: string;
|
|
16
18
|
token?: string;
|
|
@@ -18,6 +20,7 @@ export default class FlakinessReporter implements Reporter {
|
|
|
18
20
|
open?: OpenMode;
|
|
19
21
|
collectBrowserVersions?: boolean;
|
|
20
22
|
});
|
|
23
|
+
private _sampleSystem;
|
|
21
24
|
printsToStdio(): boolean;
|
|
22
25
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
23
26
|
onError(error: TestError): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EAEV,QAAQ,EACR,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAEvC,MAAM,2BAA2B,CAAC;AA6BnC,KAAK,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,QAAQ;IAgB5C,OAAO,CAAC,QAAQ;IAf5B,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAwC;IACxD,OAAO,CAAC,mBAAmB,CAAmB;IAE9C,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,OAAO,CAAC,CAAY;IAC5B,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAErB,QAAQ,GAAE;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,sBAAsB,CAAC,EAAE,OAAO,CAAC;KAC7B;IAON,OAAO,CAAC,aAAa;IAMrB,aAAa,IAAI,OAAO;IAIxB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK;IAKxC,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAI/B,WAAW,CAAC,IAAI,EAAE,QAAQ;IAG1B,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;YAM9B,WAAW;YAsBX,SAAS;YAWT,eAAe;IAmD7B,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;IAUhB,KAAK,CAAC,MAAM,EAAE,UAAU;IA2FxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B9B"}
|