Skip to content

Commit 8e6aed2

Browse files
xiaoxiaojxclaude
andauthored
docs: update AGENTS.md with test262, changeset, and bugfix workflow guidance (#20659)
- Add test262-cases to test directories and test commands table - Clarify changeset descriptions should not use fix:/feat: prefix - Add test-first workflow note for bug fixes Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 8ce1a55 commit 8e6aed2

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

AGENTS.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ If your change involves modifying or adding webpack configuration options:
3333

3434
Modify source code in `lib/` as needed. If step 1 was performed, the latest type definitions are already available.
3535

36+
For bug fixes, consider writing the test case (step 3) first. Run the test to confirm it fails, reproducing the bug. Then make the code change and re-run the test — a passing test confirms the fix.
37+
3638
### 3. Writing Tests
3739

3840
Test files live in `test/` with naming conventions:
@@ -51,22 +53,24 @@ Test files live in `test/` with naming conventions:
5153
- `test/hotCases/` — HMR (Hot Module Replacement) test cases
5254
- `test/benchmarkCases/` — Performance benchmark cases (each has `index.js` + `webpack.config.mjs` + optional `options.mjs` with `setup()`)
5355
- `test/*.unittest.js` — Unit tests using Jest directly (e.g., `test/FileSystemInfo.unittest.js` uses `memfs` for filesystem mocking)
56+
- `test/test262-cases/` — ECMAScript test262 conformance cases (git submodule, init with `git submodule update --init test/test262-cases`; test runner: `test/test262.spectest.js`)
5457

5558
### 4. Running Tests
5659

5760
Only run tests when test files are modified or explicitly requested.
5861

5962
**Choose test command based on modified directory:**
6063

61-
| Modified directory/file | Command |
62-
| ----------------------- | --------------------------------------------------------- |
63-
| `test/*.unittest.js` | `yarn test:base -- --testPathPatterns="<filename>"` |
64-
| `test/cases/` | `yarn test:basic` |
65-
| `test/configCases/` | `yarn test:basic -- --testPathPatterns="ConfigTestCases"` |
66-
| `test/statsCases/` | `yarn test:basic -- --testPathPatterns="StatsTestCases"` |
67-
| `test/watchCases/` | `yarn test:base -- --testPathPatterns="WatchTestCases"` |
68-
| `test/hotCases/` | `yarn test:base -- --testPathPatterns="HotTestCases"` |
69-
| `test/benchmarkCases/` | `FILTER="<case-name>" yarn benchmark` |
64+
| Modified directory/file | Command |
65+
| ----------------------- | ------------------------------------------------------------------------------------- |
66+
| `test/*.unittest.js` | `yarn test:base -- --testPathPatterns="<filename>"` |
67+
| `test/cases/` | `yarn test:basic` |
68+
| `test/configCases/` | `yarn test:basic -- --testPathPatterns="ConfigTestCases"` |
69+
| `test/statsCases/` | `yarn test:basic -- --testPathPatterns="StatsTestCases"` |
70+
| `test/watchCases/` | `yarn test:base -- --testPathPatterns="WatchTestCases"` |
71+
| `test/hotCases/` | `yarn test:base -- --testPathPatterns="HotTestCases"` |
72+
| `test/benchmarkCases/` | `FILTER="<case-name>" yarn benchmark` |
73+
| `test/test262-cases/` | `yarn test:test262` (requires `git submodule update --init test/test262-cases` first) |
7074

7175
You can add `--testNamePattern="<case-name>"` to run only specific test cases for faster validation. Multiple patterns can be combined with `|`. For example, if you only modified `test/configCases/css/basic/`:
7276

@@ -87,7 +91,7 @@ Every user-facing change needs a changeset file:
8791
Description of the change.
8892
```
8993

90-
Use `patch` for bug fixes, `minor` for new features, `major` for breaking changes.
94+
Use `patch` for bug fixes, `minor` for new features, `major` for breaking changes. Do not prefix the description with `fix:`, `feat:`, etc. — the change type is already indicated by `patch`/`minor`/`major`.
9195

9296
### 6. Updating Examples (if needed)
9397

0 commit comments

Comments
 (0)