Skip to content

Commit 2543f96

Browse 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.
1 parent 1002730 commit 2543f96

73 files changed

Lines changed: 742 additions & 446 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.coderabbit.yaml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ reviews:
7878
- "!lib/html/data.js"
7979
- "!test/**/__snapshots__/**"
8080
- "!yarn.lock"
81-
- "!test/test262-cases/**"
82-
- "!test/html5lib-tests/**"
83-
- "!test/css-parsing-tests/**"
81+
- "!test/external/**"
8482

8583
path_instructions:
8684
- path: "lib/**"

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2
3737
with:
3838
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
# Formats what `changeset version` wrote before the action commits
40+
# it, so the release pull request is not born failing fmt:check.
41+
version-script: yarn version:release
3942
# `changeset publish` refuses to run under Yarn Classic, so npm
4043
# publishes instead. The action runs this on every push that leaves no
4144
# changeset behind, hence the skip when npm already carries the

‎.github/workflows/test.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ jobs:
183183
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
184184

185185
- name: Check out the test262 corpus
186-
run: git submodule update --init --depth 1 test/test262-cases
186+
run: git submodule update --init --depth 1 test/external/test262-cases
187187

188188
- name: Use Node.js
189189
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -237,7 +237,7 @@ jobs:
237237
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
238238

239239
- name: Check out the test262 corpus
240-
run: git submodule update --init --depth 1 test/test262-cases
240+
run: git submodule update --init --depth 1 test/external/test262-cases
241241

242242
- name: Use Node.js
243243
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -271,7 +271,7 @@ jobs:
271271
# WPT is 161k files, so only this job checks it out, and only one commit
272272
# deep — it carries the tree-construction corpus html5lib-tests dropped.
273273
- name: Check out the html5lib and WPT corpora
274-
run: git submodule update --init --depth 1 test/html5lib-tests test/wpt
274+
run: git submodule update --init --depth 1 test/external/html5lib-tests test/external/wpt
275275

276276
- name: Use Node.js
277277
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -337,7 +337,7 @@ jobs:
337337
# Held to both corpora: webpack's own fixtures and the web's. WPT is 161k
338338
# files, so it is checked out one commit deep.
339339
- name: Check out the WPT corpus
340-
run: git submodule update --init --depth 1 test/wpt
340+
run: git submodule update --init --depth 1 test/external/wpt
341341

342342
- name: Use Node.js
343343
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -417,7 +417,7 @@ jobs:
417417
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
418418

419419
- name: Check out the css-parsing corpus
420-
run: git submodule update --init --depth 1 test/css-parsing-tests
420+
run: git submodule update --init --depth 1 test/external/css-parsing-tests
421421

422422
- name: Use Node.js
423423
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/node_modules
22
/test/js
3-
/test/browsertest/js
43
/test/fixtures/temp-*
54
/test/temp
65
/test/ChangesAndRemovals

‎.gitmodules‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
[submodule "test/test262-cases"]
2-
path = test/test262-cases
1+
[submodule "test/external/test262-cases"]
2+
path = test/external/test262-cases
33
url = https://github.com/tc39/test262
4-
[submodule "test/html5lib-tests"]
5-
path = test/html5lib-tests
4+
[submodule "test/external/html5lib-tests"]
5+
path = test/external/html5lib-tests
66
url = https://github.com/html5lib/html5lib-tests.git
7-
[submodule "test/css-parsing-tests"]
8-
path = test/css-parsing-tests
7+
[submodule "test/external/css-parsing-tests"]
8+
path = test/external/css-parsing-tests
99
url = https://github.com/CourtBouillon/css-parsing-tests.git
10-
[submodule "test/wpt"]
11-
path = test/wpt
10+
[submodule "test/external/wpt"]
11+
path = test/external/wpt
1212
url = https://github.com/web-platform-tests/wpt.git

