You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2543f96
Browse filesBrowse the repository at this point in the historyBrowse files
test: group the submodules under test/external and tidy what pointed at them (#22173)
* test: move the git submodules under test/external
The four spec corpora sat among the first-party directories, so nothing
in the layout said which trees webpack maintains and which it only pins.
They move to test/external/, which names the property every future
submodule will share rather than what these four happen to test.
* test: drop the dead browsertest references
test/browsertest is gone, but three files still named it: an ignore in
.gitignore, two in jest.config.js, and the word in cspell.json. Each one
outlived the directory and nothing recreates it.
* test: drop the dead root benchmark ignore entries
jest ignored <rootDir>/benchmark in two lists, but no such directory
exists and the entries are root-anchored regexps, so they never covered
test/harness/benchmark either — which testMatch skips anyway.
* chore: exclude every submodule from review in one line
The three corpora were listed by name and wpt was missed, so ~161k files
went to review. test/external/** covers them and whatever is added next.
* test: spell the NUL sentinels as escapes
Three sites wrote a literal NUL byte, so git treated the file as binary
and showed no diff for it. A fourth site already used the escape form;
now all four do, and the file reviews as text.
* test: give the HMR playground a module type each and a start script
It still used webpack 1 spellings — an inline bundle-loader request and a
hand-rolled style injector — and nothing started it. yarn playground now
serves it, and each panel is a different module type: CommonJS, CSS, CSS
modules, JSON, asset and an async chunk.
* docs: order the test directory breakdown alphabetically
The numbered sections had grown 5b, 6b and 13b through 13d, so every
insertion needed a letter. They are unnumbered and sorted now, the four
corpora sit under one external/ heading, and memoryLimitCases no longer
names a subdirectory in its title.
* build: format the changelog as part of changeset version
changeset version writes CHANGELOG.md and the action commits it, so a
release pull request could be born failing fmt:check — and it did, since
a PR opened with GITHUB_TOKEN triggers no workflow to catch it. The
version-script now runs prettier over the file before that commit.
* test: gather the suite variants into one table
Nineteen TestCases shims and five HotTestCases ones each carried their
own option set, so what differs between the suites could only be read a
file at a time. The sets move to templates/variants.js and each shim
names its entry. The files stay: jest parallelizes per file.
* test: cover every module type in the HMR playground
The page is now an html entry, so experiments.html carries it, and the
panels add both wasm forms, all three asset types, an import attribute,
import defer and a source phase import. hmrApi.js drives the API itself:
data/dispose across updates, addStatusHandler, check and invalidate.
* test: fix three update paths the playground got wrong
The HMR API panel added a status handler per update and never mounted
its replacement, so the visible panel stayed at generation 1 forever. A
query makes logo.svg?inline its own module, so it needs its own handler.
And the html5lib runner reads the wpt corpus too, which its setup line
did not say.
|`yarn test:syntax-equivalence`| Holds the HTML/CSS printers to a real browser's reading of their output, over `configCases` and `test/external/wpt`. |
39
+
|`yarn test:base -u`| Update snapshots (eyeball the diff first). |
40
+
|`yarn test:size`| Size of the generated code over all `configCases/` (per asset, plus runtime module counts per runtime). |
41
+
|`yarn cover:unit`| Unit-test coverage. |
42
+
|`yarn types:cover`| Type-coverage report (share of `lib/` that is precisely typed). |
43
+
|`yarn build:examples`| Build the `examples/` (verify after changing options). |
44
+
|`yarn test`| Full suite — don't run unless asked. |
45
45
46
46
Never invoke `yarn jest`/`npx jest` directly: the required `--experimental-vm-modules` node flag lives only in the `test:base` wrapper, and bare jest crashes ESM/test262 suites. See [TESTING_DOCS.md](TESTING_DOCS.md) for how to run a single case.
47
47
@@ -105,16 +105,16 @@ The directory listings below are the canonical map of the repository. **Whenever
105
105
106
106
**Tests** — see [TESTING_DOCS.md](TESTING_DOCS.md) for directory structure, naming, and how to run a single case.
107
107
108
-
- `test/` — All test suites (`unitCases/`, `cases/`, `configCases/`, `specCases/`, `watchCases/`, `hotCases/`, `statsCases/`, `typesCases/`, `test262-cases/`, `html5lib-tests/`, `wpt/`, `css-parsing-tests/`, `benchmarkCases/`, `memoryLimitCases/`, etc.). `templates/` holds the suite drivers (`TestCases.js`, `ConfigTestCases.js`, `HotTestCases.js`, `WatchTestCases.js`) that the `*.test.js` / `*.basictest.js` / `*.longtest.js` files at the top of `test/` are thin shims over — each exports `describeCases(config)` and resolves case directories against the `test/` root, never against its own. `harness/` holds what runs those suites rather than what they test — jest's own lifecycle (`globalSetup.js`, `globalTeardown.js`, `setupTestFramework.js`), the `patch-node-env.js` environment, the crash reporter, the case `runner/` and `snapshot/` resolver, and `runtimes/` for the preload and setup files that let jest run under Bun and Deno. Reusable assertions and fixtures stay in `helpers/`. `RoundTripConfigCases` re-bundles the output of `configCases` marked with a `roundTrip.js` file. `wpt/` is web-platform-tests, checked out one commit deep by the `html5lib` and `syntax-equivalence` jobs — it is where the HTML tree-construction corpus lives since html5lib-tests dropped it.
108
+
- `test/` — All test suites (`unitCases/`, `cases/`, `configCases/`, `specCases/`, `watchCases/`, `hotCases/`, `statsCases/`, `typesCases/`, `benchmarkCases/`, `memoryLimitCases/`, etc.). `templates/` holds the suite drivers (`TestCases.js`, `ConfigTestCases.js`, `HotTestCases.js`, `WatchTestCases.js`) that the `*.test.js` / `*.basictest.js` / `*.longtest.js` files at the top of `test/` are thin shims over — each exports `describeCases(config)` and resolves case directories against the `test/` root, never against its own. The option sets those shims pass live together in `templates/variants.js`, re-exported as `variants`, so what differs between the suites reads side by side rather than one file at a time — a shim exists per entry because jest parallelizes per file, not per describe. `harness/` holds what runs those suites rather than what they test — jest's own lifecycle (`globalSetup.js`, `globalTeardown.js`, `setupTestFramework.js`), the `patch-node-env.js` environment, the crash reporter, the case `runner/` and `snapshot/` resolver, and `runtimes/` for the preload and setup files that let jest run under Bun and Deno. Reusable assertions and fixtures stay in `helpers/`. `RoundTripConfigCases` re-bundles the output of `configCases` marked with a `roundTrip.js` file. `external/` holds what webpack does not maintain — every git submodule checked out for testing, today the four spec corpora below, so a directory there is upstream's to change and ours only to pin. `external/wpt/` is web-platform-tests, checked out one commit deep by the `html5lib` and `syntax-equivalence` jobs — it is where the HTML tree-construction corpus lives since html5lib-tests dropped it.
109
109
110
-
**Git submodules** — the spec-conformance corpora are submodules, checked out on demand: `yarn setup` does not fetch them, and each CI job fetches only the submodules it needs, one commit deep.
110
+
**Git submodules** — every submodule lives under `test/external/`, checked out on demand: `yarn setup` does not fetch them, and each CI job fetches only the submodules it needs, one commit deep.
Swap `ConfigTestCases` for `StatsTestCases`, `HotTestCases`, `WatchTestCases`, … (full matrix in [TESTING_DOCS.md](TESTING_DOCS.md)). The `test262`, `html5lib`, `syntax-equivalence`, and `css-parsing` suites use git submodules — run `git submodule update --init --depth 1 test/test262-cases test/html5lib-tests test/wpt test/css-parsing-tests` first, or they fail confusingly.
338
+
Swap `ConfigTestCases` for `StatsTestCases`, `HotTestCases`, `WatchTestCases`, … (full matrix in [TESTING_DOCS.md](TESTING_DOCS.md)). The `test262`, `html5lib`, `syntax-equivalence`, and `css-parsing` suites use git submodules — run `git submodule update --init --depth 1 test/external/test262-cases test/external/html5lib-tests test/external/wpt test/external/css-parsing-tests` first, or they fail confusingly.
339
339
340
340
**Writing a `configCases/` case:** a case is a mini project — `index.js` (runs assertions; a thrown error fails the test) plus `webpack.config.js`. The emitted bundle is actually executed, so it must run. Optional per-case files: `errors.js` / `warnings.js` export arrays of matchers for expected build diagnostics (without them, any error/warning fails the case); `test.filter.js` returns `false` to skip the case (e.g. gate by Node version — see [Target the Node baseline](#target-the-node-baseline) when the fixture itself needs newer syntax); `test.config.js` customizes the run (e.g. `findBundle`).
0 commit comments