-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Bug: Some Settings Cannot Be Inherited (extends keyword) #4979
Comments
This confuses me. Nothing in the Was the repro meant to have {
"extends": "./base.json",
"timeout": 10000
} The PR makes sense at first glance, and I can reproduce the buggy behavior by adding in the missing |
👋 ping @manuth, is this still on your radar? |
Closing this out as stale it's been more than a month. If anybody is seeing a bug like this and has a repro, please do post back. We'd be happy to take a look! ☕ |
Agreed - I assume we will be keeping track of this in #4980 anyways. |
Prerequisites
faq
labelnode_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Currently,
mocha
will load default settings fromlib/mocharc.json
from this package and only after doing so process the configuration usingyargs
.This breaks
yargs
extends
mechanism as the values predefined in saidmocharc.json
file cannot be overridden.This means that following settings cannot be specified using the
extends
config:diff
package
reporter
slow
timeout
ui
I assume that arrays still do work as, to my understanding, yargs will concatenate arrays taken from
extends
configs.Steps to Reproduce
mocha
tests written using thetdd
uibase.json
with the following content:.mocharc.json
:tdd
tests by running themocha
commandExpected behavior:
mocha
should be able to execute this test as the setting"ui": "tdd"
is supposed to be inherited.Actual behavior: [What actually happens]
mocha
will instead show the following error message:Reproduces how often: 100%
Versions
mocha --version
andnode_modules/.bin/mocha --version
: 10.0.2node --version
: 20.0.0bash
, PowerShell,cmd
Your browser and version (if running browser tests):Any third-party Mocha-related modules (and their versions):Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version):Additional Information
Notice that default values from this package's
lib/mocharc.json
file are applied to the current config file during the execution ofimport("mocha/lib/cli/options").loadOptions()
in this piece of code:mocha/lib/cli/options.js
Line 246 in 37deed2
Only after invoking
loadOptions()
, theextends
setting is processed byyargs
:loadOptions()
is executed - in doing so, values fromlib/mocharc.json
are appliedmocha/lib/cli/cli.js
Line 47 in 37deed2
extends
are processed byyargs
:mocha/lib/cli/cli.js
Line 77 in 37deed2
Related to this question: #3916
There is also a PR addressing this issue: #4407
Furthermore, I created a PR myself: #4980
The text was updated successfully, but these errors were encountered: