Skip to content

test(linter/plugins): Add eslint-plugin-mocha to JS Plugins conformance suite#20611

Merged
overlookmotel merged 2 commits intomainfrom
mocha-latte
Mar 27, 2026
Merged

test(linter/plugins): Add eslint-plugin-mocha to JS Plugins conformance suite#20611
overlookmotel merged 2 commits intomainfrom
mocha-latte

Conversation

@connorshea
Copy link
Copy Markdown
Member

@connorshea connorshea commented Mar 21, 2026

Add eslint-plugin-mocha to Oxlint JS plugins conformance tests suite. 100% of tests passing.

@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 Mar 21, 2026
@connorshea
Copy link
Copy Markdown
Member Author

Feel free to close this PR and just make it an issue, but I figured the actual conformance run would be helpful for confirming this and everything

@overlookmotel
Copy link
Copy Markdown
Member

Thanks for unearthing this.

I've opened an issue #20700 to discuss the problem and our options for solving it.

Let's keep this PR open and we can rebase it once we have a fix, and check the fix works.

@overlookmotel
Copy link
Copy Markdown
Member

If we merge #20799, it fixes the WeakMap problem and 100% of tests pass in this PR.

graphite-app bot pushed a commit that referenced this pull request Mar 27, 2026
…sourceCode` (#20799)

Fixes #20700.

Patch global `WeakMap` before loading plugins to make a `WeakMap` keyed by `context.sourceCode` act as if every file has a unique `context.sourceCode`.

The runtime cost of this patch is very low - for the use case of `WeakMap` keyed by `SourceCode`, it should be *faster* than an actual `WeakMap`, as no methods do actual hash map lookups. The implementation takes care not to leak memory even if plugins use `WeakMap`s extensively or in pathological patterns.

I rebased #20611 on top of this, and after this PR, 100% of `eslint-plugin-mocha`'s conformance tests pass.

It's pretty hacky to be patching globals, but I believe the implementation to be robust. My rationale for this solution is explained in detail in #20700.
connorshea and others added 2 commits March 27, 2026 15:20
…ce suite.

I need to investigate why many of these are failing right now.
@overlookmotel overlookmotel marked this pull request as ready for review March 27, 2026 15:26
@overlookmotel overlookmotel requested a review from camc314 as a code owner March 27, 2026 15:26
Copilot AI review requested due to automatic review settings March 27, 2026 15:26
Copy link
Copy Markdown
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

🚀🚀🚀

Copy link
Copy Markdown
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

Adds eslint-plugin-mocha to the oxlint JS-plugins conformance harness so its rule tests can be executed and tracked via snapshots alongside other plugin suites.

Changes:

  • Introduce a new conformance test group configuration for mocha.
  • Register the mocha group in the conformance group index.
  • Extend init.sh to clone/install eslint-plugin-mocha and add an initial conformance snapshot.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
apps/oxlint/conformance/src/groups/mocha.ts Defines the new conformance group (submodule name, test directory, filename mapping, RuleTester replacement).
apps/oxlint/conformance/src/groups/index.ts Adds the mocha group to the set of executed conformance suites.
apps/oxlint/conformance/snapshots/mocha.md Adds a snapshot for mocha conformance results.
apps/oxlint/conformance/init.sh Clones eslint-plugin-mocha at a pinned SHA and installs its dependencies.

@overlookmotel
Copy link
Copy Markdown
Member

#20799 is merged, and 100% of tests now pass. @connorshea I deleted your very useful description on this PR, just because it's no longer accurate. The content of your root cause analysis is covered in issue #20700.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 27, 2026
Copy link
Copy Markdown
Member

overlookmotel commented Mar 27, 2026

Merge activity

  • Mar 27, 3:31 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 27, 3:31 PM UTC: overlookmotel added this pull request to the Graphite merge queue.

@overlookmotel overlookmotel merged commit fb3ae98 into main Mar 27, 2026
28 checks passed
@overlookmotel overlookmotel deleted the mocha-latte branch March 27, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue 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.

4 participants