Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options = {
projects: [ cwd ],
_: targetFiles,
silent: true,
// Shall disable output, but instead switch to stderr
// https://github.com/facebook/jest/issues/5064
json: true,
showConfig: false
};
strErrCapturer.contents = [];
// Override stderr
const save = process.stderr.write.bind( process.stderr );
process.stderr.write = strErrCapturer.write.bind( strErrCapturer );
// Run JEST
const report = await runCLI( options, options.projects );
// Restore stderr (hopefully)
process.stderr.write = save;
return {
report,
stdErr: strErrCapturer.contents.join( "\n" )
};
};