mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Remove process.stdout.write workaround
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user