Compare commits

...

22 Commits

Author SHA1 Message Date
b6d1c3c083 3.0.9 2019-04-10 12:56:56 +02:00
6e6cfbadbd fix(core): update 2019-04-10 12:56:55 +02:00
02ff220c59 3.0.8 2019-04-10 12:56:18 +02:00
035cb84442 fix(core): update 2019-04-10 12:56:17 +02:00
505f624dd9 3.0.7 2018-09-03 00:01:53 +02:00
ea5fbd4637 fix(dependencies): update to latest versions 2018-09-03 00:01:53 +02:00
de780538a5 3.0.6 2018-09-02 23:54:59 +02:00
28b1f0bfed fix(core): add tap.only option 2018-09-02 23:54:59 +02:00
72b72a9ffb 3.0.5 2018-08-08 23:38:43 +02:00
be393199be fix(dependencies): update 2018-08-08 23:38:43 +02:00
7b6260bb15 3.0.4 2018-08-08 23:20:14 +02:00
2345e972d5 fix(dependencies): use @gitzone/tsbuild instead of npmts 2018-08-08 23:20:14 +02:00
22c44a8cd0 3.0.3 2018-08-08 23:17:06 +02:00
bae2aebf83 fix(dependencies): now typings-global free 2018-08-08 23:17:06 +02:00
5fe2358bfe 3.0.2 2018-07-18 08:31:22 +02:00
280ded573d fix(dependencies): update 2018-07-18 08:31:22 +02:00
6b6a92b709 3.0.1 2018-07-13 22:28:18 +02:00
c1589c2309 fix(package): npm access level 2018-07-13 22:28:17 +02:00
271d657f2c 3.0.0 2018-07-13 22:06:45 +02:00
63669ea6ff BREAKING CHANGE(package): change scope 2018-07-13 22:06:45 +02:00
4306272f45 2.0.2 2018-06-28 23:47:58 +02:00
4378b36069 fix(security): add snyk file 2018-06-28 23:47:57 +02:00
17 changed files with 1633 additions and 524 deletions

View File

@ -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

15
.snyk Normal file
View File

@ -0,0 +1,15 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.12.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
'npm:shelljs:20140723':
- smartdelay > typings-global > smartshell > shelljs:
reason: None given
expires: '2018-07-28T21:47:33.536Z'
- early > typings-global > smartshell > shelljs:
reason: None given
expires: '2018-07-28T21:47:33.537Z'
- early > beautycolor > typings-global > smartshell > shelljs:
reason: None given
expires: '2018-07-28T21:47:33.537Z'
patch: {}

View File

@ -1,29 +1,72 @@
# 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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -1,12 +1,21 @@
{ {
"npmci": { "npmci": {
"npmGlobalTools": [ "npmGlobalTools": [],
"npmts" "npmAccessLevel": "public"
]
}, },
"npmts": { "npmts": {
"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"
}
} }
} }

1772
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{ {
"name": "tapbundle", "name": "@pushrocks/tapbundle",
"private": false, "private": false,
"version": "2.0.1", "version": "3.0.9",
"description": "tap bundled for tapbuffer", "description": "tap bundled for tapbuffer",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "(tsrun test/test.ts)", "test": "(tstest test/)",
"build": "(npmts)" "build": "(tsbuild)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -20,15 +20,19 @@
}, },
"homepage": "https://gitlab.com/pushrocks/tapbundle#README", "homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": { "dependencies": {
"early": "^2.1.1", "@pushrocks/early": "^3.0.3",
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartpromise": "^3.0.2",
"leakage": "^0.4.0", "leakage": "^0.4.0",
"smartchai": "^2.0.1", "smartchai": "^2.0.1"
"smartdelay": "^1.0.4",
"smartq": "^1.1.8"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsrun": "^1.0.7", "@gitzone/tsbuild": "^2.1.8",
"@types/node": "^10.5.0", "@gitzone/tsrun": "^1.2.5",
"randomstring": "^1.1.5" "@gitzone/tstest": "^1.0.20",
"@types/node": "^11.13.2",
"randomstring": "^1.1.5",
"tslint": "^5.15.0",
"tslint-config-prettier": "^1.18.0"
} }
} }

View File

@ -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));
}); });
}); });
expect(err).to.be.instanceof(Error); if (!process.version.startsWith('v11')) {
expect(err).to.be.instanceof(Error);
}
}); });
tap.start(); tap.start();

View File

