Skip to content

suite

Documentation / @wtf/project-wpt / suite

wptSuite: a suite of the Web Platform Tests in a repo’s Vitest run, each subtest of each test file a test, against the implementation the repo maps in.

test/encoding.wpt.test.ts
import { nodeSystem } from '@wtf/project-wpt/node'
import { wptSuite } from '@wtf/project-wpt/suite'
import { TextDecoder, TextEncoder } from '../src/encoding.ts'
wptSuite('encoding', nodeSystem(), {
commit: '4ad507b28db0a636f528def9161d109fe11b93a3',
files: ['encoding/api-basics.any.js'],
globals: () => ({ TextDecoder, TextEncoder }),
expectations: new URL('./encoding.wpt.json', import.meta.url)
})

The suite takes the platform, whose timers a file runs by, the files it reads the checkout by, the exec it runs git by, the realm a file runs in and the rejections it hears by, as parameters, all required: in Node, nodeSystem() of ./node, which a repo’s test file passes. The suite’s options pin the WPT to its commit, and name its tests, files and dirs, and the resources its tests fetch. It checks out what it lacks of them by checkoutTests of ./checkout, runs each file by runTest of ./run as Vitest collects it, and registers what each came to: of each file, a describe by its id, of its harness and of each subtest a test, by its name; and one test of the suite, that its expectations name nothing it does not have. A suite run against two implementations is a wptSuite of each, by its run, each of its own expectations. A file the expectations skip is a test Vitest skips, by the reason, and its scripts are not checked out.

Type Aliases

Functions