This appears to be a bug
Command line option --collectCoverageFrom has no effect on the options jest is run with
Tried several things:
$ npm test -- '--collectCoverageFrom=["**/*.js"]' --debug
$ npm test -- '--collectCoverageFrom=**/*.js' --debug
None of these show the collectCoverageFrom key in the config debug output. It's like this command line option is just ignored and I don't see how that happens with yargs.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.
hey @mark0978!
the correct usage would be like this:
jest --collectCoverageFrom='["packages/**/index.js"]' --coverage
single quotes around json and double quotes inside json.
it's complicated because there's no easy way to pass an array through yargs and we have to pass a serialized json instead :(
@dmitriiabramov can we add this here: http://facebook.github.io/jest/docs/api.html#jest-cli-options ?
absolutely!
https://github.com/facebook/jest/pull/2010
Having a heckuva time getting this to work in VSCode launch.json args. Trying to escape all the quotes leads to madness. Does this also only work with forward slashes on the paths?
It's a glob, so you should use forward slashes in it. https://github.com/micromatch/micromatch#backslashes
@SimenB, the problem was that VSCode variables don't allow you to either selectively use a POSIX path, or do a regex replace on the value. I ultimately had to use a VSCode extension to get the POSIX path for Jest.
Most helpful comment
hey @mark0978!
the correct usage would be like this:
single quotes around json and double quotes inside json.
it's complicated because there's no easy way to pass an array through yargs and we have to pass a serialized json instead :(