@ -1,6 +1,6 @@
import { tap, expect } from '../dist/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');
}); });

View File

@ -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);

View File

@ -4,28 +4,50 @@ import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap'; import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
export class Tap { export class Tap {
/** /**
* skip a test * skips a test
* tests marked with tap.skip.test() are never executed
*/ */
skip = { skip = {
test: (descriptionArg: string, functionArg: ITestFunction) => { test: (descriptionArg: string, functionArg: ITestFunction) => {
console.log(`skipped test: ${descriptionArg}`); console.log(`skipped test: ${descriptionArg}`);
},
testParallel: (descriptionArg: string, functionArg: ITestFunction) => {
console.log(`skipped test: ${descriptionArg}`);
}
};
/**
* only executes tests marked as ONLY
*/
only = {
test: (descriptionArg: string, testFunctionArg: ITestFunction) => {
this.test(descriptionArg, testFunctionArg, 'only');
} }
}; };
private _tapTests: TapTest[] = []; private _tapTests: TapTest[] = [];
private _tapTestsOnly: TapTest[] = [];
/** /**
* Normal test function, will run one by one * Normal test function, will run one by one
* @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) { 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
}); });
this._tapTests.push(localTest); if (modeArg === 'normal') {
this._tapTests.push(localTest);
} else if (modeArg === 'only') {
this._tapTestsOnly.push(localTest);
}
return localTest; return localTest;
} }
@ -63,9 +85,17 @@ export class Tap {
return; return;
} }
console.log(`1..${this._tapTests.length}`); // determine which tests to run
for (let testKey = 0; testKey < this._tapTests.length; testKey++) { let concerningTests: TapTest[];
let currentTest = this._tapTests[testKey]; if (this._tapTestsOnly.length > 0) {
concerningTests = this._tapTestsOnly;
} else {
concerningTests = this._tapTests;
}
console.log(`1..${concerningTests.length}`);
for (let testKey = 0; testKey < concerningTests.length; testKey++) {
let currentTest = concerningTests[testKey];
let testPromise = currentTest.run(testKey); let testPromise = currentTest.run(testKey);
if (currentTest.parallel) { if (currentTest.parallel) {
promiseArray.push(testPromise); promiseArray.push(testPromise);
@ -79,7 +109,7 @@ export class Tap {
let failReasons: string[] = []; let failReasons: string[] = [];
let executionNotes: string[] = []; let executionNotes: string[] = [];
// collect failed tests // collect failed tests
for (let tapTest of this._tapTests) { for (let tapTest of concerningTests) {
if (tapTest.status !== 'success') { if (tapTest.status !== 'success') {
failReasons.push( failReasons.push(
`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n` + `Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n` +

View File

@ -3,8 +3,8 @@ import { tapCreator } from './tapbundle.tapcreator';
import { TapTools } from './tapbundle.classes.taptools'; import { TapTools } from './tapbundle.classes.taptools';
// imported interfaces // imported interfaces
import { HrtMeasurement } from 'early'; import { HrtMeasurement } from '@pushrocks/early';
import { Deferred } from 'smartq'; import { Deferred } from '@pushrocks/smartpromise';
// interfaces // interfaces
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout'; export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
@ -22,7 +22,7 @@ export class TapTest {
tapTools: TapTools; tapTools: TapTools;
testFunction: ITestFunction; testFunction: ITestFunction;
testKey: number; // the testKey the position in the test qeue. Set upon calling .run() testKey: number; // the testKey the position in the test qeue. Set upon calling .run()
testDeferred: Deferred<TapTest> = plugins.smartq.defer(); testDeferred: Deferred<TapTest> = plugins.smartpromise.defer();
testPromise: Promise<TapTest> = this.testDeferred.promise; testPromise: Promise<TapTest> = this.testDeferred.promise;
/** /**
* constructor * constructor

View File

@ -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) {
await plugins.leakage.iterate.async(iterationfuncArg); 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);
}
} }
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();
}
} }

View File

@ -1,6 +1,6 @@
import * as early from 'early'; import * as early from '@pushrocks/early';
import * as leakage from 'leakage'; import * as leakage from 'leakage';
import * as smartdelay from 'smartdelay'; import * as smartdelay from '@pushrocks/smartdelay';
import * as smartq from 'smartq'; import * as smartpromise from '@pushrocks/smartpromise';
export { early, smartdelay, smartq, leakage }; export { early, smartdelay, smartpromise, leakage };

View File

@ -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"
} }