pw-tracediff 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +95 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +9 -0
- package/dist/diff.d.ts +34 -0
- package/dist/diff.js +63 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +8 -0
- package/dist/format.d.ts +2 -0
- package/dist/format.js +38 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +45 -0
- package/dist/trace.d.ts +17 -0
- package/dist/trace.js +48 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/package.json +58 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gary Parker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tracediff
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Diff a passing and a failing Playwright `trace.zip`. Find the first step where the runs split, and what
|
|
4
|
+
changed in the network and console around it.
|
|
5
|
+
|
|
6
|
+
On npm as `pw-tracediff`; the CLI command is `tracediff`.
|
|
7
|
+
|
|
8
|
+
## The problem
|
|
9
|
+
|
|
10
|
+
A test fails in CI and passed an hour ago. The trace viewer shows one run at a time, so you compare two
|
|
11
|
+
traces by hand: scrolling both action lists, then both network tabs. `tracediff` does that comparison and
|
|
12
|
+
prints the result.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install --save-dev pw-tracediff
|
|
18
|
+
npx tracediff pass.zip fail.zip
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires Node 20 or later. The traces must come from `@playwright/test` (they contain a `test.trace`
|
|
22
|
+
entry). Record them with `trace: 'on'` or `'retain-on-failure'`; the files are at
|
|
23
|
+
`test-results/<test>/trace.zip`.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
tracediff pass.zip fail.zip # Markdown report
|
|
29
|
+
tracediff pass.zip fail.zip --json # machine-readable report
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
| Exit code | Meaning |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| 0 | The runs match |
|
|
35
|
+
| 1 | The runs differ |
|
|
36
|
+
| 2 | Usage error or unreadable file |
|
|
37
|
+
|
|
38
|
+
The report has four sections. Empty sections are left out.
|
|
39
|
+
|
|
40
|
+
- **First divergence.** Actions are the test's own steps (`Navigate`, `Fill`, `Click`, `Expect`, `test.step`),
|
|
41
|
+
compared in order by title and selector. The first step that differs is reported, with the error the
|
|
42
|
+
failing run raised. A step also diverges when it errors in only one run.
|
|
43
|
+
- **Network.** Requests are matched by method and URL, counting repeats. Reports requests missing from or
|
|
44
|
+
extra in the failing run, and status changes.
|
|
45
|
+
- **Console errors.** `console.error` messages that appear in only one run.
|
|
46
|
+
- **Duration outliers.** Matched actions where one run took at least 3x as long and at least 200 ms longer.
|
|
47
|
+
|
|
48
|
+
## Example
|
|
49
|
+
|
|
50
|
+
Output for the traces in `test/fixtures`. In the failing run the config request returns 500, the page
|
|
51
|
+
logs an error and retries, and the test clicks a selector that does not exist.
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
# tracediff
|
|
55
|
+
|
|
56
|
+
## First divergence
|
|
57
|
+
|
|
58
|
+
- Step 4: pass ran `Click locator('#save')`, fail ran `Click locator('#save-btn')`
|
|
59
|
+
- Fail error: TimeoutError: locator.click: Timeout 1000ms exceeded.
|
|
60
|
+
|
|
61
|
+
## Network
|
|
62
|
+
|
|
63
|
+
- Missing in fail: `GET https://app.tracediff.test/api/ping` (200)
|
|
64
|
+
- Missing in fail: `POST https://app.tracediff.test/api/save` (200)
|
|
65
|
+
- Extra in fail: `GET https://app.tracediff.test/api/retry` (200)
|
|
66
|
+
- Status changed: `GET https://app.tracediff.test/api/config` 200 -> 500
|
|
67
|
+
|
|
68
|
+
## Console errors
|
|
69
|
+
|
|
70
|
+
- Only in fail: Failed to load resource: the server responded with a status of 500 (Internal Server Error)
|
|
71
|
+
- Only in fail: config failed: 500
|
|
72
|
+
|
|
73
|
+
## Duration outliers
|
|
74
|
+
|
|
75
|
+
- `Wait for timeout`: 51 ms -> 610 ms
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Limits
|
|
79
|
+
|
|
80
|
+
- Only `@playwright/test` traces are read. Traces from the library API alone have no `test.trace`.
|
|
81
|
+
- Actions are compared by position. After the first divergence the later steps are not re-aligned, so
|
|
82
|
+
only the first divergence is reported.
|
|
83
|
+
- Network requests are matched by method and full URL. A URL with a changing query string or ID shows
|
|
84
|
+
as one missing and one extra request.
|
|
85
|
+
- Only `console.error` messages are compared, by exact text.
|
|
86
|
+
- Duration outliers are reported but do not affect the exit code, because timing varies between runs.
|
|
87
|
+
- Request and response bodies, headers and DOM snapshots are not compared.
|
|
88
|
+
|
|
89
|
+
## Fixtures
|
|
90
|
+
|
|
91
|
+
`test/fixtures/pass.zip` and `fail.zip` come from real Playwright runs. Regenerate them with
|
|
92
|
+
`npx playwright install chromium && npm run fixtures:gen`.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from './main.js';
|
|
3
|
+
main(process.argv.slice(2)).then((code) => {
|
|
4
|
+
process.exitCode = code;
|
|
5
|
+
}, (err) => {
|
|
6
|
+
process.stderr.write(`tracediff: ${err?.stack ?? err}\n`);
|
|
7
|
+
process.exitCode = 2;
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/diff.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Action, Request, Trace } from './trace.js';
|
|
2
|
+
export interface Divergence {
|
|
3
|
+
step: number;
|
|
4
|
+
kind: 'different' | 'error' | 'missing' | 'extra';
|
|
5
|
+
pass?: Action;
|
|
6
|
+
fail?: Action;
|
|
7
|
+
}
|
|
8
|
+
export interface StatusChange {
|
|
9
|
+
method: string;
|
|
10
|
+
url: string;
|
|
11
|
+
pass: number;
|
|
12
|
+
fail: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Outlier {
|
|
15
|
+
title: string;
|
|
16
|
+
selector: string;
|
|
17
|
+
pass: number;
|
|
18
|
+
fail: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Diff {
|
|
21
|
+
same: boolean;
|
|
22
|
+
divergence: Divergence | null;
|
|
23
|
+
network: {
|
|
24
|
+
missing: Request[];
|
|
25
|
+
extra: Request[];
|
|
26
|
+
statusChanges: StatusChange[];
|
|
27
|
+
};
|
|
28
|
+
console: {
|
|
29
|
+
onlyInPass: string[];
|
|
30
|
+
onlyInFail: string[];
|
|
31
|
+
};
|
|
32
|
+
outliers: Outlier[];
|
|
33
|
+
}
|
|
34
|
+
export declare function diffTraces(pass: Trace, fail: Trace): Diff;
|
package/dist/diff.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const OUTLIER_RATIO = 3;
|
|
2
|
+
const OUTLIER_MIN_MS = 200;
|
|
3
|
+
// Key each item by its value plus how many times that value occurred before it.
|
|
4
|
+
function keyed(items, key) {
|
|
5
|
+
const seen = new Map();
|
|
6
|
+
return new Map(items.map((item) => {
|
|
7
|
+
const k = key(item);
|
|
8
|
+
const n = seen.get(k) ?? 0;
|
|
9
|
+
seen.set(k, n + 1);
|
|
10
|
+
return [`${k}#${n}`, item];
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
function onlyIn(a, b) {
|
|
14
|
+
return [...a].filter(([k]) => !b.has(k)).map(([, v]) => v);
|
|
15
|
+
}
|
|
16
|
+
const actionKey = (a) => `${a.title}\0${a.selector}`;
|
|
17
|
+
const requestKey = (r) => `${r.method} ${r.url}`;
|
|
18
|
+
function firstDivergence(pass, fail) {
|
|
19
|
+
for (let i = 0; i < Math.max(pass.length, fail.length); i++) {
|
|
20
|
+
const [p, f] = [pass[i], fail[i]];
|
|
21
|
+
const step = i + 1;
|
|
22
|
+
if (!f)
|
|
23
|
+
return { step, kind: 'missing', pass: p };
|
|
24
|
+
if (!p)
|
|
25
|
+
return { step, kind: 'extra', fail: f };
|
|
26
|
+
if (actionKey(p) !== actionKey(f))
|
|
27
|
+
return { step, kind: 'different', pass: p, fail: f };
|
|
28
|
+
if ((p.error === undefined) !== (f.error === undefined))
|
|
29
|
+
return { step, kind: 'error', pass: p, fail: f };
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
export function diffTraces(pass, fail) {
|
|
34
|
+
const [pr, fr] = [keyed(pass.requests, requestKey), keyed(fail.requests, requestKey)];
|
|
35
|
+
const network = {
|
|
36
|
+
missing: onlyIn(pr, fr),
|
|
37
|
+
extra: onlyIn(fr, pr),
|
|
38
|
+
statusChanges: [...pr].flatMap(([k, p]) => {
|
|
39
|
+
const f = fr.get(k);
|
|
40
|
+
return f && f.status !== p.status ? [{ method: p.method, url: p.url, pass: p.status, fail: f.status }] : [];
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
const [pc, fc] = [keyed(pass.consoleErrors, (t) => t), keyed(fail.consoleErrors, (t) => t)];
|
|
44
|
+
const consoleDiff = { onlyInPass: onlyIn(pc, fc), onlyInFail: onlyIn(fc, pc) };
|
|
45
|
+
const [pa, fa] = [keyed(pass.actions, actionKey), keyed(fail.actions, actionKey)];
|
|
46
|
+
const outliers = [...pa].flatMap(([k, p]) => {
|
|
47
|
+
const f = fa.get(k);
|
|
48
|
+
if (!f)
|
|
49
|
+
return [];
|
|
50
|
+
const [hi, lo] = [Math.max(p.duration, f.duration), Math.min(p.duration, f.duration)];
|
|
51
|
+
const slow = hi - lo >= OUTLIER_MIN_MS && hi >= OUTLIER_RATIO * Math.max(lo, 1);
|
|
52
|
+
return slow ? [{ title: p.title, selector: p.selector, pass: p.duration, fail: f.duration }] : [];
|
|
53
|
+
});
|
|
54
|
+
const divergence = firstDivergence(pass.actions, fail.actions);
|
|
55
|
+
const same = !divergence &&
|
|
56
|
+
!network.missing.length &&
|
|
57
|
+
!network.extra.length &&
|
|
58
|
+
!network.statusChanges.length &&
|
|
59
|
+
!consoleDiff.onlyInPass.length &&
|
|
60
|
+
!consoleDiff.onlyInFail.length;
|
|
61
|
+
return { same, divergence, network, console: consoleDiff, outliers };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=diff.js.map
|
package/dist/errors.d.ts
ADDED
package/dist/errors.js
ADDED
package/dist/format.d.ts
ADDED
package/dist/format.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const label = (a) => `\`${`${a.title} ${a.selector}`.trim()}\``;
|
|
2
|
+
const ms = (n) => `${Math.round(n)} ms`;
|
|
3
|
+
const req = (r) => `\`${r.method} ${r.url}\``;
|
|
4
|
+
function section(heading, items) {
|
|
5
|
+
return items.length ? [`## ${heading}`, '', ...items.map((i) => `- ${i}`), ''] : [];
|
|
6
|
+
}
|
|
7
|
+
function divergenceLines(d) {
|
|
8
|
+
const { step, pass, fail } = d;
|
|
9
|
+
const head = d.kind === 'different'
|
|
10
|
+
? `Step ${step}: pass ran ${label(pass)}, fail ran ${label(fail)}`
|
|
11
|
+
: d.kind === 'missing'
|
|
12
|
+
? `Step ${step}: pass ran ${label(pass)}, fail stopped before it`
|
|
13
|
+
: d.kind === 'extra'
|
|
14
|
+
? `Step ${step}: fail ran ${label(fail)}, pass did not`
|
|
15
|
+
: `Step ${step}: ${label(pass)} errored in ${pass.error ? 'pass' : 'fail'} only`;
|
|
16
|
+
return [head, ...(fail?.error ? [`Fail error: ${fail.error}`] : []), ...(pass?.error ? [`Pass error: ${pass.error}`] : [])];
|
|
17
|
+
}
|
|
18
|
+
export function formatMarkdown(diff) {
|
|
19
|
+
const { network, console: cons } = diff;
|
|
20
|
+
const lines = [
|
|
21
|
+
'# tracediff',
|
|
22
|
+
'',
|
|
23
|
+
...(diff.same ? ['No differences.', ''] : []),
|
|
24
|
+
...section('First divergence', diff.divergence ? divergenceLines(diff.divergence) : []),
|
|
25
|
+
...section('Network', [
|
|
26
|
+
...network.missing.map((r) => `Missing in fail: ${req(r)} (${r.status})`),
|
|
27
|
+
...network.extra.map((r) => `Extra in fail: ${req(r)} (${r.status})`),
|
|
28
|
+
...network.statusChanges.map((c) => `Status changed: ${req(c)} ${c.pass} -> ${c.fail}`),
|
|
29
|
+
]),
|
|
30
|
+
...section('Console errors', [
|
|
31
|
+
...cons.onlyInPass.map((t) => `Only in pass: ${t}`),
|
|
32
|
+
...cons.onlyInFail.map((t) => `Only in fail: ${t}`),
|
|
33
|
+
]),
|
|
34
|
+
...section('Duration outliers', diff.outliers.map((o) => `${label(o)}: ${ms(o.pass)} -> ${ms(o.fail)}`)),
|
|
35
|
+
];
|
|
36
|
+
return lines.join('\n');
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=format.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { loadTrace } from './trace.js';
|
|
2
|
+
export type { Action, Request, Trace } from './trace.js';
|
|
3
|
+
export { diffTraces } from './diff.js';
|
|
4
|
+
export type { Diff, Divergence, StatusChange, Outlier } from './diff.js';
|
|
5
|
+
export { formatMarkdown } from './format.js';
|
|
6
|
+
export { main } from './main.js';
|
|
7
|
+
export { UsageError } from './errors.js';
|
package/dist/index.js
ADDED
package/dist/main.d.ts
ADDED
package/dist/main.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command, CommanderError } from 'commander';
|
|
2
|
+
import { diffTraces } from './diff.js';
|
|
3
|
+
import { UsageError } from './errors.js';
|
|
4
|
+
import { formatMarkdown } from './format.js';
|
|
5
|
+
import { loadTrace } from './trace.js';
|
|
6
|
+
import { VERSION } from './version.js';
|
|
7
|
+
const defaultIo = {
|
|
8
|
+
out: (t) => process.stdout.write(t.endsWith('\n') ? t : t + '\n'),
|
|
9
|
+
err: (t) => process.stderr.write(t.endsWith('\n') ? t : t + '\n'),
|
|
10
|
+
};
|
|
11
|
+
export async function main(argv, io = defaultIo) {
|
|
12
|
+
let exitCode = 0;
|
|
13
|
+
const program = new Command();
|
|
14
|
+
program
|
|
15
|
+
.name('tracediff')
|
|
16
|
+
.description('Diff a passing and a failing Playwright trace.zip. Exit 0 if the runs match, 1 if they differ, 2 on usage or IO errors.')
|
|
17
|
+
.version(VERSION)
|
|
18
|
+
.exitOverride()
|
|
19
|
+
.showHelpAfterError()
|
|
20
|
+
.configureOutput({ writeOut: (s) => io.out(s), writeErr: (s) => io.err(s) })
|
|
21
|
+
.argument('<pass.zip>', 'trace.zip from the passing run')
|
|
22
|
+
.argument('<fail.zip>', 'trace.zip from the failing run')
|
|
23
|
+
.option('--json', 'machine-readable output')
|
|
24
|
+
.action(async (passFile, failFile, o) => {
|
|
25
|
+
const diff = diffTraces(await loadTrace(passFile), await loadTrace(failFile));
|
|
26
|
+
io.out(o.json ? JSON.stringify(diff, null, 2) : formatMarkdown(diff));
|
|
27
|
+
exitCode = diff.same ? 0 : 1;
|
|
28
|
+
});
|
|
29
|
+
try {
|
|
30
|
+
await program.parseAsync(argv, { from: 'user' });
|
|
31
|
+
return exitCode;
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
if (e instanceof CommanderError) {
|
|
35
|
+
return ['commander.helpDisplayed', 'commander.version', 'commander.help'].includes(e.code) ? 0 : 2;
|
|
36
|
+
}
|
|
37
|
+
if (e instanceof UsageError) {
|
|
38
|
+
io.err(`tracediff: ${e.message}`);
|
|
39
|
+
return 2;
|
|
40
|
+
}
|
|
41
|
+
io.err(`tracediff: error: ${e.stack ?? String(e)}`);
|
|
42
|
+
return 2;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=main.js.map
|
package/dist/trace.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Action {
|
|
2
|
+
title: string;
|
|
3
|
+
selector: string;
|
|
4
|
+
duration: number;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Request {
|
|
8
|
+
method: string;
|
|
9
|
+
url: string;
|
|
10
|
+
status: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Trace {
|
|
13
|
+
actions: Action[];
|
|
14
|
+
requests: Request[];
|
|
15
|
+
consoleErrors: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function loadTrace(file: string): Promise<Trace>;
|
package/dist/trace.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { UsageError } from './errors.js';
|
|
4
|
+
const ACTION_METHODS = new Set(['pw:api', 'expect', 'test.step']);
|
|
5
|
+
const ANSI = /\u001b\[\d+m/g;
|
|
6
|
+
async function lines(zip, name) {
|
|
7
|
+
const files = zip.file(name).sort((a, b) => a.name.localeCompare(b.name));
|
|
8
|
+
const texts = await Promise.all(files.map((f) => f.async('string')));
|
|
9
|
+
return texts.flatMap((t) => t.split('\n').filter(Boolean).map((l) => JSON.parse(l)));
|
|
10
|
+
}
|
|
11
|
+
export async function loadTrace(file) {
|
|
12
|
+
let buf;
|
|
13
|
+
try {
|
|
14
|
+
buf = await readFile(file);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new UsageError(`cannot read ${file}`);
|
|
18
|
+
}
|
|
19
|
+
let zip;
|
|
20
|
+
try {
|
|
21
|
+
zip = await JSZip.loadAsync(buf);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new UsageError(`${file} is not a zip file`);
|
|
25
|
+
}
|
|
26
|
+
if (!zip.file('test.trace'))
|
|
27
|
+
throw new UsageError(`${file} has no test.trace (expected a trace from @playwright/test)`);
|
|
28
|
+
const events = await lines(zip, /^test\.trace$/);
|
|
29
|
+
const after = new Map(events.filter((e) => e.type === 'after').map((e) => [e.callId, e]));
|
|
30
|
+
const actions = events
|
|
31
|
+
.filter((e) => e.type === 'before' && !e.parentId && !e.group && ACTION_METHODS.has(e.method))
|
|
32
|
+
.map((e) => {
|
|
33
|
+
const end = after.get(e.callId);
|
|
34
|
+
const message = end?.error?.message;
|
|
35
|
+
return {
|
|
36
|
+
title: e.title,
|
|
37
|
+
selector: e.subtitle ?? '',
|
|
38
|
+
duration: end ? end.endTime - e.startTime : 0,
|
|
39
|
+
...(message !== undefined && { error: message.replace(ANSI, '').split('\n')[0] }),
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
const requests = (await lines(zip, /^(\d+-)?trace\.network$/)).map((e) => ({ method: e.snapshot.request.method, url: e.snapshot.request.url, status: e.snapshot.response?.status ?? 0 }));
|
|
43
|
+
const consoleErrors = (await lines(zip, /^(\d+-)?trace\.trace$/))
|
|
44
|
+
.filter((e) => e.type === 'console' && e.messageType === 'error')
|
|
45
|
+
.map((e) => e.text);
|
|
46
|
+
return { actions, requests, consoleErrors };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "0.1.0";
|
package/dist/version.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pw-tracediff",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Diff a passing and a failing Playwright trace.zip: first divergent action, network, console errors and duration outliers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Gary Parker",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/qa-gary-parker/tracediff.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"playwright",
|
|
15
|
+
"trace",
|
|
16
|
+
"diff",
|
|
17
|
+
"flaky",
|
|
18
|
+
"debugging",
|
|
19
|
+
"ci"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"tracediff": "dist/cli.js"
|
|
23
|
+
},
|
|
24
|
+
"main": "dist/index.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"!dist/**/*.map",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.build.json",
|
|
43
|
+
"prepare": "npm run build",
|
|
44
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
45
|
+
"lint": "npm run typecheck",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:watch": "vitest",
|
|
48
|
+
"fixtures:gen": "node fixtures-gen/generate.mjs"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"commander": "^14.0.3",
|
|
52
|
+
"jszip": "^3.10.2"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@playwright/test": "^1.65.0",
|
|
56
|
+
"@types/node": "^20.19.43",
|
|
57
|
+
"typescript": "~5.9",
|
|
58
|
+
"vitest": "^4.1.12"
|
|
59
|
+
}
|
|
60
|
+
}
|