fix(core): update
This commit is contained in:
parent
f1a0455662
commit
722d777f80
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tstest',
|
name: '@git.zone/tstest',
|
||||||
version: '1.0.83',
|
version: '1.0.84',
|
||||||
description: 'a test utility to run tests that match test/**/*.ts'
|
description: 'a test utility to run tests that match test/**/*.ts'
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ export class TapParser {
|
|||||||
testStatusRegex = /(ok|not\sok)\s([0-9]+)\s-\s(.*)\s#\stime=(.*)ms$/;
|
testStatusRegex = /(ok|not\sok)\s([0-9]+)\s-\s(.*)\s#\stime=(.*)ms$/;
|
||||||
activeTapTestResult: TapTestResult;
|
activeTapTestResult: TapTestResult;
|
||||||
|
|
||||||
|
pretaskRegex = /^::__PRETASK:(.*)$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the constructor for TapParser
|
* the constructor for TapParser
|
||||||
*/
|
*/
|
||||||
@ -49,6 +51,12 @@ export class TapParser {
|
|||||||
|
|
||||||
// initiating first TapResult
|
// initiating first TapResult
|
||||||
this._getNewTapTestResult();
|
this._getNewTapTestResult();
|
||||||
|
} else if (this.pretaskRegex.test(logLine)) {
|
||||||
|
logLineIsTapProtocol = true;
|
||||||
|
const pretaskContentMatch = this.pretaskRegex.exec(logLine);
|
||||||
|
if (pretaskContentMatch && pretaskContentMatch[1]) {
|
||||||
|
console.log(`${logPrefixes.TapPretaskPrefix} Pretask ->${pretaskContentMatch[1]}: Success.`);
|
||||||
|
}
|
||||||
} else if (this.testStatusRegex.test(logLine)) {
|
} else if (this.testStatusRegex.test(logLine)) {
|
||||||
logLineIsTapProtocol = true;
|
logLineIsTapProtocol = true;
|
||||||
const regexResult = this.testStatusRegex.exec(logLine);
|
const regexResult = this.testStatusRegex.exec(logLine);
|
||||||
@ -149,7 +157,7 @@ export class TapParser {
|
|||||||
this._processLog(data);
|
this._processLog(data);
|
||||||
});
|
});
|
||||||
childProcessArg.on('exit', async () => {
|
childProcessArg.on('exit', async () => {
|
||||||
await this._evaluateResult();
|
await this.evaluateFinalResult();
|
||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
await done.promise;
|
await done.promise;
|
||||||
@ -157,10 +165,9 @@ export class TapParser {
|
|||||||
|
|
||||||
public async handleTapLog(tapLog: string) {
|
public async handleTapLog(tapLog: string) {
|
||||||
this._processLog(tapLog);
|
this._processLog(tapLog);
|
||||||
await this._evaluateResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _evaluateResult() {
|
public async evaluateFinalResult() {
|
||||||
this.receivedTests = this.testStore.length;
|
this.receivedTests = this.testStore.length;
|
||||||
|
|
||||||
// check wether all tests ran
|
// check wether all tests ran
|
||||||
|
@ -130,10 +130,11 @@ export class TsTest {
|
|||||||
await server.start();
|
await server.start();
|
||||||
|
|
||||||
// lets handle realtime comms
|
// lets handle realtime comms
|
||||||
|
const tapParser = new TapParser(fileNameArg + ':chrome');
|
||||||
const wss = new plugins.ws.WebSocketServer({ port: 8080 });
|
const wss = new plugins.ws.WebSocketServer({ port: 8080 });
|
||||||
wss.on('connection', (ws) => {
|
wss.on('connection', (ws) => {
|
||||||
ws.on('message', (message) => {
|
ws.on('message', (message) => {
|
||||||
console.log(message.toString());
|
tapParser.handleTapLog(message.toString());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -188,10 +189,8 @@ export class TsTest {
|
|||||||
console.log(
|
console.log(
|
||||||
`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} chromium instance and server.`
|
`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} chromium instance and server.`
|
||||||
);
|
);
|
||||||
console.log(`${cs('=> ', 'blue')} See the result captured from the chromium execution:`);
|
|
||||||
// lets create the tap parser
|
// lets create the tap parser
|
||||||
const tapParser = new TapParser(fileNameArg + ':chrome');
|
await tapParser.evaluateFinalResult();
|
||||||
tapParser.handleTapLog(evaluation);
|
|
||||||
return tapParser;
|
return tapParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import * as plugins from './tstest.plugins.js';
|
|||||||
import { coloredString as cs } from '@push.rocks/consolecolor';
|
import { coloredString as cs } from '@push.rocks/consolecolor';
|
||||||
|
|
||||||
export const TapPrefix = cs(`::TAP::`, 'pink', 'black');
|
export const TapPrefix = cs(`::TAP::`, 'pink', 'black');
|
||||||
|
export const TapPretaskPrefix = cs(`::PRETASK::`, 'cyan', 'black');
|
||||||
export const TapErrorPrefix = cs(` !!!TAP PROTOCOL ERROR!!! `, 'red', 'black');
|
export const TapErrorPrefix = cs(` !!!TAP PROTOCOL ERROR!!! `, 'red', 'black');
|
||||||
|
|
||||||
export const TsTestPrefix = cs(`**TSTEST**`, 'pink', 'black');
|
export const TsTestPrefix = cs(`**TSTEST**`, 'pink', 'black');
|
||||||
|
Loading…
Reference in New Issue
Block a user