|
| 1 | +# Upstream selector tests |
| 2 | + |
| 3 | +The WPT runner loads `src/nwsapi.js` before each test page and installs it |
| 4 | +as the selector engine. It checks 41 pages listed in `test/upstream/manifest.mjs`. |
| 5 | +This is a selected suite, not the complete web-platform-tests project. |
| 6 | + |
| 7 | +Run with Node.js ≥ 22. |
| 8 | + |
| 9 | +```sh |
| 10 | +npm ci |
| 11 | +npm run upstream:clone |
| 12 | +npm run upstream:verify |
| 13 | +npx playwright install chromium |
| 14 | +npm run test:upstream |
| 15 | +``` |
| 16 | + |
| 17 | +`.gitmodules` pins WPT to `7aed6630812b20e6eec2a2e40594f8dfda036e00`. |
| 18 | +The helper fetches a shallow, sparse checkout and verifies its manifest hash. |
| 19 | +The checkout is ignored, not a Git submodule. Do not edit its files. |
| 20 | +Clone and sparse-restoration commands reject paths that resolve outside the |
| 21 | +repository and refuse dirty existing checkouts before changing them. |
| 22 | + |
| 23 | +Node tests run separately with `npm test`; they need neither WPT nor Chromium. |
| 24 | +The browser server binds localhost and refuses an occupied port. |
| 25 | + |
| 26 | +## Baseline |
| 27 | + |
| 28 | +`test/upstream/expectations.json` records failures measured against unchanged |
| 29 | +master `fe15bc3ae8f76725a13b329aad2efbe3fa75f9a4` using Chromium 151.0.7922.34. |
| 30 | +It is not the earlier aggregate branch's baseline. Pending fixes keep their |
| 31 | +regression assertions in their own PRs; a baseline entry does not replace them. |
| 32 | + |
| 33 | +This baseline contains 352 expected failures, versus 336 in the aggregate. |
| 34 | +The 16 additional failures cover relative `:has()` arguments and detached |
| 35 | +elements. Their correction belongs to the relational-selector extraction. |
| 36 | + |
| 37 | +Unexpected failures fail the run. Unexpected passes are reported for cleanup. |
| 38 | +To regenerate after reviewing an engine or upstream change: |
| 39 | + |
| 40 | +```sh |
| 41 | +WPT_UPDATE_EXPECTATIONS=1 npm run test:upstream |
| 42 | +``` |
| 43 | + |
| 44 | +Review the diff before committing. Do not use baseline updates to hide regressions. |
| 45 | +Filtered updates are rejected; baseline writes use one worker. |
| 46 | + |
| 47 | +Use `WPT_FILTER` for a subtest-name substring or `/regex/`, and `WPT_SECTION` |
| 48 | +for a selector-section substring. List sections with |
| 49 | +`node test/upstream/sections.mjs`. |
| 50 | + |
| 51 | +## Lint baseline |
| 52 | + |
| 53 | +The flat configuration checks source and new tooling. `eslint-suppressions.json` |
| 54 | +records two existing source findings: undefined `isInstanceof` in `byClass` |
| 55 | +and an unused assignment to `source`. They are not repaired by this tooling PR. |
| 56 | +Remove each suppression when its engine correction lands. |
0 commit comments