Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
a6ecf1d530 | |||
22703f261c | |||
289cc6c0df | |||
97d0ebffec | |||
da19d5de39 | |||
7380323186 | |||
7a6923051f | |||
0bac34dd37 | |||
e10d9eb2a7 | |||
c5596f1a8f | |||
ac0bb6f9b0 | |||
32db50ef1f | |||
a35db70155 | |||
0286312855 | |||
40cf6f72ce | |||
e6c71a1350 | |||
1c640b8545 | |||
8c4b591391 | |||
8eb270ebbc | |||
f6d47a1a67 | |||
2a41acc6e4 | |||
fb6bb85441 | |||
02dbe602b2 | |||
e17d7009d9 | |||
d22534388d | |||
e258b2d62e | |||
5afe6e6981 | |||
5d071d0299 | |||
180bfcb353 | |||
3161e6b4eb | |||
6129388a20 | |||
8f0cfe1a06 | |||
39926fb08b | |||
36594b64f2 | |||
9f898b6579 | |||
b1725b636b |
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,6 +1,20 @@
|
|||||||
.nogit/
|
.nogit/
|
||||||
node_modules/
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
.yarn/
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
137
.gitlab-ci.yml
137
.gitlab-ci.yml
@ -1,16 +1,16 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .npmci_cache/
|
- .npmci_cache/
|
||||||
key: "$CI_BUILD_STAGE"
|
key: '$CI_BUILD_STAGE'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- security
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
@ -18,109 +18,104 @@ stages:
|
|||||||
mirror:
|
mirror:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
snyk:
|
audit:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g snyk
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci node install legacy
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci node install stable
|
||||||
- npmci npm test
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- priv
|
||||||
testSTABLE:
|
|
||||||
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci node install stable
|
||||||
- npmci npm test
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm publish
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# metadata stage
|
# metadata stage
|
||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
script:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm install -g tslint typescript
|
||||||
- docker run
|
- npmci npm prepare
|
||||||
--env SOURCE_CODE="$PWD"
|
- npmci npm install
|
||||||
--volume "$PWD":/code
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
artifacts:
|
|
||||||
paths: [codeclimate.json]
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- priv
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci node install lts
|
||||||
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
only:
|
only:
|
||||||
@ -128,15 +123,5 @@ pages:
|
|||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
windowsCompatibility:
|
|
||||||
image: stefanscherer/node-windows:10-build-tools
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npm install & npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- windows
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "current file",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"${relativeFile}"
|
||||||
|
],
|
||||||
|
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "test.ts",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"test/test.ts"
|
||||||
|
],
|
||||||
|
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
.vscode/settings.json
vendored
Normal file
26
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"json.schemas": [
|
||||||
|
{
|
||||||
|
"fileMatch": ["/npmextra.json"],
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"npmci": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for npmci"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
3
contribute.md
Normal file
3
contribute.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# How to contribute
|
||||||
|
|
||||||
|
Start with `tstest.classes.tstest.ts` to understand whats happening
|
@ -2,5 +2,16 @@
|
|||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "gitzone",
|
||||||
|
"gitrepo": "tstest",
|
||||||
|
"shortDescription": "a test utility to run tests that match test/**/*.ts",
|
||||||
|
"npmPackagename": "@gitzone/tstest",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
3451
package-lock.json
generated
3451
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tstest",
|
"name": "@gitzone/tstest",
|
||||||
"version": "1.0.13",
|
"version": "1.0.31",
|
||||||
"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_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -19,17 +19,30 @@
|
|||||||
"build": "(tsbuild)"
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.21",
|
"@gitzone/tsbuild": "^2.1.17",
|
||||||
"@pushrocks/tapbundle": "^3.0.1"
|
"@pushrocks/tapbundle": "^3.0.13"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gitzone/tsrun": "^1.1.11",
|
"@gitzone/tsbundle": "^1.0.69",
|
||||||
|
"@gitzone/tsrun": "^1.2.12",
|
||||||
"@pushrocks/consolecolor": "^2.0.1",
|
"@pushrocks/consolecolor": "^2.0.1",
|
||||||
"@pushrocks/smartfile": "^6.0.6",
|
"@pushrocks/smartfile": "^7.0.6",
|
||||||
"@pushrocks/smartlog": "^2.0.1",
|
"@pushrocks/smartlog": "^2.0.19",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"@pushrocks/smartshell": "^2.0.6",
|
"@pushrocks/smartshell": "^2.0.25",
|
||||||
"@types/figures": "^2.0.0",
|
"@types/figures": "^3.0.1",
|
||||||
"figures": "^2.0.0"
|
"figures": "^3.0.0"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
38
readme.md
Normal file
38
readme.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# @gitzone/tstest
|
||||||
|
a test utility to run tests that match test/**/*.ts
|
||||||
|
|
||||||
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tstest)
|
||||||
|
* [gitlab.com (source)](https://gitlab.com/gitzone/tstest)
|
||||||
|
* [github.com (source mirror)](https://github.com/gitzone/tstest)
|
||||||
|
* [docs (typedoc)](https://gitzone.gitlab.io/tstest/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
|
||||||
|
Status Category | Status Badge
|
||||||
|
-- | --
|
||||||
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
|
npm | [](https://lossless.cloud)
|
||||||
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
|
||||||
|
## Contribution
|
||||||
|
|
||||||
|
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
@ -4,7 +4,7 @@
|
|||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins';
|
||||||
import { coloredString as cs } from '@pushrocks/consolecolor';
|
import { coloredString as cs } from '@pushrocks/consolecolor';
|
||||||
|
|
||||||
import { TapParser } from './tstest.tap.parser';
|
import { TapParser } from './tstest.classes.tap.parser';
|
||||||
import * as logPrefixes from './tstest.logprefixes';
|
import * as logPrefixes from './tstest.logprefixes';
|
||||||
|
|
||||||
export class TapCombinator {
|
export class TapCombinator {
|
||||||
@ -14,35 +14,35 @@ export class TapCombinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
evaluate() {
|
evaluate() {
|
||||||
console.log(`${logPrefixes.TsTestPrefix} Ran ${this.tapParserStore.length} Testfiles!`);
|
console.log(
|
||||||
console.log(`${logPrefixes.TsTestPrefix} Here are the overall results:`);
|
`${logPrefixes.TsTestPrefix} RESULTS FOR ${this.tapParserStore.length} TESTFILE(S):`
|
||||||
|
);
|
||||||
|
|
||||||
let failGlobal = false; // determine wether tstest should fail
|
let failGlobal = false; // determine wether tstest should fail
|
||||||
for (const tapParser of this.tapParserStore) {
|
for (const tapParser of this.tapParserStore) {
|
||||||
if(tapParser.getErrorTests().length === 0) {
|
if (tapParser.getErrorTests().length === 0) {
|
||||||
console.log(
|
let overviewString =
|
||||||
logPrefixes.TsTestPrefix +
|
logPrefixes.TsTestPrefix +
|
||||||
cs(` ${tapParser.fileName} ${plugins.figures.tick}`, 'green') +
|
cs(` ${tapParser.fileName} ${plugins.figures.tick}`, 'green') +
|
||||||
' | ' +
|
` ${plugins.figures.pointer} ` +
|
||||||
cs(` all tests completed successfully!`, 'blue')
|
tapParser.getTestOverviewAsString();
|
||||||
)
|
console.log(overviewString);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
let overviewString =
|
||||||
logPrefixes.TsTestPrefix +
|
logPrefixes.TsTestPrefix +
|
||||||
cs(` ${tapParser.fileName} ${plugins.figures.cross}`, 'red') +
|
cs(` ${tapParser.fileName} ${plugins.figures.cross}`, 'red') +
|
||||||
' | ' +
|
` ${plugins.figures.pointer} ` +
|
||||||
cs(` Errors ocurred, please check for the logs!`, 'blue')
|
tapParser.getTestOverviewAsString();
|
||||||
);
|
console.log(overviewString);
|
||||||
failGlobal = true;
|
failGlobal = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(cs('-'.repeat(16), 'cyan'));
|
console.log(cs(plugins.figures.hamburger.repeat(48), 'cyan'));
|
||||||
console.log(cs('*'.repeat(16), 'cyan'));
|
if (!failGlobal) {
|
||||||
console.log(cs('-'.repeat(16), 'cyan'));
|
console.log(cs('FINAL RESULT: SUCCESS!', 'green'));
|
||||||
if(!failGlobal) {
|
|
||||||
console.log(cs('Ending with code 0: TESTS ARE PASSING!', 'green'));
|
|
||||||
} else {
|
} else {
|
||||||
console.log(cs('Ending with code 1: TESTS ARE FAILING!', 'red'));
|
console.log(cs('FINAL RESULT: FAIL!', 'red'));
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,13 +5,13 @@ import { coloredString as cs } from '@pushrocks/consolecolor';
|
|||||||
// combines different tap test files to an overall result
|
// combines different tap test files to an overall result
|
||||||
// ============
|
// ============
|
||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins';
|
||||||
import { TapTestResult } from './tstest.tap.testresult';
|
import { TapTestResult } from './tstest.classes.tap.testresult';
|
||||||
import * as logPrefixes from './tstest.logprefixes';
|
import * as logPrefixes from './tstest.logprefixes';
|
||||||
|
|
||||||
export class TapParser {
|
export class TapParser {
|
||||||
testStore: TapTestResult[] = [];
|
testStore: TapTestResult[] = [];
|
||||||
|
|
||||||
expectedTestsRegex = /([0-9]*)\.\.([0-9]*)/;
|
expectedTestsRegex = /([0-9]*)\.\.([0-9]*)$/;
|
||||||
expectedTests: number;
|
expectedTests: number;
|
||||||
receivedTests: number;
|
receivedTests: number;
|
||||||
|
|
||||||
@ -23,7 +23,6 @@ export class TapParser {
|
|||||||
*/
|
*/
|
||||||
constructor(public fileName: string) {}
|
constructor(public fileName: string) {}
|
||||||
|
|
||||||
|
|
||||||
private _getNewTapTestResult() {
|
private _getNewTapTestResult() {
|
||||||
this.activeTapTestResult = new TapTestResult(this.testStore.length + 1);
|
this.activeTapTestResult = new TapTestResult(this.testStore.length + 1);
|
||||||
}
|
}
|
||||||
@ -45,10 +44,7 @@ export class TapParser {
|
|||||||
const regexResult = this.expectedTestsRegex.exec(logLine);
|
const regexResult = this.expectedTestsRegex.exec(logLine);
|
||||||
this.expectedTests = parseInt(regexResult[2]);
|
this.expectedTests = parseInt(regexResult[2]);
|
||||||
console.log(
|
console.log(
|
||||||
`${logPrefixes.TapPrefix} ${cs(
|
`${logPrefixes.TapPrefix} ${cs(`Expecting ${this.expectedTests} tests!`, 'blue')}`
|
||||||
`Expecting ${this.expectedTests} tests!`,
|
|
||||||
'blue'
|
|
||||||
)}`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// initiating first TapResult
|
// initiating first TapResult
|
||||||
@ -70,9 +66,7 @@ export class TapParser {
|
|||||||
// test for protocol error
|
// test for protocol error
|
||||||
if (testId !== this.activeTapTestResult.id) {
|
if (testId !== this.activeTapTestResult.id) {
|
||||||
console.log(
|
console.log(
|
||||||
`${
|
`${logPrefixes.TapErrorPrefix} Something is strange! Test Ids are not equal!`
|
||||||
logPrefixes.TapErrorPrefix
|
|
||||||
} Something is strange! Test Ids are not equal!`
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.activeTapTestResult.setTestResult(testOk);
|
this.activeTapTestResult.setTestResult(testOk);
|
||||||
@ -80,14 +74,14 @@ export class TapParser {
|
|||||||
if (testOk) {
|
if (testOk) {
|
||||||
console.log(
|
console.log(
|
||||||
logPrefixes.TapPrefix,
|
logPrefixes.TapPrefix,
|
||||||
`${cs(`T${testId} ${plugins.figures.tick}`, 'green')} | ` +
|
`${cs(`T${testId} ${plugins.figures.tick}`, 'green')} ${plugins.figures.arrowRight} ` +
|
||||||
cs(testSubject, 'blue') +
|
cs(testSubject, 'blue') +
|
||||||
` | ${cs(`${testDuration} ms`, 'orange')}`
|
` | ${cs(`${testDuration} ms`, 'orange')}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
logPrefixes.TapPrefix,
|
logPrefixes.TapPrefix,
|
||||||
`${cs(`T${testId} ${plugins.figures.cross}`, 'red')} | ` +
|
`${cs(`T${testId} ${plugins.figures.cross}`, 'red')} ${plugins.figures.arrowRight} ` +
|
||||||
cs(testSubject, 'blue') +
|
cs(testSubject, 'blue') +
|
||||||
` | ${cs(`${testDuration} ms`, 'orange')}`
|
` | ${cs(`${testDuration} ms`, 'orange')}`
|
||||||
);
|
);
|
||||||
@ -124,6 +118,28 @@ export class TapParser {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns a test overview as string
|
||||||
|
*/
|
||||||
|
getTestOverviewAsString() {
|
||||||
|
let overviewString = '';
|
||||||
|
for (let test of this.testStore) {
|
||||||
|
if (overviewString !== '') {
|
||||||
|
overviewString += ' | ';
|
||||||
|
}
|
||||||
|
if (test.testOk) {
|
||||||
|
overviewString += cs(`T${test.id} ${plugins.figures.tick}`, 'green');
|
||||||
|
} else {
|
||||||
|
overviewString += cs(`T${test.id} ${plugins.figures.cross}`, 'red');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return overviewString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* handles a tap process
|
||||||
|
* @param childProcessArg
|
||||||
|
*/
|
||||||
async handleTapProcess(childProcessArg: ChildProcess) {
|
async handleTapProcess(childProcessArg: ChildProcess) {
|
||||||
const done = plugins.smartpromise.defer();
|
const done = plugins.smartpromise.defer();
|
||||||
childProcessArg.stdout.on('data', data => {
|
childProcessArg.stdout.on('data', data => {
|
||||||
@ -139,29 +155,20 @@ export class TapParser {
|
|||||||
if (this.expectedTests === this.receivedTests) {
|
if (this.expectedTests === this.receivedTests) {
|
||||||
console.log(
|
console.log(
|
||||||
`${logPrefixes.TapPrefix} ${cs(
|
`${logPrefixes.TapPrefix} ${cs(
|
||||||
`${this.receivedTests} out of ${
|
`${this.receivedTests} out of ${this.expectedTests} Tests completed!`,
|
||||||
this.expectedTests
|
|
||||||
} Tests completed!`,
|
|
||||||
'green'
|
'green'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
`${logPrefixes.TapErrorPrefix} ${cs(
|
`${logPrefixes.TapErrorPrefix} ${cs(
|
||||||
`Only ${this.receivedTests} out of ${
|
`Only ${this.receivedTests} out of ${this.expectedTests} completed!`,
|
||||||
this.expectedTests
|
|
||||||
} completed!`,
|
|
||||||
'red'
|
'red'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (this.getErrorTests().length === 0) {
|
if (this.getErrorTests().length === 0) {
|
||||||
console.log(
|
console.log(`${logPrefixes.TapPrefix} ${cs(`All tests are successfull!!!`, 'green')}`);
|
||||||
`${logPrefixes.TapPrefix} ${cs(
|
|
||||||
`All tests are successfull!!!`,
|
|
||||||
'green'
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
`${logPrefixes.TapPrefix} ${cs(
|
`${logPrefixes.TapPrefix} ${cs(
|
@ -3,9 +3,9 @@ import * as paths from './tstest.paths';
|
|||||||
import { Smartfile } from '@pushrocks/smartfile';
|
import { Smartfile } from '@pushrocks/smartfile';
|
||||||
|
|
||||||
// tap related stuff
|
// tap related stuff
|
||||||
import { TapCombinator } from './tstest.tap.combinator';
|
import { TapCombinator } from './tstest.classes.tap.combinator';
|
||||||
import { TapParser } from './tstest.tap.parser';
|
import { TapParser } from './tstest.classes.tap.parser';
|
||||||
import { TapTestResult } from './tstest.tap.testresult';
|
import { TapTestResult } from './tstest.classes.tap.testresult';
|
||||||
|
|
||||||
export class TestDirectory {
|
export class TestDirectory {
|
||||||
/**
|
/**
|
||||||
@ -41,7 +41,7 @@ export class TestDirectory {
|
|||||||
private async _init() {
|
private async _init() {
|
||||||
this.testfileArray = await plugins.smartfile.fs.fileTreeToObject(
|
this.testfileArray = await plugins.smartfile.fs.fileTreeToObject(
|
||||||
plugins.path.join(this.cwd, this.relativePath),
|
plugins.path.join(this.cwd, this.relativePath),
|
||||||
'**/*.ts'
|
'test*.ts'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import * as logPrefixes from './tstest.logprefixes';
|
|||||||
import { coloredString as cs } from '@pushrocks/consolecolor';
|
import { coloredString as cs } from '@pushrocks/consolecolor';
|
||||||
|
|
||||||
import { TestDirectory } from './tstest.classes.testdirectory';
|
import { TestDirectory } from './tstest.classes.testdirectory';
|
||||||
import { TapCombinator } from './tstest.tap.combinator';
|
import { TapCombinator } from './tstest.classes.tap.combinator';
|
||||||
import { TapParser } from './tstest.tap.parser';
|
import { TapParser } from './tstest.classes.tap.parser';
|
||||||
|
|
||||||
export class TsTest {
|
export class TsTest {
|
||||||
testDir: TestDirectory;
|
testDir: TestDirectory;
|
||||||
@ -17,11 +17,13 @@ export class TsTest {
|
|||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const fileNamesToRun: string[] = await this.testDir.getTestFilePathArray();
|
const fileNamesToRun: string[] = await this.testDir.getTestFilePathArray();
|
||||||
console.log(`${logPrefixes.TsTestPrefix} Found ${fileNamesToRun.length} Testfile(s):`);
|
console.log(cs(plugins.figures.hamburger.repeat(80), 'cyan'));
|
||||||
|
console.log('');
|
||||||
|
console.log(`${logPrefixes.TsTestPrefix} FOUND ${fileNamesToRun.length} TESTFILE(S):`);
|
||||||
for (const fileName of fileNamesToRun) {
|
for (const fileName of fileNamesToRun) {
|
||||||
console.log(`${logPrefixes.TsTestPrefix} ${cs(fileName, 'orange')}`);
|
console.log(`${logPrefixes.TsTestPrefix} ${cs(fileName, 'orange')}`);
|
||||||
}
|
}
|
||||||
console.log('-'.repeat(16));
|
console.log('-'.repeat(48));
|
||||||
console.log(''); // force new line
|
console.log(''); // force new line
|
||||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
executor: 'bash',
|
executor: 'bash',
|
||||||
@ -33,7 +35,16 @@ export class TsTest {
|
|||||||
console.log(`${cs('=> ', 'blue')} Running ${cs(fileName, 'orange')}`);
|
console.log(`${cs('=> ', 'blue')} Running ${cs(fileName, 'orange')}`);
|
||||||
console.log(cs(`=`.repeat(16), 'cyan'));
|
console.log(cs(`=`.repeat(16), 'cyan'));
|
||||||
const tapParser = new TapParser(fileName);
|
const tapParser = new TapParser(fileName);
|
||||||
const execResultStreaming = await smartshellInstance.execStreamingSilent(`tsrun ${fileName}`);
|
|
||||||
|
// tsrun options
|
||||||
|
let tsrunOptions = '';
|
||||||
|
if (process.argv.includes('--web')) {
|
||||||
|
tsrunOptions += ' --web';
|
||||||
|
}
|
||||||
|
|
||||||
|
const execResultStreaming = await smartshellInstance.execStreamingSilent(
|
||||||
|
`tsrun ${fileName}${tsrunOptions}`
|
||||||
|
);
|
||||||
await tapParser.handleTapProcess(execResultStreaming.childProcess);
|
await tapParser.handleTapProcess(execResultStreaming.childProcess);
|
||||||
console.log(cs(`^`.repeat(16), 'cyan'));
|
console.log(cs(`^`.repeat(16), 'cyan'));
|
||||||
console.log(''); // force new line
|
console.log(''); // force new line
|
||||||
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user