Skip to content

docs: fix correctness issues in error codes, CLI defaults, and config docs - #5860

Merged
JoshuaKGoldberg merged 1 commit into
mochajs:mainfrom
mostafaNazari702:docs/fix-error-codes-cli-defaults-config
Apr 29, 2026
Merged

JoshuaKGoldberg merged 1 commit into
mochajs:mainfrom
mostafaNazari702:docs/fix-error-codes-cli-defaults-config

Conversation

@mostafaNazari702

@mostafaNazari702 mostafaNazari702 commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

Fixes several documentation correctness issues across 5 pages, each verified against the current source code.

Error codes (features/error-codes.mdx): The table listed 7 of the 16 error codes defined in error-constants.mjs. Added the 9 missing codes (ERR_MOCHA_FATAL, ERR_MOCHA_FORBIDDEN_EXCLUSIVITY, ERR_MOCHA_INSTANCE_ALREADY_DISPOSED, ERR_MOCHA_INSTANCE_ALREADY_RUNNING, ERR_MOCHA_INVALID_PLUGIN_DEFINITION, ERR_MOCHA_INVALID_PLUGIN_IMPLEMENTATION, ERR_MOCHA_MULTIPLE_DONE, ERR_MOCHA_TIMEOUT, ERR_MOCHA_UNPARSABLE_FILE) in alphabetical order.

CLI --extension default (running/cli.mdx): Prose said the default was js. The actual default is ["js", "cjs", "mjs"] per mocharc.json. Updated the description and the usage example accordingly.

Config file priority list (running/configuring.mdx): The numbered priority list was missing .mocharc.cjs (highest precedence) and .mocharc.mjs. Updated to match the CONFIG_FILES array in config.js exactly.

Compiler deprecation page (explainers/compilers-deprecation.mdx): Stated Mocha "only loads .js files" by default. Updated to reflect the actual defaults (.js, .cjs, and .mjs).

ESM support limitations (explainers/nodejs-native-esm-support.mdx): Stated the configuration file "can only be a CommonJS file (.mocharc.js or .mocharc.cjs)". This is incorrect — YAML and JSON config formats are also supported. Corrected the bullet to accurately describe the JavaScript config format requirement and point readers to the configuring page.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Apr 5, 2026 •

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: mostafaNazari702 / name: Mostafa Nazari (22c690b)

@github-actions

This comment has been minimized.

@mark-wiemer mark-wiemer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mostafaNazari702 thanks for the PR :) please do review CONTRIBUTING.md when you can. Additionally, I've added a quick explainer in the backing issue (#5528). As much as we know about the project, it's critical that our changes to the docs are accurate, and it takes time for us to manually verify a lot of these edge cases. If you could add your own examples in the form of PR comments or GitHub Gists to support these changes, it'd go a long way in getting this PR merged :)

That said, three of the five files were easy to validate, so if you could create two quick examples we'd be able to merge this promptly!

Also, please run npm run format:fix when you have a chance. We are working on #5856 in the meantime :)

Thanks again!

Comment thread docs/src/content/docs/running/cli.mdx Resolved
@mostafaNazari702
mostafaNazari702 force-pushed the docs/fix-error-codes-cli-defaults-config branch from 456e2d6 to 22c690b Compare April 5, 2026 22:47
@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author waiting on response from OP or other posters - more information needed label Apr 7, 2026
@mark-wiemer mark-wiemer removed the status: waiting for author waiting on response from OP or other posters - more information needed label Apr 17, 2026

@mark-wiemer mark-wiemer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Won't merge until we get the go-ahead from Josh :) thank you for this!

@mark-wiemer mark-wiemer added the status: needs review a maintainer should (re-)review this pull request label Apr 17, 2026

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great - I verified this matches up the code & #5397. Thanks so much @mostafaNazari702! 🔥

@JoshuaKGoldberg JoshuaKGoldberg removed the status: needs review a maintainer should (re-)review this pull request label Apr 28, 2026
@JoshuaKGoldberg
JoshuaKGoldberg enabled auto-merge (squash) April 28, 2026 12:51
@JoshuaKGoldberg
JoshuaKGoldberg merged commit bd54205 into mochajs:main Apr 29, 2026
8 checks passed
@mostafaNazari702 mostafaNazari702 mentioned this pull request May 23, 2026
3 tasks done
@mostafaNazari702
mostafaNazari702 deleted the docs/fix-error-codes-cli-defaults-config branch August 10, 2026 08:45
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.

3 participants