Skip to content

Commit

Permalink
Prevent commands from executing during tests (#21)
Browse files Browse the repository at this point in the history
* Prevent commands from executing during tests

* Add newline at end of file

* Drop all commands from output
  • Loading branch information
Josh Gross authored and GitHub committed Oct 31, 2019
1 parent d676b6c commit 526c940
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ module.exports = {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}

const processStdoutWrite = process.stdout.write.bind(process.stdout)
process.stdout.write = (str, encoding, cb) => {
// Core library will directly call process.stdout.write for commands
// We don't want :: commands to be executed by the runner during tests
if (!str.match(/^::/)) {
return processStdoutWrite(str, encoding, cb);
}
}

0 comments on commit 526c940

Please sign in to comment.