Remove process.stdout.write workaround

This commit is contained in:
Pine Wu
2019-05-23 17:07:10 -07:00
parent 794212ec5c
commit 40f99ab07d
2 changed files with 0 additions and 41 deletions

View File

@ -1,40 +0,0 @@
import * as path from 'path';
import * as Mocha from 'mocha';
export function run(testsRoot: string, cb: (error: any, failures?: number) => void): void {
let mocha = new Mocha({
ui: 'tdd'
});
mocha.reporter('spec');
mocha.useColors(true);
const files = [path.resolve(__dirname, '../../out/test/suite/extension.test.js')];
files.forEach(f => mocha.addFile(f));
try {
let stdOutMessages = '';
const processStdoutWrite = process.stdout.write;
process.stdout.write = (message: string | Buffer) => {
if (typeof message !== 'string') {
message = message.toString();
}
stdOutMessages += message;
return true;
};
mocha
.run(failures => {
cb(null, failures);
})
.on('test end', () => {
process.stdout.write = processStdoutWrite;
console.log('\n' + stdOutMessages + '\n');
});
} catch (err) {
cb(err);
}
}

View File

@ -6,7 +6,6 @@ export function run(testsRoot: string, cb: (error: any, failures?: number) => vo
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
timeout: 10000
});
mocha.useColors(true);