Mocha constructor: improve browser setup #4070
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The browser setup can result in an error when the option and its corresponding function don't match in their name, eg.
--diff
<==>hideDiff()
.see comment
Mocha options are used in different contexts:
via CLI: options can be set with canonical / alias / camel-cased canonical / camel-cased alias names.
The parser autocompletes the names and the whole bunch of options is dumped into the
mocha
instance.eg.
--timeout 200
results in:{timeout: 200, t: 200 timeouts: 200}
using Mocha programmatically: Mocha constructor accepts and processes only canonical or their camel-cased option names,
eg.
{timeout: 200, checkLeaks: true}
browser: setup() calls public function where option name matches function name.
Description of the Change
true
). They should work both ways (true
orfalse
):Mocha#allowUncaught
Mocha#asyncOnly
Mocha#checkLeaks
Mocha#forbidOnly
Mocha#forbidPending
Mocha#fullTrace
Mocha#ignoreLeaks
: soft deprecate (Mocha#checkLeaks
already exists)Mocha#globals
: keep this function, since its an alias name and add a newMocha#global
Mocha#hideDiff
: soft deprecate and add a newMocha#diff
Mocha#useColors
: soft deprecate and add a newMocha#color
Mocha#useInlineDiffs
: soft deprecate and add a newMocha#inlineDiffs