test(linter/plugins): add tests for new Context methods#15656
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. |
Merge activity
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive test coverage for new Context methods (getSourceCode(), getFilename(), getPhysicalFilename(), getCwd()) and the parserOptions getter that were previously added in #15606 and #15632 but lacked test coverage.
- Tests verify that getter methods return the same values as their property equivalents
- Tests confirm proper error handling when methods are called in inappropriate contexts (e.g., in
createOnce) - Snapshot files updated to reflect the additional test assertions
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
apps/oxlint/test/fixtures/sourceCode/plugin.ts |
Adds assertion verifying getSourceCode() returns the same reference as sourceCode property |
apps/oxlint/test/fixtures/languageOptions/plugin.ts |
Adds assertion verifying parserOptions getter returns the same reference as languageOptions.parserOptions |
apps/oxlint/test/fixtures/createOnce/plugin.ts |
Adds comprehensive tests for getCwd(), getFilename(), getPhysicalFilename(), getSourceCode(), and parserOptions in createOnce context, verifying expected error behavior |
apps/oxlint/test/fixtures/createOnce/output.snap.md |
Updates snapshot to include 12 additional test outputs (6 per file) for new method/getter tests, incrementing error count from 46 to 58 |
apps/oxlint/test/fixtures/context_properties/plugin.ts |
Consolidates context property tests into single report message and adds tests for getter methods getFilename(), getPhysicalFilename(), and getCwd() |
apps/oxlint/test/fixtures/context_properties/output.snap.md |
Updates snapshot with consolidated output format showing all context properties/methods in single report, reducing error count from 8 to 4 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3e9ddb4 to
4e844c1
Compare

Add test coverage for methods and getters on
Contextadded in #15606 and #15632. I neglected to add tests in those PRs. Disgraceful.