Skip to content

Add ESLint rule to disallow async describe blocks#6467

Closed
Sanenelisiwe1975 wants to merge 1 commit intoOpenZeppelin:masterfrom
Sanenelisiwe1975:fix/eslint-no-async-describe
Closed

Add ESLint rule to disallow async describe blocks#6467
Sanenelisiwe1975 wants to merge 1 commit intoOpenZeppelin:masterfrom
Sanenelisiwe1975:fix/eslint-no-async-describe

Conversation

@Sanenelisiwe1975
Copy link
Copy Markdown

Mocha ignores the returned Promise from async describe callbacks, which silently swallows any rejections thrown directly in the describe body. Add eslint-plugin-mocha with the mocha/no-async-suite rule to enforce this going forward, and fix the three existing violations.

Fixes #4943

Mocha ignores the returned Promise from async describe callbacks, which silently swallows any rejections thrown directly in the describe body. Add eslint-plugin-mocha with the mocha/no-async-suite rule to enforce this going forward, and fix the three existing violations.

Fixes #4943

PR Checklist

  • [x ] Tests-the ESLint rule itself enforces correctness going forward; no new unit tests needed for a linting rule
  • Documentation
  • [x ] Changeset entry (run npx changeset add)

@Sanenelisiwe1975 Sanenelisiwe1975 requested a review from a team as a code owner April 7, 2026 11:03
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 7, 2026

⚠️ No Changeset found

Latest commit: 948bd60

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 7, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​eslint-plugin-mocha@​11.2.010010010086100

View full report

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2eb1de94-6698-490d-b471-59ea818fb550

📥 Commits

Reviewing files that changed from the base of the PR and between 9cfdccd and 948bd60.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • eslint.config.mjs
  • package.json
  • test/access/manager/AccessManager.test.js
  • test/crosschain/BridgeERC1155.behavior.js
  • test/token/ERC6909/ERC6909.behavior.js

Walkthrough

Introduces ESLint rule enforcement via eslint-plugin-mocha to prevent async test suite declarations. Updates eslint.config.mjs to import the plugin and register the mocha/no-async-suite rule at error level. Adds eslint-plugin-mocha ^11.2.0 as a dev dependency. Removes async modifiers from three describe block callbacks in test files to comply with the new linting rule.

Suggested labels

tests

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding an ESLint rule to disallow async describe blocks, which is the primary objective of this PR.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale for the change and linking to the relevant issue #4943.
Linked Issues check ✅ Passed The PR fully addresses the objective from #4943: eslint-plugin-mocha is added, the mocha/no-async-suite rule is enabled, and three existing violations are fixed.
Out of Scope Changes check ✅ Passed All changes directly support the objective of enabling the ESLint rule and fixing violations. No out-of-scope modifications are present.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Mocha ignores the returned Promise from async describe callbacks, which
silently swallows any rejections thrown directly in the describe body.
Add eslint-plugin-mocha with the mocha/no-async-suite rule to enforce
this going forward, and fix the three existing violations.
@Sanenelisiwe1975 Sanenelisiwe1975 force-pushed the fix/eslint-no-async-describe branch from 948bd60 to 0190950 Compare April 7, 2026 11:38
@gonzaotc
Copy link
Copy Markdown
Contributor

gonzaotc commented Apr 7, 2026

Already solved at #6438

@gonzaotc gonzaotc closed this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider adding an ESLint rule for no async in describe blocks

3 participants