Compare commits

..

6 Commits

Author SHA1 Message Date
033a0a806c 1.0.86 2024-01-19 20:59:02 +01:00
7f87c24ad8 fix(core): update 2024-01-19 20:59:01 +01:00
ac08bdffe5 1.0.85 2023-11-10 12:44:08 +01:00
eb64cb4f71 fix(core): update 2023-11-10 12:44:08 +01:00
3b56c6ce9f 1.0.84 2023-11-09 21:06:07 +01:00
722d777f80 fix(core): update 2023-11-09 21:06:06 +01:00
6 changed files with 288 additions and 226 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@git.zone/tstest",
"version": "1.0.83",
"version": "1.0.86",
"private": false,
"description": "a test utility to run tests that match test/**/*.ts",
"main": "dist_ts/index.js",
@ -20,24 +20,24 @@
"buildDocs": "tsdoc"
},
"devDependencies": {
"@git.zone/tsbuild": "^2.1.70",
"@types/node": "^20.9.0"
"@git.zone/tsbuild": "^2.1.72",
"@types/node": "^20.11.5"
},
"dependencies": {
"@api.global/typedserver": "^3.0.9",
"@git.zone/tsbundle": "^2.0.10",
"@api.global/typedserver": "^3.0.20",
"@git.zone/tsbundle": "^2.0.15",
"@git.zone/tsrun": "^1.2.46",
"@push.rocks/consolecolor": "^2.0.1",
"@push.rocks/smartbrowser": "^2.0.6",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^11.0.0",
"@push.rocks/smartfile": "^11.0.4",
"@push.rocks/smartlog": "^3.0.3",
"@push.rocks/smartpromise": "^4.0.3",
"@push.rocks/smartshell": "^3.0.3",
"@push.rocks/tapbundle": "^5.0.15",
"@types/ws": "^8.5.9",
"@types/ws": "^8.5.10",
"figures": "^6.0.1",
"ws": "^8.14.2"
"ws": "^8.16.0"
},
"files": [
"ts/**/*",

475
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tstest',
version: '1.0.83',
version: '1.0.86',
description: 'a test utility to run tests that match test/**/*.ts'
}

View File

@ -18,6 +18,8 @@ export class TapParser {
testStatusRegex = /(ok|not\sok)\s([0-9]+)\s-\s(.*)\s#\stime=(.*)ms$/;
activeTapTestResult: TapTestResult;
pretaskRegex = /^::__PRETASK:(.*)$/;
/**
* the constructor for TapParser
*/
@ -49,6 +51,12 @@ export class TapParser {
// initiating first TapResult
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)) {
logLineIsTapProtocol = true;
const regexResult = this.testStatusRegex.exec(logLine);
@ -149,7 +157,7 @@ export class TapParser {
this._processLog(data);
});
childProcessArg.on('exit', async () => {
await this._evaluateResult();
await this.evaluateFinalResult();
done.resolve();
});
await done.promise;
@ -157,10 +165,9 @@ export class TapParser {
public async handleTapLog(tapLog: string) {
this._processLog(tapLog);
await this._evaluateResult();
}
private async _evaluateResult() {
public async evaluateFinalResult() {
this.receivedTests = this.testStore.length;
// check wether all tests ran

View File

@ -130,10 +130,11 @@ export class TsTest {
await server.start();
// lets handle realtime comms
const tapParser = new TapParser(fileNameArg + ':chrome');
const wss = new plugins.ws.WebSocketServer({ port: 8080 });
wss.on('connection', (ws) => {
ws.on('message', (message) => {
console.log(message.toString());
tapParser.handleTapLog(message.toString());
});
});
@ -188,10 +189,8 @@ export class TsTest {
console.log(
`${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
const tapParser = new TapParser(fileNameArg + ':chrome');
tapParser.handleTapLog(evaluation);
await tapParser.evaluateFinalResult();
return tapParser;
}

View File

@ -2,6 +2,7 @@ import * as plugins from './tstest.plugins.js';
import { coloredString as cs } from '@push.rocks/consolecolor';
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 TsTestPrefix = cs(`**TSTEST**`, 'pink', 'black');