I am trying to create a utility to take the windows relative path from VSCode
or IntelliJ
and replace the forward slash from the path with backslash and execute the jest
command to produce the coverage of the files mentioned in the argument to a script.
This is what I tried:
Script_file.js
const yargs = require('yargs');
const exec = require('child_process').exec;
const options = yargs
.usage('Some info')
.option('t', {some_object})
.option('m', {some_object})
.argv;
const tp = options.t.replace(/\\/g, '/');
const mp = options.m.replace(/\\/g, '/');
exec(`jest ${tp} --coverage --collectCoverageFrom=${mp} --colors`, (error, stdout, stderr) => {
if(error){
console.log('err');
}
console.log(stdout);
})
My script in package.json
"test:CoverageFile": "node Script_file.js",
Command
npm run test:CoverageFile -- -t=windows\style\file\path\for\test -m=windows\style\file\path\for\file\to\get\coverage\from
Now, everything is fine and I'm getting the output as expected too except the marked area in the image attached below[Image is just for reference]:
My question is how can I print this table as well in the output? I'll be highly obliged for any help.
EDIT:
- I also tried hooking up the
--coverageReporters
flag with jest command using various available options but to no avail.