Prevent commands from executing during tests

This commit is contained in:
Josh Gross 2019-10-31 14:02:15 -04:00
parent d676b6c354
commit 50eb90a503

View file

@ -8,4 +8,15 @@ module.exports = {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
const processStdoutWrite = process.stdout.write.bind(process.stdout)
process.stdout.write = (str, encoding, cb) => {
// We don't want :: commands to be executed by the runner during tests
// Replace any :: with :
if (!str.match(/^::/)) {
return processStdoutWrite(str, encoding, cb);
} else {
return processStdoutWrite(str.replace(/::/g, ":"), encoding, cb);
}
}