‎.prettierignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ test/**/*.*
1919
!test/harness/**/*.*
2020
!test/benchmarkCases/**/*.mjs
2121
test/js/**/*.*
22-
test/test262-cases/**/*.*
23-
test/wpt/**
22+
test/external/test262-cases/**/*.*
23+
test/external/wpt/**
2424

2525
# Ignore some folders
2626
benchmark/

‎AGENTS.md‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ webpack is a JavaScript module bundler. It builds a dependency graph from entry
2323

2424
All commands are defined in `package.json` `scripts`.
2525

26-
| Command | What it does |
27-
| -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
28-
| `yarn fix` | `fix:code` (ESLint) + `fix:special` (regenerate types/validators) + `fmt` (Prettier). Prefer as the final step. |
29-
| `yarn setup` | Install dependencies and link the checkout in as `webpack`; non-interactive off a TTY. |
30-
| `yarn fix:special` | Regenerate `types.d.ts`, declarations, schema validators, and generated runtime code. |
31-
| `yarn lint` | Full lint: ESLint + generated-output checks + every `tsc` project + Prettier + spellcheck (what CI runs). |
32-
| `yarn tsc` | TypeScript type check of `lib/` JSDoc (catches type errors in annotations). |
33-
| `yarn validate:changeset` | Validate the pending `.changeset/` files. |
34-
| `yarn test:base --testPathPatterns="<pattern>"` | Run targeted tests. Also `yarn test:base -t "<name>"`. |
35-
| `yarn test:unit` | Run all `*.unittest.js`. |
36-
| `yarn test:integration` | Run the integration suites (`basictest`/`longtest`/`test`). |
37-
| `yarn test:test262` / `yarn test:html5lib` / `yarn test:css-parsing` | Spec-conformance suites. |
38-
| `yarn test:syntax-equivalence` | Holds the HTML/CSS printers to a real browser's reading of their output, over `configCases` and `test/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. |
26+
| Command | What it does |
27+
| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
28+
| `yarn fix` | `fix:code` (ESLint) + `fix:special` (regenerate types/validators) + `fmt` (Prettier). Prefer as the final step. |
29+
| `yarn setup` | Install dependencies and link the checkout in as `webpack`; non-interactive off a TTY. |
30+
| `yarn fix:special` | Regenerate `types.d.ts`, declarations, schema validators, and generated runtime code. |
31+
| `yarn lint` | Full lint: ESLint + generated-output checks + every `tsc` project + Prettier + spellcheck (what CI runs). |
32+
| `yarn tsc` | TypeScript type check of `lib/` JSDoc (catches type errors in annotations). |
33+
| `yarn validate:changeset` | Validate the pending `.changeset/` files. |
34+
| `yarn test:base --testPathPatterns="<pattern>"` | Run targeted tests. Also `yarn test:base -t "<name>"`. |
35+
| `yarn test:unit` | Run all `*.unittest.js`. |
36+
| `yarn test:integration` | Run the integration suites (`basictest`/`longtest`/`test`). |
37+
| `yarn test:test262` / `yarn test:html5lib` / `yarn test:css-parsing` | Spec-conformance suites. |
38+
| `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. |
4545

4646
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.
4747

@@ -105,16 +105,16 @@ The directory listings below are the canonical map of the repository. **Whenever
105105

106106
**Tests** — see [TESTING_DOCS.md](TESTING_DOCS.md) for directory structure, naming, and how to run a single case.
107107

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.
109109

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.
111111

112-
| Path | Upstream | Fetched by |
113-
| ------------------------ | ------------------------------------------------------------------------------------- | ------------------------------------------------ |
114-
| `test/test262-cases` | [tc39/test262](https://github.com/tc39/test262) | `test262`, `test262-parser` |
115-
| `test/html5lib-tests` | [html5lib/html5lib-tests](https://github.com/html5lib/html5lib-tests) | `html5lib` |
116-
| `test/wpt` | [web-platform-tests/wpt](https://github.com/web-platform-tests/wpt) | `html5lib`, `syntax-equivalence` (every browser) |
117-
| `test/css-parsing-tests` | [CourtBouillon/css-parsing-tests](https://github.com/CourtBouillon/css-parsing-tests) | `css-parsing` |
112+
| Path | Upstream | Fetched by |
113+
| --------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------ |
114+
| `test/external/test262-cases` | [tc39/test262](https://github.com/tc39/test262) | `test262`, `test262-parser` |
115+
| `test/external/html5lib-tests` | [html5lib/html5lib-tests](https://github.com/html5lib/html5lib-tests) | `html5lib` |
116+
| `test/external/wpt` | [web-platform-tests/wpt](https://github.com/web-platform-tests/wpt) | `html5lib`, `syntax-equivalence` (every browser) |
117+
| `test/external/css-parsing-tests` | [CourtBouillon/css-parsing-tests](https://github.com/CourtBouillon/css-parsing-tests) | `css-parsing` |
118118

119119
```sh
120120
git submodule update --init --recursive --depth 1 # check out the commits the repo pins
@@ -335,7 +335,7 @@ Pitfalls that have produced wrong conclusions here:
335335
yarn test:basic --testPathPatterns="ConfigTestCases" --testNamePattern="<category> <case>"
336336
```
337337

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/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.
339339

340340
**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`).
341341

0 commit comments

Comments
 (0)