fix(core): update
This commit is contained in:
parent
505f624dd9
commit
035cb84442
@ -26,6 +26,7 @@ mirror:
|
|||||||
snyk:
|
snyk:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci command npm install -g snyk
|
- npmci command npm install -g snyk
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command snyk test
|
||||||
@ -36,21 +37,11 @@ snyk:
|
|||||||
# ====================
|
# ====================
|
||||||
# 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:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install lts
|
- npmci node install lts
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -62,6 +53,7 @@ testLTS:
|
|||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -117,8 +109,10 @@ pages:
|
|||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g npmpage
|
- npmci command npm install -g typedoc typescript
|
||||||
- npmci command npmpage
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
@ -129,13 +123,3 @@ pages:
|
|||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
allow_failure: true
|
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
|
|
||||||
|
81
README.md
81
README.md
@ -1,29 +1,72 @@
|
|||||||
# @pushrocks/tapbundle
|
# @pushrocks/tapbundle
|
||||||
|
|
||||||
tap bundled for tapbuffer
|
tap bundled for tapbuffer
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
||||||
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tapbundle)
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/tapbundle)
|
||||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/tapbundle)
|
* [github.com (source mirror)](https://github.com/pushrocks/tapbundle)
|
||||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/tapbundle)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/tapbundle/)
|
||||||
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/tapbundle/)
|
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
[![build status](https://gitlab.com/pushrocks/tapbundle/badges/master/build.svg)](https://gitlab.com/pushrocks/tapbundle/commits/master)
|
||||||
|
[![coverage report](https://gitlab.com/pushrocks/tapbundle/badges/master/coverage.svg)](https://gitlab.com/pushrocks/tapbundle/commits/master)
|
||||||
|
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/tapbundle.svg)](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
||||||
|
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/tapbundle/badge.svg)](https://snyk.io/test/npm/@pushrocks/tapbundle)
|
||||||
|
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
|
||||||
|
|
||||||
[![build status](https://GitLab.com/pushrocks/tapbundle/badges/master/build.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
## Usage
|
||||||
[![coverage report](https://GitLab.com/pushrocks/tapbundle/badges/master/coverage.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
|
||||||
[![npm downloads per month](https://img.shields.io/npm/dm/tapbundle.svg)](https://www.npmjs.com/package/tapbundle)
|
|
||||||
[![Dependency Status](https://david-dm.org/pushrocks/tapbundle.svg)](https://david-dm.org/pushrocks/tapbundle)
|
|
||||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/tapbundle/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm)
|
|
||||||
[![bitHound Code](https://www.bithound.io/github/pushrocks/tapbundle/badges/code.svg)](https://www.bithound.io/github/pushrocks/tapbundle)
|
|
||||||
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
|
||||||
|
|
||||||
For further information read the linked docs at the top of this README.
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
A few words on TypeScript
|
||||||
|
|
||||||
|
### Included in this package
|
||||||
|
|
||||||
|
- tap compatible testing framework written in TypeScript
|
||||||
|
- a collection of test tools
|
||||||
|
- **code** testing framework with typings
|
||||||
|
|
||||||
|
### Write your first tests
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { tap, expect } from 'tapbundle'; // has typings in place
|
||||||
|
|
||||||
|
import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules
|
||||||
|
|
||||||
|
tap.test('my awesome description', async tools => {
|
||||||
|
// tools are optional parameter
|
||||||
|
tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds
|
||||||
|
});
|
||||||
|
|
||||||
|
let myTest2 = tap.test('my awesome test 2', async tools => {
|
||||||
|
myAwsomeModuleToTest.doSomethingAsync(); // we don't wait here
|
||||||
|
await tools.delayFor(3000); // yay! :) promise based timeouts :)
|
||||||
|
console.log('This gets logged 3000 ms into the test');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('my awesome test 3', async tools => {
|
||||||
|
expect(true).to.be.true; // will not throw
|
||||||
|
await expect(tools.delayFor(2000)).to.eventually.be.fulfilled; // yay expect promises :)
|
||||||
|
expect((await myTest2.promise).hrtMeasurement.milliSeconds > 1000).to.be.true; // access other tests metadata :)
|
||||||
|
});
|
||||||
|
|
||||||
|
let myTest4 = tap.testParallel('my awesome test 4', async tools => {
|
||||||
|
await tools.delayFor(4000);
|
||||||
|
console.log('logs to console after 4 seconds into this test');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('my awesome test 5', async () => {
|
||||||
|
expect(myTest4.status).to.equal('pending'); // since this test will likely finish before myTest4.
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start(); // start the test, will automtically plan tests for you (so the tap parser knows when tests exit bofore they are finished)
|
||||||
|
```
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
# Get Started
|
|
||||||
|
|
||||||
## TypeScript
|
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
|
||||||
|
|
||||||
A few words on TypeScript
|
|
||||||
|
|
||||||
## Included in this package
|
|
||||||
|
|
||||||
- tap compatible testing framework written in TypeScript
|
|
||||||
- a collection of test tools
|
|
||||||
- **code** testing framework with typings
|
|
||||||
|
|
||||||
## Write your first tests
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
import { tap, expect } from 'tapbundle'; // has typings in place
|
|
||||||
|
|
||||||
import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules
|
|
||||||
|
|
||||||
tap.test('my awesome description', async tools => {
|
|
||||||
// tools are optional parameter
|
|
||||||
tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds
|
|
||||||
});
|
|
||||||
|
|
||||||
let myTest2 = tap.test('my awesome test 2', async tools => {
|
|
||||||
myAwsomeModuleToTest.doSomethingAsync(); // we don't wait here
|
|
||||||
await tools.delayFor(3000); // yay! :) promise based timeouts :)
|
|
||||||
console.log('This gets logged 3000 ms into the test');
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('my awesome test 3', async tools => {
|
|
||||||
expect(true).to.be.true; // will not throw
|
|
||||||
await expect(tools.delayFor(2000)).to.eventually.be.fulfilled; // yay expect promises :)
|
|
||||||
expect((await myTest2.promise).hrtMeasurement.milliSeconds > 1000).to.be.true; // access other tests metadata :)
|
|
||||||
});
|
|
||||||
|
|
||||||
let myTest4 = tap.testParallel('my awesome test 4', async tools => {
|
|
||||||
await tools.delayFor(4000);
|
|
||||||
console.log('logs to console after 4 seconds into this test');
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('my awesome test 5', async () => {
|
|
||||||
expect(myTest4.status).to.equal('pending'); // since this test will likely finish before myTest4.
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.start(); // start the test, will automtically plan tests for you (so the tap parser knows when tests exit bofore they are finished)
|
|
||||||
```
|
|
||||||
|
|
||||||
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.html)
|
|
||||||
|
|
||||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
|
@ -1,29 +0,0 @@
|
|||||||
# tapbundle
|
|
||||||
|
|
||||||
tap bundled for tapbuffer
|
|
||||||
|
|
||||||
## Availabililty
|
|
||||||
|
|
||||||
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tapbundle)
|
|
||||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/tapbundle)
|
|
||||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/tapbundle)
|
|
||||||
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/tapbundle/)
|
|
||||||
|
|
||||||
## Status for master
|
|
||||||
|
|
||||||
[![build status](https://GitLab.com/pushrocks/tapbundle/badges/master/build.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
|
||||||
[![coverage report](https://GitLab.com/pushrocks/tapbundle/badges/master/coverage.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
|
||||||
[![npm downloads per month](https://img.shields.io/npm/dm/tapbundle.svg)](https://www.npmjs.com/package/tapbundle)
|
|
||||||
[![Dependency Status](https://david-dm.org/pushrocks/tapbundle.svg)](https://david-dm.org/pushrocks/tapbundle)
|
|
||||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/tapbundle/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm)
|
|
||||||
[![bitHound Code](https://www.bithound.io/github/pushrocks/tapbundle/badges/code.svg)](https://www.bithound.io/github/pushrocks/tapbundle)
|
|
||||||
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
|
||||||
|
|
||||||
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.html)
|
|
||||||
|
|
||||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
|
@ -1,7 +1,6 @@
|
|||||||
# License
|
|
||||||
|
|
||||||
**MIT License**
|
**MIT License**
|
||||||
|
|
||||||
|
Copright © 2016 Lossless GmbH
|
||||||
Copyright © 2016 - 2017 Martin Donath
|
Copyright © 2016 - 2017 Martin Donath
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
@ -7,5 +7,15 @@
|
|||||||
"testConfig": {
|
"testConfig": {
|
||||||
"parallel": false
|
"parallel": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "tapbundle",
|
||||||
|
"shortDescription": "tap bundled for tapbuffer",
|
||||||
|
"npmPackagename": "@pushrocks/tapbundle",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1080
package-lock.json
generated
1080
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -21,16 +21,18 @@
|
|||||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/early": "^3.0.3",
|
"@pushrocks/early": "^3.0.3",
|
||||||
"@pushrocks/smartdelay": "^2.0.2",
|
"@pushrocks/smartdelay": "^2.0.3",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"leakage": "^0.4.0",
|
"leakage": "^0.4.0",
|
||||||
"smartchai": "^2.0.1"
|
"smartchai": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.1.8",
|
||||||
"@gitzone/tsrun": "^1.1.12",
|
"@gitzone/tsrun": "^1.2.5",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.20",
|
||||||
"@types/node": "^10.9.4",
|
"@types/node": "^11.13.2",
|
||||||
"randomstring": "^1.1.5"
|
"randomstring": "^1.1.5",
|
||||||
|
"tslint": "^5.15.0",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
import { tap, expect } from '../ts/index';
|
import { tap, expect } from '../ts/index';
|
||||||
import * as randomstring from 'randomstring';
|
import * as randomstring from 'randomstring';
|
||||||
|
|
||||||
let test1 = tap.test('my first test -> expect true to be true', async tools => {
|
const test1 = tap.test('my first test -> expect true to be true', async tools => {
|
||||||
await tools.checkIterationLeak(async () => {
|
await tools.checkIterationLeak(async () => {
|
||||||
let domain = randomstring.generate(1000);
|
const domain = randomstring.generate(1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let outsideArray = [];
|
const outsideArray = [];
|
||||||
|
|
||||||
let test2 = tap.test('should throw', async tools => {
|
const test2 = tap.test('should throw', async tools => {
|
||||||
let err = await tools.returnError(async () => {
|
const err = await tools.returnError(async () => {
|
||||||
await tools.checkIterationLeak(async () => {
|
await tools.checkIterationLeak(async () => {
|
||||||
outsideArray.push(randomstring.generate(1000));
|
outsideArray.push(randomstring.generate(1000));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
if (!process.version.startsWith('v11')) {
|
||||||
expect(err).to.be.instanceof(Error);
|
expect(err).to.be.instanceof(Error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { tap, expect } from '../ts/index';
|
import { tap, expect } from '../ts/index';
|
||||||
|
|
||||||
let tapwrap = tap.wrap(async () => {
|
const tapwrap = tap.wrap(async () => {
|
||||||
tap.test('should do something', async () => {
|
tap.test('should do something', async () => {
|
||||||
console.log('test1');
|
console.log('test1');
|
||||||
});
|
});
|
||||||
|
12
test/test.ts
12
test/test.ts
@ -1,14 +1,14 @@
|
|||||||
import { tap, expect } from '../ts/index';
|
import { tap, expect } from '../ts/index';
|
||||||
|
|
||||||
let test1 = tap.test('my first test -> expect true to be true', async () => {
|
const test1 = tap.test('my first test -> expect true to be true', async () => {
|
||||||
return expect(true).to.be.true;
|
return expect(true).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
let test2 = tap.test('my second test', async tools => {
|
const test2 = tap.test('my second test', async tools => {
|
||||||
await tools.delayFor(1000);
|
await tools.delayFor(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
let 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((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).to
|
||||||
@ -17,17 +17,17 @@ let test3 = tap.test(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let test4 = tap.skip.test('my 4th test -> should fail', async tools => {
|
const test4 = tap.skip.test('my 4th test -> should fail', async tools => {
|
||||||
tools.allowFailure();
|
tools.allowFailure();
|
||||||
expect(false).to.be.true;
|
expect(false).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
let test5 = tap.test('my 5th test -> should pass in about 500ms', async tools => {
|
const test5 = tap.test('my 5th test -> should pass in about 500ms', async tools => {
|
||||||
tools.timeout(1000);
|
tools.timeout(1000);
|
||||||
await tools.delayFor(500);
|
await tools.delayFor(500);
|
||||||
});
|
});
|
||||||
|
|
||||||
let test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => {
|
const test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => {
|
||||||
tools.allowFailure();
|
tools.allowFailure();
|
||||||
tools.timeout(1000);
|
tools.timeout(1000);
|
||||||
await tools.delayFor(2000);
|
await tools.delayFor(2000);
|
||||||
|
@ -23,7 +23,7 @@ export class Tap {
|
|||||||
test: (descriptionArg: string, testFunctionArg: ITestFunction) => {
|
test: (descriptionArg: string, testFunctionArg: ITestFunction) => {
|
||||||
this.test(descriptionArg, testFunctionArg, 'only');
|
this.test(descriptionArg, testFunctionArg, 'only');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private _tapTests: TapTest[] = [];
|
private _tapTests: TapTest[] = [];
|
||||||
private _tapTestsOnly: TapTest[] = [];
|
private _tapTestsOnly: TapTest[] = [];
|
||||||
@ -33,13 +33,17 @@ 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
|
||||||
*/
|
*/
|
||||||
async test(testDescription: string, testFunction: ITestFunction, modeArg: 'normal' | 'only' | 'skip' = 'normal' ) {
|
async test(
|
||||||
|
testDescription: string,
|
||||||
|
testFunction: ITestFunction,
|
||||||
|
modeArg: 'normal' | 'only' | 'skip' = 'normal'
|
||||||
|
) {
|
||||||
let localTest = new TapTest({
|
let localTest = new TapTest({
|
||||||
description: testDescription,
|
description: testDescription,
|
||||||
testFunction: testFunction,
|
testFunction: testFunction,
|
||||||
parallel: false
|
parallel: false
|
||||||
});
|
});
|
||||||
if(modeArg === 'normal') {
|
if (modeArg === 'normal') {
|
||||||
this._tapTests.push(localTest);
|
this._tapTests.push(localTest);
|
||||||
} else if (modeArg === 'only') {
|
} else if (modeArg === 'only') {
|
||||||
this._tapTestsOnly.push(localTest);
|
this._tapTestsOnly.push(localTest);
|
||||||
@ -83,7 +87,7 @@ export class Tap {
|
|||||||
|
|
||||||
// determine which tests to run
|
// determine which tests to run
|
||||||
let concerningTests: TapTest[];
|
let concerningTests: TapTest[];
|
||||||
if(this._tapTestsOnly.length > 0) {
|
if (this._tapTestsOnly.length > 0) {
|
||||||
concerningTests = this._tapTestsOnly;
|
concerningTests = this._tapTestsOnly;
|
||||||
} else {
|
} else {
|
||||||
concerningTests = this._tapTests;
|
concerningTests = this._tapTests;
|
||||||
|
@ -18,23 +18,23 @@ export class TapTools {
|
|||||||
/**
|
/**
|
||||||
* allow failure
|
* allow failure
|
||||||
*/
|
*/
|
||||||
allowFailure() {
|
public allowFailure() {
|
||||||
this._tapTest.failureAllowed = true;
|
this._tapTest.failureAllowed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* async/await delay method
|
* async/await delay method
|
||||||
*/
|
*/
|
||||||
async delayFor(timeMilliArg) {
|
public async delayFor(timeMilliArg) {
|
||||||
await plugins.smartdelay.delayFor(timeMilliArg);
|
await plugins.smartdelay.delayFor(timeMilliArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
public async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||||
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
async timeout(timeMilliArg: number) {
|
public async timeout(timeMilliArg: number) {
|
||||||
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
const timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||||
timeout.makeUnrefed();
|
timeout.makeUnrefed();
|
||||||
await timeout.promise;
|
await timeout.promise;
|
||||||
if (this._tapTest.status === 'pending') {
|
if (this._tapTest.status === 'pending') {
|
||||||
@ -42,11 +42,15 @@ export class TapTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
public async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||||
|
if (process.version.startsWith('v11')) {
|
||||||
|
console.log('iteration leakage checks disabled for now on version 11 due to low performance');
|
||||||
|
} else {
|
||||||
await plugins.leakage.iterate.async(iterationfuncArg);
|
await plugins.leakage.iterate.async(iterationfuncArg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async returnError(throwingFuncArg: IPromiseFunc) {
|
public async returnError(throwingFuncArg: IPromiseFunc) {
|
||||||
let funcErr: Error;
|
let funcErr: Error;
|
||||||
try {
|
try {
|
||||||
await throwingFuncArg();
|
await throwingFuncArg();
|
||||||
@ -55,4 +59,8 @@ export class TapTools {
|
|||||||
}
|
}
|
||||||
return funcErr;
|
return funcErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public defer () {
|
||||||
|
return plugins.smartpromise.defer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
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"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user