Mocha Configuration Spec Property Issue #381
Replies: 1 comment
-
|
Hmm, not sure if I understand you correctly but generally things work like this: The mocha-vscode extension respects the contents of the mocha configuration. e.g. it would only list tests from files already included via the configuration file. It When the extension launches tests, it specifies multiple things:
This eventually should ensure that exactly the tests are executed as expected. There is still a small chance of misbehavior if you have the same test names in multiple files and execute partially overlapping things. Unfortunately Mocha doesn't provide a very deterministic way to pass in exactly the tests you want to run, that's why the extension has the mentioned mechanism. The loading of the configuration happens through Mocha APIs which should take care of merging configs. Coming back to your point. It is intentional that you cannot run tests which are not included in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, I believe the test runner requires a Mocha configuration file (
.mocharc.jsetc) to contain/export aspecproperty with an array of test file globs to allow the runner to discover all the test files within a project.There is a problem with specifying a
specproperty within the Mocha configuration file, in that as it is an array, it is a mergeable option and therefore cannot be overridden on the command line, only added to. See https://mochajs.org/next/running/configuring/#merging.This means that with this configuration, I cannot run mocha from the command line, targeting an individual spec file for example, without having to temporarily comment out the
specproperty, or to use multiple config files.Would it be possible to either have the option to specify a custom Mocha config file from within the runner, or be able to specify the spec array in the runner, rather than requiring it in the config?
Beta Was this translation helpful? Give feedback.
All reactions