Compare commits

...

6 Commits

Author SHA1 Message Date
addf9e51e9 1.0.9 2018-08-04 19:41:01 +02:00
24a6b7480b fix(console): shorten log output 2018-08-04 19:41:00 +02:00
953a4e4b72 1.0.8 2018-08-04 19:23:17 +02:00
e7192800ea fix(improve log output): update 2018-08-04 19:23:17 +02:00
1516f843aa 1.0.7 2018-08-04 17:19:24 +02:00
f29558d6d1 fix(package): fix packagename 2018-08-04 17:19:24 +02:00
5 changed files with 50 additions and 10 deletions

22
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/tstest", "name": "@gitzone/tstest",
"version": "1.0.6", "version": "1.0.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -151,6 +151,11 @@
"@types/chai": "*" "@types/chai": "*"
} }
}, },
"@types/figures": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/figures/-/figures-2.0.0.tgz",
"integrity": "sha512-mcRgJ+ncKuNI+Dwac7omO18B8C8u+YBS+AU/oyLhEyjAnT3cUUThhHgZpbiIvu5ZqSvdD30BXtrqg9nxc3OKMg=="
},
"@types/form-data": { "@types/form-data": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz",
@ -397,11 +402,24 @@
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
"dev": true "dev": true
}, },
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"esprima": { "esprima": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
}, },
"figures": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
"integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
"requires": {
"escape-string-regexp": "^1.0.5"
}
},
"first-chunk-stream": { "first-chunk-stream": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/tstest", "name": "@gitzone/tstest",
"version": "1.0.6", "version": "1.0.9",
"private": false, "private": false,
"description": "a test utility to run tests that match test/**/*.ts", "description": "a test utility to run tests that match test/**/*.ts",
"main": "dist/index.js", "main": "dist/index.js",
@ -28,6 +28,8 @@
"@pushrocks/smartfile": "^6.0.3", "@pushrocks/smartfile": "^6.0.3",
"@pushrocks/smartlog": "^2.0.1", "@pushrocks/smartlog": "^2.0.1",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^2.0.5",
"@pushrocks/smartshell": "^2.0.5" "@pushrocks/smartshell": "^2.0.5",
"@types/figures": "^2.0.0",
"figures": "^2.0.0"
} }
} }

View File

@ -20,6 +20,7 @@ export class TsTest {
console.log(cs(fileName, 'orange')); console.log(cs(fileName, 'orange'));
} }
console.log('-'.repeat(16)); console.log('-'.repeat(16));
console.log(''); // force new line
const smartshellInstance = new plugins.smartshell.Smartshell({ const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash', executor: 'bash',
pathDirectories: [paths.binDirectory], pathDirectories: [paths.binDirectory],
@ -28,10 +29,12 @@ export class TsTest {
const tapCombinator = new TapCombinator(); // lets create the TapCombinator const tapCombinator = new TapCombinator(); // lets create the TapCombinator
for (const fileName of fileNamesToRun) { for (const fileName of fileNamesToRun) {
console.log(`${cs('=> ', 'blue')} Running ${cs(fileName, 'orange')}`); console.log(`${cs('=> ', 'blue')} Running ${cs(fileName, 'orange')}`);
console.log(`=`.repeat(16)); console.log(cs(`=`.repeat(16), 'cyan'));
const tapParser = new TapParser(); const tapParser = new TapParser();
const execResultStreaming = await smartshellInstance.execStreamingSilent(`tsrun ${fileName}`); const execResultStreaming = await smartshellInstance.execStreamingSilent(`tsrun ${fileName}`);
await tapParser.handleTapProcess(execResultStreaming.childProcess); await tapParser.handleTapProcess(execResultStreaming.childProcess);
console.log(cs(`^`.repeat(16), 'cyan'));
console.log(''); // force new line
tapCombinator.addTapParser(tapParser); tapCombinator.addTapParser(tapParser);
} }
tapCombinator.evaluate(); tapCombinator.evaluate();

View File

@ -8,4 +8,7 @@ import * as smartlog from '@pushrocks/smartlog';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartshell from '@pushrocks/smartshell'; import * as smartshell from '@pushrocks/smartshell';
export { consolecolor, path, smartfile, smartlog, smartpromise, smartshell }; // sindresorhus
import * as figures from 'figures';
export { consolecolor, figures, path, smartfile, smartlog, smartpromise, smartshell };

View File

@ -6,6 +6,7 @@ import { coloredString as cs } from '@pushrocks/consolecolor';
// ============ // ============
import * as plugins from './tstest.plugins'; import * as plugins from './tstest.plugins';
import { TapTestResult } from './tstest.tap.testresult'; import { TapTestResult } from './tstest.tap.testresult';
import * as logPrefixes from './tstest.logprefixes';
export class TapParser { export class TapParser {
resultStore: TapTestResult[] = []; resultStore: TapTestResult[] = [];
@ -13,7 +14,7 @@ export class TapParser {
expectedTestsRegex = /([0-9]*)\.\.([0-9]*)/; expectedTestsRegex = /([0-9]*)\.\.([0-9]*)/;
expectedTests: number; expectedTests: number;
testStatusRegex = /(ok|not\sok)\s([0-9]+)\s-\s/; testStatusRegex = /(ok|not\sok)\s([0-9]+)\s-\s(.*)\s#\stime=(.*)ms$/;
activeTapTestResult: TapTestResult; activeTapTestResult: TapTestResult;
private _getNewTapTestResult() { private _getNewTapTestResult() {
@ -51,6 +52,9 @@ export class TapParser {
return false; return false;
})(); })();
const testSubject = regexResult[3];
const testDuration = parseInt(regexResult[4]);
// test for protocol error // test for protocol error
if (testId !== this.activeTapTestResult.id) { if (testId !== this.activeTapTestResult.id) {
console.log(`:::TAP PROTOCOL ERROR::: Something is strange! Test Ids are not equal!`); console.log(`:::TAP PROTOCOL ERROR::: Something is strange! Test Ids are not equal!`);
@ -58,9 +62,19 @@ export class TapParser {
this.activeTapTestResult.setTestResult(testOk); this.activeTapTestResult.setTestResult(testOk);
if (testOk) { if (testOk) {
console.log(cs(`:::TAP::: Success: Test ${testId} is ok!`, 'green', 'black')); console.log(
logPrefixes.TapPrefix,
` ${cs(`T${testId} ${plugins.figures.tick}`, 'green')} | ` +
cs(testSubject, 'blue') +
` | ${cs(`${testDuration} milliseconds`, 'orange')}`
);
} else { } else {
console.log(cs(`:::TAP::: Error: Test ${testId} is NOT ok!`, 'green', 'black')); console.log(
logPrefixes.TapPrefix,
` ${cs(`T${testId} ${plugins.figures.cross}`, 'red')} | ` +
cs(testSubject, 'blue') +
` | ${cs(`${testDuration} milliseconds`, 'orange')}`
);
} }
} }