fix(core): update

This commit is contained in:
Philipp Kunz 2020-07-07 23:09:17 +00:00
parent 023176258a
commit 30284b770c
2 changed files with 41 additions and 36 deletions

View File

@ -113,7 +113,7 @@ export class TapParser {
* returns all tests that threw an error * returns all tests that threw an error
*/ */
public getErrorTests() { public getErrorTests() {
return this.testStore.filter(tapTestArg => { return this.testStore.filter((tapTestArg) => {
return !tapTestArg.testOk; return !tapTestArg.testOk;
}); });
} }
@ -140,15 +140,27 @@ export class TapParser {
* handles a tap process * handles a tap process
* @param childProcessArg * @param childProcessArg
*/ */
async handleTapProcess(childProcessArg: ChildProcess) { public async handleTapProcess(childProcessArg: ChildProcess) {
const done = plugins.smartpromise.defer(); const done = plugins.smartpromise.defer();
childProcessArg.stdout.on('data', data => { childProcessArg.stdout.on('data', (data) => {
this._processLog(data); this._processLog(data);
}); });
childProcessArg.stderr.on('data', data => { childProcessArg.stderr.on('data', (data) => {
this._processLog(data); this._processLog(data);
}); });
childProcessArg.on('exit', () => { childProcessArg.on('exit', async () => {
await this._evaluateResult();
done.resolve();
});
await done.promise;
}
public async handleTapLog(tapLog: string) {
this._processLog(tapLog);
await this._evaluateResult();
}
private async _evaluateResult() {
this.receivedTests = this.testStore.length; this.receivedTests = this.testStore.length;
// check wether all tests ran // check wether all tests ran
@ -177,12 +189,5 @@ export class TapParser {
)}` )}`
); );
} }
done.resolve();
});
await done.promise;
}
public handleTapLog(tapLog: string) {
this._processLog(tapLog);
} }
} }

View File

@ -48,6 +48,8 @@ export class TsTest {
break; break;
} }
tapCombinator.addTapParser(tapParser); tapCombinator.addTapParser(tapParser);
console.log(cs(`^`.repeat(16), 'cyan'));
console.log(''); // force new line
} }
tapCombinator.evaluate(); tapCombinator.evaluate();
} }
@ -67,8 +69,6 @@ export class TsTest {
`tsrun ${fileNameArg}${tsrunOptions}` `tsrun ${fileNameArg}${tsrunOptions}`
); );
await tapParser.handleTapProcess(execResultStreaming.childProcess); await tapParser.handleTapProcess(execResultStreaming.childProcess);
console.log(cs(`^`.repeat(16), 'cyan'));
console.log(''); // force new line
return tapParser; return tapParser;
} }