From 50eb90a50338c9ff706348d12ad08ddad4ae6fc4 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 31 Oct 2019 14:02:15 -0400 Subject: [PATCH] Prevent commands from executing during tests --- jest.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jest.config.js b/jest.config.js index 563d4cc..fa550fc 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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); + } } \ No newline at end of file