Skip to content

fix: add more globals for mocha#9126

Merged
ematipico merged 2 commits intomainfrom
fix/mocha-globals-missed
Feb 17, 2026
Merged

fix: add more globals for mocha#9126
ematipico merged 2 commits intomainfrom
fix/mocha-globals-missed

Conversation

@ematipico
Copy link
Copy Markdown
Member

Summary

I found this bug while enabling some rules in the Astro monorepo. I asked help of the AI to search for more Mocha globals, and asked for adding a test

Test Plan

Added a new test. Green CI

Docs

It will be automatically updated via codegen

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: a7580c5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-CLI Area: CLI A-Linter Area: linter labels Feb 17, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 17, 2026

Caution

Review failed

An error occurred during the review process. Please try again later.

Walkthrough

This pull request introduces support for Mocha test framework globals within the Test domain of the linter. A changeset documents the patch version bump for @biomejs/biome, whilst the rule domain is extended to recognise ESLint-style Mocha globals (context, describe, it, expect, setup, teardown, and their x- prefixed variants). A new integration test validates that these globals are no longer flagged as undeclared when Mocha is listed as a project dependency.

Suggested labels

A-Linter, L-JavaScript, A-CLI

Suggested reviewers

  • dyc3
  • unvalley
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: adding missing Mocha globals to the Test domain, which aligns with all three modified files.
Description check ✅ Passed The description clearly explains the bug discovery, motivation, approach (including AI assistance), and testing/documentation plans, all relevant to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/mocha-globals-missed

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/fix-mocha-test-globals.md:
- Line 5: Add the missing Mocha global "suite" to the Test domain globals list:
update the changeset so the Test domain includes "suite" alongside the existing
entries (`context`, `run`, `setup`, `specify`, `suiteSetup`, `suiteTeardown`,
`teardown`, `xcontext`, `xdescribe`, `xit`, `xspecify`) so projects using
Mocha's BDD/TDD interfaces won't see `suite` flagged as an undeclared variable.

Comment thread .changeset/fix-mocha-test-globals.md Outdated
@ematipico ematipico merged commit 792013e into main Feb 17, 2026
14 checks passed
@ematipico ematipico deleted the fix/mocha-globals-missed branch February 17, 2026 14:37
@github-actions github-actions Bot mentioned this pull request Feb 17, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants