@flakiness/playwright 1.7.0 → 1.9.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
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import fs from "node:fs";
|
|
16
16
|
import path from "node:path";
|
|
17
17
|
import * as nodeUtil from "node:util";
|
|
18
|
+
import pkg from "../package.json" with { type: "json" };
|
|
18
19
|
const styleText = (format, text) => nodeUtil.styleText?.(format, text) ?? text;
|
|
19
20
|
const warn = (txt) => console.warn(styleText("yellow", `[flakiness.io] ${txt}`));
|
|
20
21
|
const err = (txt) => console.error(styleText("red", `[flakiness.io] ${txt}`));
|
|
@@ -221,16 +222,13 @@ class FlakinessReporter {
|
|
|
221
222
|
this._ramUtilization.sample();
|
|
222
223
|
if (!this._config || !this._rootSuite)
|
|
223
224
|
throw new Error("ERROR: failed to resolve config");
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
worktree = GitWorktree.create(this._config.rootDir);
|
|
228
|
-
commitId = worktree.headCommitId();
|
|
229
|
-
} catch (e) {
|
|
230
|
-
warn(`Failed to fetch commit info - is this a git repo?`);
|
|
225
|
+
const worktreeResult = GitWorktree.initialize(this._config.rootDir);
|
|
226
|
+
if (!worktreeResult.ok) {
|
|
227
|
+
warn(`Failed to fetch commit info - is this a git repo? (${worktreeResult.error})`);
|
|
231
228
|
err(`Report is NOT generated.`);
|
|
232
229
|
return;
|
|
233
230
|
}
|
|
231
|
+
const { commitId, worktree } = worktreeResult;
|
|
234
232
|
const configPath = this._config.configFile ? worktree.gitPath(this._config.configFile) : void 0;
|
|
235
233
|
const context = {
|
|
236
234
|
project2environmentIdx: /* @__PURE__ */ new Map(),
|
|
@@ -239,11 +237,8 @@ class FlakinessReporter {
|
|
|
239
237
|
attachmentsCache: /* @__PURE__ */ new Map(),
|
|
240
238
|
unaccessibleAttachmentPaths: []
|
|
241
239
|
};
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
warn("Report is NOT generated since no Playwright project was executed.");
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
240
|
+
const projects = this._rootSuite.suites.map((s) => s.project()).filter((p) => !!p);
|
|
241
|
+
const environmentsMap = createEnvironments(projects);
|
|
247
242
|
if (this._options.collectBrowserVersions) {
|
|
248
243
|
try {
|
|
249
244
|
let playwrightPath = fs.realpathSync(process.argv[1]);
|
|
@@ -269,16 +264,17 @@ class FlakinessReporter {
|
|
|
269
264
|
const browser = await browserType.launch({ channel, headless });
|
|
270
265
|
const version = browser.version();
|
|
271
266
|
await browser.close();
|
|
272
|
-
env.
|
|
273
|
-
env.
|
|
267
|
+
env.metadata ??= {};
|
|
268
|
+
env.metadata["browser"] = (channel ?? browserName).toLowerCase().trim() + " " + version;
|
|
274
269
|
}
|
|
275
270
|
} catch (e) {
|
|
276
271
|
err(`Failed to resolve browser version: ${e}`);
|
|
277
272
|
}
|
|
278
273
|
}
|
|
279
274
|
const environments = [...environmentsMap.values()];
|
|
280
|
-
|
|
281
|
-
context.project2environmentIdx.set(
|
|
275
|
+
Array.from(environmentsMap.keys()).forEach((project, envIdx) => {
|
|
276
|
+
context.project2environmentIdx.set(project, envIdx);
|
|
277
|
+
});
|
|
282
278
|
const report = ReportUtils.normalizeReport({
|
|
283
279
|
flakinessProject: this._options.flakinessProject,
|
|
284
280
|
title: this._options.title ?? process.env.FLAKINESS_TITLE,
|
|
@@ -287,6 +283,9 @@ class FlakinessReporter {
|
|
|
287
283
|
relatedCommitIds: [],
|
|
288
284
|
configPath,
|
|
289
285
|
url: CIUtils.runUrl(),
|
|
286
|
+
generatedBy: { name: pkg.name, version: pkg.version },
|
|
287
|
+
testRunner: this._config.version ? { name: "@playwright/test", version: this._config.version } : void 0,
|
|
288
|
+
runtime: ReportUtils.detectRuntime(),
|
|
290
289
|
environments,
|
|
291
290
|
suites: await this._toFKSuites(context, this._rootSuite),
|
|
292
291
|
unattributedErrors: this._unattributedErrors.map((e) => this._toFKTestError(context, e)),
|
|
@@ -340,12 +339,7 @@ function createEnvironments(projects) {
|
|
|
340
339
|
for (let i = 2; uniqueNames.has(name); ++i)
|
|
341
340
|
name = `${defaultName}-${i}`;
|
|
342
341
|
uniqueNames.add(defaultName);
|
|
343
|
-
|
|
344
|
-
delete metadata.gitDiff;
|
|
345
|
-
result.set(project, ReportUtils.createEnvironment({
|
|
346
|
-
name,
|
|
347
|
-
metadata
|
|
348
|
-
}));
|
|
342
|
+
result.set(project, ReportUtils.createEnvironment({ name }));
|
|
349
343
|
}
|
|
350
344
|
return result;
|
|
351
345
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flakiness/playwright",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
],
|
|
28
28
|
"author": "Degu Labs, Inc",
|
|
29
29
|
"license": "MIT",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": "^20.17.0 || >=22.9.0"
|
|
32
|
+
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@flakiness/playwright": "^1.6.0",
|
|
32
35
|
"@playwright/test": "^1.57.0",
|
|
@@ -37,8 +40,8 @@
|
|
|
37
40
|
"typescript": "^5.9.3"
|
|
38
41
|
},
|
|
39
42
|
"dependencies": {
|
|
40
|
-
"@flakiness/flakiness-report": "^0.
|
|
41
|
-
"@flakiness/sdk": "^2.
|
|
43
|
+
"@flakiness/flakiness-report": "^0.34.0",
|
|
44
|
+
"@flakiness/sdk": "^3.2.0"
|
|
42
45
|
},
|
|
43
46
|
"scripts": {
|
|
44
47
|
"build": "kubik build.mts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"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