Skip to content

SYSTEM Cited by 1 source

Web Platform Tests (WPT)

Web Platform Tests (web-platform-tests.org) is the cross-browser conformance test suite for web platform APIs — one shared corpus of tests that every browser engine (Chromium/Blink, Firefox/Gecko, Safari/WebKit) and increasingly every server-side JS runtime (Node.js, Deno, Bun, Cloudflare Workers) runs to verify spec conformance.

Why it shows up on this wiki

WPT is the canonical executable specification for web standards. When a new implementation of a spec'd API needs a pass/fail oracle, WPT is that oracle. Two load-bearing consequences surface in the wiki corpus:

  1. AI-driven reimplementations become tractable. Vercel's 2026-04-21 disclosure of fast-webstreams names WPT as what made AI-assisted rework feasible:

    "The amazing Web Platform Tests gave us 1,116 tests as an immediate, machine-checkable answer to 'did we break anything?'" Canonicalised at patterns/ai-reimplementation-against-conformance-suite.

  2. The tests catch the optimiser's shortcuts. Vercel reports: "We tried many shortcuts. Almost every one of them broke a Web Platform Test, and the test was usually right." The tests encode real edge cases — cancellation-during-read, error identity through locked streams, thenable interception — that naive optimisations silently break.

Streams suite specifics

The WPT streams suite has 1,116 tests covering ReadableStream / WritableStream / TransformStream (as of 2026-04-21). Baseline pass rates per the Vercel disclosure:

Implementation Pass Fail
Node.js native 1,099 17
fast-webstreams 1,100 16

Remaining failures are either shared with native (e.g. unimplemented type: 'owning' transfer mode for the ReadableStream.transfer() semantics) or architectural differences that don't affect real applications.

WPT monkey-patches the test harness

One notable WPT testing practice: the tests monkey-patch host objects to verify implementation correctness. Examples cited in the 2026-04-21 post:

  • WPT monkey-patches Function.prototype.call and verifies that stream implementations do not use it to invoke user-provided callbacks — forcing the use of Reflect.apply instead.
  • WPT puts .then on read results and verifies the stream handles thenable interception correctly (because Promise.resolve(obj) always checks for thenables).

This "test the test" discipline means a "fast" implementation cannot skip spec edges without WPT failing loudly.

How WPT is consumed

  • Browser engines: WPT is part of each engine's CI.
  • Node.js: the test/wpt directory in the Node source tree runs upstream WPT against Node's implementations (URL, fetch, streams, etc.).
  • Bun / Deno / Workers: each maintains its own WPT ingestion process; Workers in particular has a published dashboard.
  • Library implementations: e.g. fast-webstreams runs WPT as part of its development loop.

Canonical citation pattern: "X passes N of M WPT cases" — a standard shorthand for spec compliance.

Relationship to tests-as-executable-spec pattern

WPT is the web-standards tier of the broader patterns/tests-as-executable-specifications pattern. Where an AWS Architecture Blog post names tests as a specification aid for agents, WPT is the longer-standing, cross-browser precedent at the spec implementation tier — the pattern's canonical large-scale realisation. See also concepts/specification-driven-development at the formal-spec altitude.

Seen in

Last updated · 476 distilled / 1,218 read