Files
codeql-action/lib/testing-utils.js
2020-06-22 17:13:47 +01:00

28 lines
1.0 KiB
JavaScript
Generated

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function silenceDebugOutput(test) {
const typedTest = test;
typedTest.beforeEach(t => {
const processStdoutWrite = process.stdout.write.bind(process.stdout);
t.context.write = processStdoutWrite;
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 (typeof str === "string") {
str = str.replace(/::(info|debug|warning).*/, '');
if (str.trim() !== "") {
processStdoutWrite(str, encoding, cb);
}
}
else {
processStdoutWrite(str, encoding, cb);
}
return true;
};
});
typedTest.afterEach(t => {
process.stdout.write = t.context.write;
});
}
exports.silenceDebugOutput = silenceDebugOutput;
//# sourceMappingURL=testing-utils.js.map