Skip to content

test(linter/plugins): conformance tests include config in snapshot#18344

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-21-test_linter_plugins_conformance_tests_include_config_in_snapshot
Jan 21, 2026
Merged

test(linter/plugins): conformance tests include config in snapshot#18344
graphite-app[bot] merged 1 commit intomainfrom
om/01-21-test_linter_plugins_conformance_tests_include_config_in_snapshot

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 21, 2026

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them labels Jan 21, 2026
Copy link
Member Author

overlookmotel commented Jan 21, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 wrapRunTestCaseFunction wrapper and related code from rule_tester.ts
  • Added setCurrentTest function to capture test cases in the modifyTestCase hook
  • Refactored error handling and test skip logic in the it function 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.

@overlookmotel overlookmotel removed the request for review from camc314 January 21, 2026 12:09
@overlookmotel overlookmotel force-pushed the om/01-21-test_linter_plugins_conformance_tests_include_config_in_snapshot branch from b07387c to a277087 Compare January 21, 2026 12:11
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 21, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 21, 2026

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.
@graphite-app graphite-app bot force-pushed the om/01-21-test_linter_plugins_simplify_tester_script branch from 687a0e8 to 7db6753 Compare January 21, 2026 12:19
@graphite-app graphite-app bot force-pushed the om/01-21-test_linter_plugins_conformance_tests_include_config_in_snapshot branch from a277087 to 8a1232e Compare January 21, 2026 12:20
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 21, 2026
Base automatically changed from om/01-21-test_linter_plugins_simplify_tester_script to main January 21, 2026 12:26
@graphite-app graphite-app bot merged commit 8a1232e into main Jan 21, 2026
20 checks passed
@graphite-app graphite-app bot deleted the om/01-21-test_linter_plugins_conformance_tests_include_config_in_snapshot branch January 21, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants