mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
ebd2ce4cb1
This also simplifies the way we track the conformance versions a bit, by centralizing the info into `repos.json`. I know #20607 will conflict with this one, so feel free to merge whichever of these two you prefer, and then I'll resolve the conflicts afterward. AI Disclosure: Generated with help from Claude Code.
1.6 KiB
1.6 KiB
Oxlint JS plugins conformance tests
Conformance tests run:
- All ESLint's tests for its built-in rules as Oxlint JS plugins.
- Tests from various ESLint plugins, running in Oxlint.
They do this by substituting ESLint's RuleTester for Oxlint's version, and then require()ing the test files
to run the tests.
The results are saved in snapshots directory.
Setup
Build Oxlint in conformance mode:
cd apps/oxlint
pnpm install
pnpm run build-conformance
Initialize plugin submodules:
pnpm run init-conformance
Run conformance tests
pnpm run conformance
Updating a pinned repo version
All upstream repo URLs, commit SHAs, and version labels are stored in repos.json.
Both init.sh and the TypeScript test groups read from this single file.
To update a repo to a newer version:
- Edit
repos.json— update thecommitShaandversionfor the repo. - Re-initialize submodules:
pnpm run init-conformance - Re-run the conformance tests:
pnpm run conformance - Commit the updated
repos.jsonand snapshot files.
Adding a plugin to conformance tests
- Add an entry to
repos.jsonwith the repo's URL, commit SHA, and version. - Add code to
init.shto clone and set up the plugin's repo. - Add a file to
src/groupsdirectory (copy pattern used for other plugins). - Add the group to
src/groups/index.ts.
Debugging
While working on adding a new plugin, you may find it useful to filter the test run, by editing
conformance/src/filter.ts. You can filter by plugin name, rule, or the code of a specific test case.