← tools

tracediff

prototype

Diffs a passing and a failing Playwright trace.zip: the first step where the runs split, and what changed in the network and console.

0 downloads/mo

npm i -D pw-tracediff
GitHubnpmReleases

Problem

A test fails in CI and passed an hour ago. The trace viewer shows one run at a time, so you compare two traces by hand: scrolling both action lists, then both network tabs. tracediff does that comparison and prints the result.

How it works

  • Compares the test's own steps in order, by title and selector, and reports the first step that differs with the error the failing run raised.
  • Matches network requests by method and URL, and reports requests missing from or extra in the failing run, and status changes.
  • Lists console.error messages that appear in only one run.
  • Flags matched steps where one run took at least 3x as long and at least 200 ms longer.
  • Prints Markdown, or JSON with --json. Exits 0 when the runs match, 1 when they differ and 2 on a usage error.

Requirements

Node 20 or newer. Traces from @playwright/test, recorded with trace: 'on' or 'retain-on-failure'.

FAQ

Does it report every difference?
No. Steps are compared by position and are not re-aligned after the first divergence, so only the first divergence is reported.
Do slow steps fail the diff?
No. Duration outliers are reported but do not change the exit code, because timing varies between runs.
What does it not compare?
Request and response bodies, headers and DOM snapshots. A URL with a changing query string or ID shows as one missing and one extra request.