You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.
Description
Mocha doesn't rethrow error from cwd-relative path js config file because of the incorrect comparison operator in isModuleNotFoundError function in lib/cli/config.js (should be err.code === 'MODULE_NOT_FOUND'):
It will return true for the errors thrown inside config file so instead of rethrowing those errors it will try to load config file with a module-relative path:
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Mocha doesn't rethrow error from cwd-relative path js config file because of the incorrect comparison operator in
isModuleNotFoundError
function inlib/cli/config.js
(should beerr.code === 'MODULE_NOT_FOUND'
):mocha/lib/cli/config.js
Lines 33 to 35 in 3722201
It will return
true
for the errors thrown inside config file so instead of rethrowing those errors it will try to load config file with a module-relative path:mocha/lib/cli/config.js
Lines 48 to 53 in 3722201
Steps to Reproduce
Create .mocharc.js:
Run it:
./node_modules/mocha/bin/mocha --config .mocharc.js
Expected behavior:
Error: Unable to read/parse /Users/me/temp_mocha_proj/.mocharc.js: Error: foo
Actual behavior:
Error: Unable to read/parse .mocharc.js: Error: Cannot find module '.mocharc.js'
Reproduces how often:
100%
Versions
mocha --version
andnode node_modules/.bin/mocha --version
:9.0.2
node --version
:v12.13.0
macOS 10.14.6
64-bit
bash
The text was updated successfully, but these errors were encountered: