From 24a6b7480bd06bd64876b116089c1e1af258af71 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sat, 4 Aug 2018 19:41:00 +0200 Subject: [PATCH] fix(console): shorten log output --- package-lock.json | 20 +++++++++++++++++++- package.json | 4 +++- ts/tstest.plugins.ts | 5 ++++- ts/tstest.tap.parser.ts | 4 ++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d631f73..3e97683 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "@pushrocks/tstest", + "name": "@gitzone/tstest", "version": "1.0.8", "lockfileVersion": 1, "requires": true, @@ -151,6 +151,11 @@ "@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": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", @@ -397,11 +402,24 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "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": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "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": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", diff --git a/package.json b/package.json index 339548c..44ec487 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "@pushrocks/smartfile": "^6.0.3", "@pushrocks/smartlog": "^2.0.1", "@pushrocks/smartpromise": "^2.0.5", - "@pushrocks/smartshell": "^2.0.5" + "@pushrocks/smartshell": "^2.0.5", + "@types/figures": "^2.0.0", + "figures": "^2.0.0" } } diff --git a/ts/tstest.plugins.ts b/ts/tstest.plugins.ts index 88ae926..b01774c 100644 --- a/ts/tstest.plugins.ts +++ b/ts/tstest.plugins.ts @@ -8,4 +8,7 @@ import * as smartlog from '@pushrocks/smartlog'; import * as smartpromise from '@pushrocks/smartpromise'; 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 }; diff --git a/ts/tstest.tap.parser.ts b/ts/tstest.tap.parser.ts index 3e135ad..c416705 100644 --- a/ts/tstest.tap.parser.ts +++ b/ts/tstest.tap.parser.ts @@ -64,14 +64,14 @@ export class TapParser { if (testOk) { console.log( logPrefixes.TapPrefix, - ` ${cs(`Test ${testId} -> Success!`, 'green')} | ` + + ` ${cs(`T${testId} ${plugins.figures.tick}`, 'green')} | ` + cs(testSubject, 'blue') + ` | ${cs(`${testDuration} milliseconds`, 'orange')}` ); } else { console.log( logPrefixes.TapPrefix, - ` ${cs(`Test ${testId} -> Error!`, 'red')} | ` + + ` ${cs(`T${testId} ${plugins.figures.cross}`, 'red')} | ` + cs(testSubject, 'blue') + ` | ${cs(`${testDuration} milliseconds`, 'orange')}` );