Use loggingReporter from testSupport

This commit is contained in:
Rob Lourens 2017-04-11 17:18:39 -07:00
Родитель e602e5521a
Коммит 5265820aa8
2 изменённых файлов: 1 добавлений и 45 удалений

Просмотреть файл

@ -61,7 +61,7 @@
"watch:debugadapter": "webpack -w",
"watch:test": "tsc -p test/tsconfig.json -w",
"test": "mocha --timeout 20000 -s 2000 -u tdd --colors \"./out/test/*.test.js\"",
"intTest": "mocha --timeout 20000 -s 3500 -u tdd --colors --reporter out/test/int/loggingReporter.js ./out/test/int/*.test.js",
"intTest": "mocha --timeout 20000 -s 3500 -u tdd --colors --reporter node_modules/vscode-chrome-debug-core-testsupport/out/loggingReporter.js ./out/test/int/*.test.js",
"lint": "tslint -t verbose \"src/**/*.ts\"",
"vscode:prepublish": "gulp verify-no-linked-modules",
"postinstall": "node ./node_modules/vscode/bin/install"

Просмотреть файл

@ -1,44 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as mocha from 'mocha';
import * as events from 'events';
class LoggingReporter extends mocha.reporters.Spec {
static logEE = new events.EventEmitter();
private testLogs: string[];
private inTest = false;
constructor(runner: any) {
super(runner);
LoggingReporter.logEE.on('log', msg => {
if (this.inTest) {
this.testLogs.push(msg);
}
});
runner.on('test', test => {
this.inTest = true;
this.testLogs = [];
});
runner.on('pass', test => {
this.inTest = false;
});
runner.on('fail', test => {
this.inTest = false;
this.testLogs.forEach(msg => {
console.log(msg);
});
console.log(new Date().toISOString().split(/[TZ]/)[1] + ' Finished');
});
}
}
export = LoggingReporter;