@empiricalrun/playwright-utils 0.35.0 → 0.36.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/CHANGELOG.md +18 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +12 -1
- package/dist/reporter/blob-utils.d.ts +1 -1
- package/dist/reporter/blob-utils.d.ts.map +1 -1
- package/dist/reporter/blob-utils.js +18 -18
- package/dist/reporter/empirical-reporter.d.ts +0 -1
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +2 -6
- package/dist/reporter/util.d.ts.map +1 -1
- package/dist/reporter/util.js +4 -5
- package/package.json +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.36.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2d9919d: feat: consolidate zip utils and move to streaming
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [2d9919d]
|
|
12
|
+
- @empiricalrun/r2-uploader@0.7.0
|
|
13
|
+
- @empiricalrun/test-gen@0.78.5
|
|
14
|
+
|
|
15
|
+
## 0.35.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- dcd3a61: fix: blob reporter output can hit ENAMETOOLONG error
|
|
20
|
+
|
|
3
21
|
## 0.35.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAgBzD,wBAAgB,gBAAgB,IAAI,MAAM,CAazC;AA6BD,eAAO,MAAM,UAAU,EAAE,oBAyBxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAarB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -36,8 +36,19 @@ function chromeStablePath() {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function getReporters() {
|
|
39
|
+
if (process.env.HAS_SHARDING && !process.env.SHARD_INDEX) {
|
|
40
|
+
throw new Error("Invalid env variables: HAS_SHARDING needs SHARD_INDEX");
|
|
41
|
+
}
|
|
39
42
|
const middle = process.env.HAS_SHARDING
|
|
40
|
-
? [
|
|
43
|
+
? [
|
|
44
|
+
[
|
|
45
|
+
"blob",
|
|
46
|
+
{
|
|
47
|
+
outputDir: "blob-report",
|
|
48
|
+
fileName: `report-${process.env.SHARD_INDEX}.zip`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
]
|
|
41
52
|
: [
|
|
42
53
|
["json", { outputFile: "summary.json" }],
|
|
43
54
|
["html", { open: "never" }],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type AttachmentKey = string;
|
|
2
2
|
export declare function makeAttachmentKey(testId: string, retryIndex: number, attachmentName: string): AttachmentKey;
|
|
3
|
-
export declare function patchBlobZip(zipPath: string, attachmentUrlMap: Map<AttachmentKey, string>): Record<string, string
|
|
3
|
+
export declare function patchBlobZip(zipPath: string, attachmentUrlMap: Map<AttachmentKey, string>): Promise<Record<string, string>>;
|
|
4
4
|
//# sourceMappingURL=blob-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-utils.d.ts","sourceRoot":"","sources":["../../src/reporter/blob-utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,aAAa,CAEf;AAED,
|
|
1
|
+
{"version":3,"file":"blob-utils.d.ts","sourceRoot":"","sources":["../../src/reporter/blob-utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,aAAa,CAEf;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoEjC"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.makeAttachmentKey = makeAttachmentKey;
|
|
7
4
|
exports.patchBlobZip = patchBlobZip;
|
|
8
|
-
const
|
|
5
|
+
const zip_1 = require("@empiricalrun/r2-uploader/zip");
|
|
9
6
|
const logger_1 = require("../logger");
|
|
10
7
|
function makeAttachmentKey(testId, retryIndex, attachmentName) {
|
|
11
8
|
return `${testId}|${retryIndex}|${attachmentName}`;
|
|
12
9
|
}
|
|
13
|
-
function patchBlobZip(zipPath, attachmentUrlMap) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
10
|
+
async function patchBlobZip(zipPath, attachmentUrlMap) {
|
|
11
|
+
const resourceToUrlMap = {};
|
|
12
|
+
const reportContent = await (0, zip_1.readZipEntry)(zipPath, "report.jsonl");
|
|
13
|
+
if (!reportContent) {
|
|
17
14
|
logger_1.logger.debug(`[Blob Utils] No report.jsonl found in blob zip: ${zipPath}`);
|
|
18
15
|
return {};
|
|
19
16
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
17
|
+
const lines = reportContent
|
|
18
|
+
.toString("utf8")
|
|
19
|
+
.split("\n")
|
|
20
|
+
.filter((line) => line.length);
|
|
22
21
|
const retryCounters = new Map();
|
|
23
22
|
const testRetryMap = new Map();
|
|
24
|
-
const resourceToUrlMap = {};
|
|
25
23
|
for (const line of lines) {
|
|
26
24
|
const event = JSON.parse(line);
|
|
27
25
|
if (event.method === "onTestEnd") {
|
|
@@ -54,13 +52,15 @@ function patchBlobZip(zipPath, attachmentUrlMap) {
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
await (0, zip_1.patchZipFile)(zipPath, {
|
|
56
|
+
filterEntry: (filename) => !filename.startsWith("resources/"),
|
|
57
|
+
newEntries: [
|
|
58
|
+
{
|
|
59
|
+
filename: "_empirical_urls.json",
|
|
60
|
+
content: Buffer.from(JSON.stringify(resourceToUrlMap, null, 2)),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
64
|
logger_1.logger.debug(`[Blob Utils] Patched blob zip: ${zipPath}, mapped ${Object.keys(resourceToUrlMap).length} resources`);
|
|
65
65
|
return resourceToUrlMap;
|
|
66
66
|
}
|
|
@@ -17,7 +17,6 @@ declare class EmpiricalReporter implements Reporter {
|
|
|
17
17
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
18
18
|
onEnd(result: FullResult): Promise<void>;
|
|
19
19
|
private _patchBlobReport;
|
|
20
|
-
private _patchBlobZip;
|
|
21
20
|
private _uploadBlobReport;
|
|
22
21
|
}
|
|
23
22
|
export default EmpiricalReporter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAkBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,UAAU,CACwE;IAC1F,OAAO,CAAC,sBAAsB,CAAuB;IAErD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAE1D,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,6BAA6B,CA4BnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAuFtC,KAAK,CAAC,MAAM,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAkBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,UAAU,CACwE;IAC1F,OAAO,CAAC,sBAAsB,CAAuB;IAErD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAE1D,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,6BAA6B,CA4BnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAuFtC,KAAK,CAAC,MAAM,EAAE,UAAU;YA4HhB,gBAAgB;YAOhB,iBAAiB;CAWhC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -192,8 +192,7 @@ class EmpiricalReporter {
|
|
|
192
192
|
void (0, r2_uploader_1.sendTaskToQueue)(uploadTraceTask);
|
|
193
193
|
}
|
|
194
194
|
else {
|
|
195
|
-
logger_1.logger.
|
|
196
|
-
return;
|
|
195
|
+
logger_1.logger.debug(`[Empirical Reporter] playwright-report/trace does not exist at: ${traceFilePath}`);
|
|
197
196
|
}
|
|
198
197
|
await (0, r2_uploader_1.waitForTaskQueueToFinish)();
|
|
199
198
|
await Promise.allSettled(this._pendingTestCaseEvents);
|
|
@@ -220,12 +219,9 @@ class EmpiricalReporter {
|
|
|
220
219
|
async _patchBlobReport(blobDir) {
|
|
221
220
|
const files = await fs_1.default.promises.readdir(blobDir);
|
|
222
221
|
for (const fileName of files.filter((f) => f.endsWith(".zip"))) {
|
|
223
|
-
|
|
222
|
+
await (0, blob_utils_1.patchBlobZip)(path_1.default.join(blobDir, fileName), this._attachmentUrlMap);
|
|
224
223
|
}
|
|
225
224
|
}
|
|
226
|
-
_patchBlobZip(zipPath) {
|
|
227
|
-
(0, blob_utils_1.patchBlobZip)(zipPath, this._attachmentUrlMap);
|
|
228
|
-
}
|
|
229
225
|
async _uploadBlobReport(blobDir) {
|
|
230
226
|
const uploadTask = (0, uploader_1.createUploadTaskV2)({
|
|
231
227
|
sourceDir: blobDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,cAAc,EAGd,UAAU,IAAI,oBAAoB,EAElC,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAmBnC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAmB7D;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,SAAS,UAMhC;AAED,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5E,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAyCD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ;;;EAwBrD;AAED,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GACnC,GAAG,CAIL;AAED,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,iBAuGjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,GAAG,EACb,iBAAiB,EAAE,GAAG,CACpB,MAAM,EACN;IAAE,WAAW,EAAE,2BAA2B,EAAE,CAAA;CAAE,EAAE,CACjD,QA+BF;AAGD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,oBAAoB,EACjC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,QAavC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,OAAe,GAC9B,GAAG,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,2BAA2B,EAAE,CAAA;CAAE,EAAE,CAAC,CA4C/D;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO7E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,6CAoClB"}
|
package/dist/reporter/util.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.traverseJsonReportSuites = traverseJsonReportSuites;
|
|
|
15
15
|
exports.buildTestAttachmentMapFromSummary = buildTestAttachmentMapFromSummary;
|
|
16
16
|
exports.checkFileExistsAsync = checkFileExistsAsync;
|
|
17
17
|
exports.updateSummaryJsonAttachmentPaths = updateSummaryJsonAttachmentPaths;
|
|
18
|
-
const
|
|
18
|
+
const zip_1 = require("@empiricalrun/r2-uploader/zip");
|
|
19
19
|
const async_retry_1 = __importDefault(require("async-retry"));
|
|
20
20
|
const fs_1 = __importDefault(require("fs"));
|
|
21
21
|
const path_1 = __importDefault(require("path"));
|
|
@@ -181,7 +181,7 @@ async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, repo
|
|
|
181
181
|
const zipPath = path_1.default.join(tempDir, "archive.zip");
|
|
182
182
|
try {
|
|
183
183
|
await fs_1.default.promises.writeFile(zipPath, Buffer.from(base64, "base64"));
|
|
184
|
-
|
|
184
|
+
await (0, zip_1.extractZipToDirectory)(zipPath, tempDir);
|
|
185
185
|
await fs_1.default.promises.unlink(zipPath);
|
|
186
186
|
}
|
|
187
187
|
catch (err) {
|
|
@@ -205,9 +205,8 @@ async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, repo
|
|
|
205
205
|
console.error(`❌ Error processing test file ${file}:`, err);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const newBase64 = newZip.toBuffer().toString("base64");
|
|
208
|
+
const newBuffer = await (0, zip_1.createZipFromDirectory)(tempDir);
|
|
209
|
+
const newBase64 = newBuffer.toString("base64");
|
|
211
210
|
let updatedHtml;
|
|
212
211
|
if (oldFormatMatch) {
|
|
213
212
|
// Old format (1.53.x): window.playwrightReportBase64 = "..."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"@types/console-log-level": "^1.4.5",
|
|
30
30
|
"@types/node": "^20.14.9",
|
|
31
31
|
"@types/serve-handler": "^6.1.4",
|
|
32
|
-
"@types/adm-zip": "^0.5.7",
|
|
33
32
|
"@types/pg": "^8.11.6",
|
|
34
33
|
"playwright-core": "1.53.2",
|
|
35
34
|
"serve-handler": "^6.1.6",
|
|
@@ -38,15 +37,14 @@
|
|
|
38
37
|
"dependencies": {
|
|
39
38
|
"@babel/code-frame": "^7.24.7",
|
|
40
39
|
"pg": "^8.13.1",
|
|
41
|
-
"adm-zip": "^0.5.16",
|
|
42
40
|
"async-retry": "^1.3.3",
|
|
43
41
|
"authenticator": "^1.1.5",
|
|
44
42
|
"console-log-level": "^1.4.1",
|
|
45
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
46
44
|
"rimraf": "^6.0.1",
|
|
47
45
|
"@empiricalrun/llm": "^0.25.1",
|
|
48
|
-
"@empiricalrun/r2-uploader": "^0.
|
|
49
|
-
"@empiricalrun/test-gen": "^0.78.
|
|
46
|
+
"@empiricalrun/r2-uploader": "^0.7.0",
|
|
47
|
+
"@empiricalrun/test-gen": "^0.78.5"
|
|
50
48
|
},
|
|
51
49
|
"scripts": {
|
|
52
50
|
"dev": "tsc --build --watch",
|