fix(core): update

This commit is contained in:
Philipp Kunz 2021-01-26 02:35:02 +00:00
parent 715108b11b
commit 1eaf1e9a77
7 changed files with 2174 additions and 1656 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless - lossless
- docker - docker
- notpriv - notpriv
audit: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high - npmci command npm audit --audit-level=high --only=dev
tags: tags:
- lossless
- docker - docker
- notpriv allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -85,6 +93,8 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm"] "enum": ["website", "element", "service", "npm", "wcc"]
} }
} }
} }

3766
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,19 +20,19 @@
}, },
"homepage": "https://gitlab.com/pushrocks/tapbundle#README", "homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.9", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.10", "@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.1.3",
"@pushrocks/smarttime": "^3.0.19", "@pushrocks/smarttime": "^3.0.38",
"smartchai": "^2.0.1" "smartchai": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsrun": "^1.2.12", "@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.41", "@gitzone/tstest": "^1.0.52",
"@types/node": "^14.0.22", "@types/node": "^14.14.22",
"randomstring": "^1.1.5", "randomstring": "^1.1.5",
"tslint": "^6.1.2", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"files": [ "files": [
@ -50,4 +50,4 @@
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ]
} }

View File

@ -15,9 +15,11 @@ const test2 = tap.test('my second test', async (tools) => {
const test3 = tap.test( const test3 = tap.test(
'my third test -> test2 should take longer than test1 and endure at least 1000ms', 'my third test -> test2 should take longer than test1 and endure at least 1000ms',
async () => { async () => {
expect((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).to expect(
.be.true; (await test1.testPromise).hrtMeasurement.milliSeconds <
expect((await test2).hrtMeasurement.milliSeconds > 1000).to.be.true; (await test2).hrtMeasurement.milliSeconds
).to.be.true;
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 1000).to.be.true;
} }
); );

View File

@ -34,7 +34,7 @@ export class Tap {
* @param testDescription - A description of what the test does * @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects * @param testFunction - A Function that returns a Promise and resolves or rejects
*/ */
public async test( public test(
testDescription: string, testDescription: string,
testFunction: ITestFunction, testFunction: ITestFunction,
modeArg: 'normal' | 'only' | 'skip' = 'normal' modeArg: 'normal' | 'only' | 'skip' = 'normal'

View File

@ -20,8 +20,10 @@ export class TapTest {
public tapTools: TapTools; public tapTools: TapTools;
public testFunction: ITestFunction; public testFunction: ITestFunction;
public testKey: number; // the testKey the position in the test qeue. Set upon calling .run() public testKey: number; // the testKey the position in the test qeue. Set upon calling .run()
public testDeferred: Deferred<TapTest> = plugins.smartpromise.defer(); private testDeferred: Deferred<TapTest> = plugins.smartpromise.defer();
public testPromise: Promise<TapTest> = this.testDeferred.promise; public testPromise: Promise<TapTest> = this.testDeferred.promise;
private testResultDeferred: Deferred<any> = plugins.smartpromise.defer();
public testResultPromise: Promise<any> = this.testResultDeferred.promise;
/** /**
* constructor * constructor
*/ */
@ -42,7 +44,7 @@ export class TapTest {
this.testKey = testKeyArg; this.testKey = testKeyArg;
const testNumber = testKeyArg + 1; const testNumber = testKeyArg + 1;
try { try {
await this.testFunction(this.tapTools); const testReturnValue = await this.testFunction(this.tapTools);
if (this.status === 'timeout') { if (this.status === 'timeout') {
throw new Error('Test succeeded, but timed out...'); throw new Error('Test succeeded, but timed out...');
} }
@ -52,12 +54,14 @@ export class TapTest {
); );
this.status = 'success'; this.status = 'success';
this.testDeferred.resolve(this); this.testDeferred.resolve(this);
this.testResultDeferred.resolve(testReturnValue);
} catch (err) { } catch (err) {
this.hrtMeasurement.stop(); this.hrtMeasurement.stop();
console.log( console.log(
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms` `not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
); );
this.testDeferred.resolve(this); this.testDeferred.resolve(this);
this.testResultDeferred.resolve(err);
// if the test has already succeeded before // if the test has already succeeded before
if (this.status === 'success') { if (this.status === 'success') {