test(linter/plugins): conformance tests include config in snapshot#18344
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR refactors how test cases are captured in the conformance test runner. The previous approach wrapped test execution functions to attach test case data to errors, which was hacky. The new approach captures test case data directly in the modifyTestCase hook before tests run, resulting in cleaner code and more complete snapshot details.
Changes:
- Removed the
wrapRunTestCaseFunctionwrapper and related code fromrule_tester.ts - Added
setCurrentTestfunction to capture test cases in themodifyTestCasehook - Refactored error handling and test skip logic in the
itfunction for better organization
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/oxlint/src-js/package/rule_tester.ts | Removed 32 lines of wrapper code that attached test cases to errors |
| apps/oxlint/conformance/src/rule_tester.ts | Added test case capture via setCurrentTest() in the modifyTestCase hook |
| apps/oxlint/conformance/src/capture.ts | Added setCurrentTest function, refactored error handling logic, and extracted shouldSkipTest helper |
| apps/oxlint/conformance/snapshot.md | Updated snapshots to include config properties (ecmaVersion, sourceType, parserOptions) from RuleTester constructor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b07387c to
a277087
Compare
Merge activity
|
…18344) Change how test cases are captured by the conformance test runner. * Remove the hacky `wrapRunTestCaseFunction` from `RuleTester`. * Instead, capture the test case object in the `modifyTestCase` hook. This has 2 effects: 1. Conformance tests only make one patch to `RuleTester` (`modifyTestCase` hook), rather than two patches. This simplifies things. 2. The test case details in conformance snapshots include properties added to the test case from config (options passed to `new RuleTester()`). This makes the details in snapshot a complete picture for each test case.
687a0e8 to
7db6753
Compare
a277087 to
8a1232e
Compare

Change how test cases are captured by the conformance test runner.
wrapRunTestCaseFunctionfromRuleTester.modifyTestCasehook.This has 2 effects:
RuleTester(modifyTestCasehook), rather than two patches. This simplifies things.new RuleTester()). This makes the details in snapshot a complete picture for each test case.