Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
7b6260bb15 | |||
2345e972d5 | |||
22c44a8cd0 | |||
bae2aebf83 | |||
5fe2358bfe | |||
280ded573d | |||
6b6a92b709 | |||
c1589c2309 | |||
271d657f2c | |||
63669ea6ff | |||
4306272f45 | |||
4378b36069 | |||
e8f7013435 | |||
3199943b59 | |||
0028c5492b | |||
e3b05cc43c | |||
f68da622d7 | |||
b7e57e8cdc |
108
.gitlab-ci.yml
108
.gitlab-ci.yml
@ -3,69 +3,139 @@ image: hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .yarn/
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
testLEGACY:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test legacy
|
||||
- npmci node install legacy
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test lts
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test stable
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci publish
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--volume "$PWD":/code
|
||||
--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:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: trigger
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage --publish gitlab
|
||||
- npmci command npm install -g npmpage
|
||||
- npmci command npmpage
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- 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
|
||||
|
15
.snyk
Normal file
15
.snyk
Normal 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: {}
|
@ -1,13 +1,16 @@
|
||||
# tapbundle
|
||||
# @pushrocks/tapbundle
|
||||
|
||||
tap bundled for tapbuffer
|
||||
|
||||
## Availabililty
|
||||
|
||||
[](https://www.npmjs.com/package/tapbundle)
|
||||
[](https://GitLab.com/pushrocks/tapbundle)
|
||||
[](https://github.com/pushrocks/tapbundle)
|
||||
[](https://pushrocks.gitlab.io/tapbundle/)
|
||||
|
||||
## Status for master
|
||||
|
||||
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
||||
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
||||
[](https://www.npmjs.com/package/tapbundle)
|
||||
@ -21,6 +24,6 @@ tap bundled for tapbuffer
|
||||
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)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://push.rocks)
|
||||
|
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
import 'typings-global';
|
||||
export { expect } from 'smartchai';
|
||||
export { tap } from './tapbundle.classes.tap';
|
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-global");
|
||||
var smartchai_1 = require("smartchai");
|
||||
exports.expect = smartchai_1.expect;
|
||||
var tapbundle_classes_tap_1 = require("./tapbundle.classes.tap");
|
||||
exports.tap = tapbundle_classes_tap_1.tap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix1Q0FBa0M7QUFBekIsNkJBQUEsTUFBTSxDQUFBO0FBQ2YsaUVBQTZDO0FBQXBDLHNDQUFBLEdBQUcsQ0FBQSJ9
|
38
dist/tapbundle.classes.tap.d.ts
vendored
38
dist/tapbundle.classes.tap.d.ts
vendored
@ -1,38 +0,0 @@
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
|
||||
export declare class Tap {
|
||||
/**
|
||||
* skip a test
|
||||
*/
|
||||
skip: {
|
||||
test: (descriptionArg: string, functionArg: ITestFunction) => void;
|
||||
};
|
||||
private _tapTests;
|
||||
/**
|
||||
* Normal test function, will run one by one
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
test(testDescription: string, testFunction: ITestFunction): Promise<TapTest>;
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap(functionArg: ITapWrapFunction): TapWrap;
|
||||
/**
|
||||
* A parallel test that will not be waited for before the next starts.
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testParallel(testDescription: string, testFunction: ITestFunction): void;
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
start(optionsArg?: {
|
||||
throwOnError: boolean;
|
||||
}): Promise<void>;
|
||||
/**
|
||||
* handle errors
|
||||
*/
|
||||
threw(err: any): void;
|
||||
}
|
||||
export declare let tap: Tap;
|
111
dist/tapbundle.classes.tap.js
vendored
111
dist/tapbundle.classes.tap.js
vendored
@ -1,111 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tapbundle_classes_taptest_1 = require("./tapbundle.classes.taptest");
|
||||
const tapbundle_classes_tapwrap_1 = require("./tapbundle.classes.tapwrap");
|
||||
class Tap {
|
||||
constructor() {
|
||||
/**
|
||||
* skip a test
|
||||
*/
|
||||
this.skip = {
|
||||
test: (descriptionArg, functionArg) => {
|
||||
console.log(`skipped test: ${descriptionArg}`);
|
||||
}
|
||||
};
|
||||
this._tapTests = [];
|
||||
}
|
||||
/**
|
||||
* Normal test function, will run one by one
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
test(testDescription, testFunction) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let localTest = new tapbundle_classes_taptest_1.TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: false
|
||||
});
|
||||
this._tapTests.push(localTest);
|
||||
return localTest;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap(functionArg) {
|
||||
return new tapbundle_classes_tapwrap_1.TapWrap(functionArg);
|
||||
}
|
||||
/**
|
||||
* A parallel test that will not be waited for before the next starts.
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testParallel(testDescription, testFunction) {
|
||||
this._tapTests.push(new tapbundle_classes_taptest_1.TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: true
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
start(optionsArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let promiseArray = [];
|
||||
// safeguard against empty test array
|
||||
if (this._tapTests.length === 0) {
|
||||
console.log('no tests specified. Ending here!');
|
||||
return;
|
||||
}
|
||||
console.log(`1..${this._tapTests.length}`);
|
||||
for (let testKey = 0; testKey < this._tapTests.length; testKey++) {
|
||||
let currentTest = this._tapTests[testKey];
|
||||
let testPromise = currentTest.run(testKey);
|
||||
if (currentTest.parallel) {
|
||||
promiseArray.push(testPromise);
|
||||
}
|
||||
else {
|
||||
yield testPromise;
|
||||
}
|
||||
}
|
||||
yield Promise.all(promiseArray);
|
||||
// when tests have been run and all promises are fullfilled
|
||||
let failReasons = [];
|
||||
let executionNotes = [];
|
||||
// collect failed tests
|
||||
for (let tapTest of this._tapTests) {
|
||||
if (tapTest.status !== 'success') {
|
||||
failReasons.push(`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n`
|
||||
+ `|| ${tapTest.description}\n`
|
||||
+ `|| for more information please take a look the logs above`);
|
||||
}
|
||||
}
|
||||
// render fail Reasons
|
||||
for (let failReason of failReasons) {
|
||||
console.log(failReason);
|
||||
}
|
||||
if (optionsArg && optionsArg.throwOnError && failReasons.length > 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* handle errors
|
||||
*/
|
||||
threw(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
exports.Tap = Tap;
|
||||
exports.tap = new Tap();
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFwYnVuZGxlLmNsYXNzZXMudGFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyRUFBb0U7QUFDcEUsMkVBQXVFO0FBQ3ZFO0lBQUE7UUFFRTs7V0FFRztRQUNILFNBQUksR0FBRztZQUNMLElBQUksRUFBRSxDQUFDLGNBQXNCLEVBQUUsV0FBMEIsRUFBRSxFQUFFO2dCQUMzRCxPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixjQUFjLEVBQUUsQ0FBQyxDQUFBO1lBQ2hELENBQUM7U0FDRixDQUFBO1FBRU8sY0FBUyxHQUFjLEVBQUUsQ0FBQTtJQTZGbkMsQ0FBQztJQTNGQzs7OztPQUlHO0lBQ0csSUFBSSxDQUFFLGVBQXVCLEVBQUUsWUFBMkI7O1lBQzlELElBQUksU0FBUyxHQUFHLElBQUksbUNBQU8sQ0FBQztnQkFDMUIsV0FBVyxFQUFFLGVBQWU7Z0JBQzVCLFlBQVksRUFBRSxZQUFZO2dCQUMxQixRQUFRLEVBQUUsS0FBSzthQUNoQixDQUFDLENBQUE7WUFDRixJQUFJLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtZQUM5QixNQUFNLENBQUMsU0FBUyxDQUFBO1FBQ2xCLENBQUM7S0FBQTtJQUVEOztPQUVHO0lBQ0gsSUFBSSxDQUFFLFdBQTZCO1FBQ2pDLE1BQU0sQ0FBQyxJQUFJLG1DQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDakMsQ0FBQztJQUVEOzs7O09BSUc7SUFDSCxZQUFZLENBQUUsZUFBdUIsRUFBRSxZQUEyQjtRQUNoRSxJQUFJLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxJQUFJLG1DQUFPLENBQUM7WUFDOUIsV0FBVyxFQUFFLGVBQWU7WUFDNUIsWUFBWSxFQUFFLFlBQVk7WUFDMUIsUUFBUSxFQUFFLElBQUk7U0FDZixDQUFDLENBQUMsQ0FBQTtJQUNMLENBQUM7SUFFRDs7T0FFRztJQUNHLEtBQUssQ0FBQyxVQUVYOztZQUNDLElBQUksWUFBWSxHQUFtQixFQUFFLENBQUE7WUFFckMscUNBQXFDO1lBQ3JDLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsTUFBTSxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ2hDLE9BQU8sQ0FBQyxHQUFHLENBQUMsa0NBQWtDLENBQUMsQ0FBQTtnQkFDL0MsTUFBTSxDQUFBO1lBQ1IsQ0FBQztZQUVELE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxJQUFJLENBQUMsU0FBUyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUE7WUFDMUMsR0FBRyxDQUFDLENBQUMsSUFBSSxPQUFPLEdBQUcsQ0FBQyxFQUFFLE9BQU8sR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLE1BQU0sRUFBRSxPQUFPLEVBQUUsRUFBRSxDQUFDO2dCQUNqRSxJQUFJLFdBQVcsR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUN6QyxJQUFJLFdBQVcsR0FBRyxXQUFXLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUMxQyxFQUFFLENBQUMsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQztvQkFDekIsWUFBWSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQTtnQkFDaEMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixNQUFNLFdBQVcsQ0FBQTtnQkFDbkIsQ0FBQztZQUNILENBQUM7WUFDRCxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUE7WUFFL0IsMkRBQTJEO1lBQzNELElBQUksV0FBVyxHQUFhLEVBQUUsQ0FBQTtZQUM5QixJQUFJLGNBQWMsR0FBYSxFQUFFLENBQUE7WUFDakMsdUJBQXVCO1lBQ3ZCLEdBQUcsQ0FBQyxDQUFDLElBQUksT0FBTyxJQUFJLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDO2dCQUNuQyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsTUFBTSxLQUFLLFNBQVMsQ0FBQyxDQUFDLENBQUM7b0JBQ2pDLFdBQVcsQ0FBQyxJQUFJLENBQ2QsUUFBUSxPQUFPLENBQUMsT0FBTyxHQUFHLENBQUMsdUJBQXVCLE9BQU8sQ0FBQyxNQUFNLEtBQUs7MEJBQ25FLE1BQU0sT0FBTyxDQUFDLFdBQVcsSUFBSTswQkFDN0IsMkRBQTJELENBQzlELENBQUE7Z0JBQ0gsQ0FBQztZQUNILENBQUM7WUFFRCxzQkFBc0I7WUFDdEIsR0FBRyxDQUFDLENBQUMsSUFBSSxVQUFVLElBQUksV0FBVyxDQUFDLENBQUMsQ0FBQztnQkFDbkMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQTtZQUN6QixDQUFDO1lBRUQsRUFBRSxDQUFDLENBQUMsVUFBVSxJQUFJLFVBQVUsQ0FBQyxZQUFZLElBQUksV0FBVyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUNwRSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFBO1lBQ2pCLENBQUM7UUFDSCxDQUFDO0tBQUE7SUFFRDs7T0FFRztJQUNILEtBQUssQ0FBRSxHQUFHO1FBQ1IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUNsQixDQUFDO0NBQ0Y7QUF4R0Qsa0JBd0dDO0FBRVUsUUFBQSxHQUFHLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQSJ9
|
31
dist/tapbundle.classes.taptest.d.ts
vendored
31
dist/tapbundle.classes.taptest.d.ts
vendored
@ -1,31 +0,0 @@
|
||||
import { TapTools } from './tapbundle.classes.taptools';
|
||||
import { HrtMeasurement } from 'early';
|
||||
import { Deferred } from 'smartq';
|
||||
export declare type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
|
||||
export interface ITestFunction {
|
||||
(tapTools?: TapTools): Promise<any>;
|
||||
}
|
||||
export declare class TapTest {
|
||||
description: string;
|
||||
failureAllowed: boolean;
|
||||
hrtMeasurement: HrtMeasurement;
|
||||
parallel: boolean;
|
||||
status: TTestStatus;
|
||||
tapTools: TapTools;
|
||||
testFunction: ITestFunction;
|
||||
testKey: number;
|
||||
testDeferred: Deferred<TapTest>;
|
||||
testPromise: Promise<TapTest>;
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
constructor(optionsArg: {
|
||||
description: string;
|
||||
testFunction: ITestFunction;
|
||||
parallel: boolean;
|
||||
});
|
||||
/**
|
||||
* run the test
|
||||
*/
|
||||
run(testKeyArg: number): Promise<void>;
|
||||
}
|
69
dist/tapbundle.classes.taptest.js
vendored
69
dist/tapbundle.classes.taptest.js
vendored
@ -1,69 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./tapbundle.plugins");
|
||||
const tapbundle_classes_taptools_1 = require("./tapbundle.classes.taptools");
|
||||
// imported interfaces
|
||||
const early_1 = require("early");
|
||||
class TapTest {
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
constructor(optionsArg) {
|
||||
this.testDeferred = plugins.smartq.defer();
|
||||
this.testPromise = this.testDeferred.promise;
|
||||
this.description = optionsArg.description;
|
||||
this.hrtMeasurement = new early_1.HrtMeasurement();
|
||||
this.parallel = optionsArg.parallel;
|
||||
this.status = 'pending';
|
||||
this.tapTools = new tapbundle_classes_taptools_1.TapTools(this);
|
||||
this.testFunction = optionsArg.testFunction;
|
||||
}
|
||||
/**
|
||||
* run the test
|
||||
*/
|
||||
run(testKeyArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.hrtMeasurement.start();
|
||||
this.testKey = testKeyArg;
|
||||
let testNumber = testKeyArg + 1;
|
||||
try {
|
||||
yield this.testFunction(this.tapTools);
|
||||
if (this.status === 'timeout') {
|
||||
throw new Error('Test succeeded, but timed out...');
|
||||
}
|
||||
this.hrtMeasurement.stop();
|
||||
console.log(`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`);
|
||||
this.status = 'success';
|
||||
this.testDeferred.resolve(this);
|
||||
}
|
||||
catch (err) {
|
||||
this.hrtMeasurement.stop();
|
||||
console.log(`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`);
|
||||
this.testDeferred.resolve(this);
|
||||
// if the test has already succeeded before
|
||||
if (this.status === 'success') {
|
||||
this.status = 'errorAfterSuccess';
|
||||
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull');
|
||||
}
|
||||
else {
|
||||
this.status = 'error';
|
||||
}
|
||||
// if the test is allowed to fail
|
||||
if (this.failureAllowed) {
|
||||
console.log(`please note: failure allowed!`);
|
||||
}
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TapTest = TapTest;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3RhcGJ1bmRsZS5jbGFzc2VzLnRhcHRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLCtDQUE4QztBQUU5Qyw2RUFBdUQ7QUFFdkQsc0JBQXNCO0FBQ3RCLGlDQUFzQztBQVd0QztJQVdFOztPQUVHO0lBQ0gsWUFBYSxVQUlaO1FBVEQsaUJBQVksR0FBc0IsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUN4RCxnQkFBVyxHQUFxQixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQTtRQVN2RCxJQUFJLENBQUMsV0FBVyxHQUFHLFVBQVUsQ0FBQyxXQUFXLENBQUE7UUFDekMsSUFBSSxDQUFDLGNBQWMsR0FBRyxJQUFJLHNCQUFjLEVBQUUsQ0FBQTtRQUMxQyxJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUE7UUFDbkMsSUFBSSxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUE7UUFDdkIsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLHFDQUFRLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDbEMsSUFBSSxDQUFDLFlBQVksR0FBRyxVQUFVLENBQUMsWUFBWSxDQUFBO0lBQzdDLENBQUM7SUFFRDs7T0FFRztJQUNHLEdBQUcsQ0FBRSxVQUFrQjs7WUFDM0IsSUFBSSxDQUFDLGNBQWMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtZQUMzQixJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQTtZQUN6QixJQUFJLFVBQVUsR0FBRyxVQUFVLEdBQUcsQ0FBQyxDQUFBO1lBQy9CLElBQUksQ0FBQztnQkFDSCxNQUFNLElBQUksQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFBO2dCQUN0QyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsTUFBTSxLQUFLLFNBQVMsQ0FBQyxDQUFDLENBQUM7b0JBQzlCLE1BQU0sSUFBSSxLQUFLLENBQUUsa0NBQWtDLENBQUMsQ0FBQTtnQkFDdEQsQ0FBQztnQkFDRCxJQUFJLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxDQUFBO2dCQUMxQixPQUFPLENBQUMsR0FBRyxDQUFDLE1BQU0sVUFBVSxNQUFNLElBQUksQ0FBQyxXQUFXLFdBQVcsSUFBSSxDQUFDLGNBQWMsQ0FBQyxZQUFZLElBQUksQ0FBQyxDQUFBO2dCQUNsRyxJQUFJLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQTtnQkFDdkIsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUE7WUFDakMsQ0FBQztZQUFDLEtBQUssQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7Z0JBQ2IsSUFBSSxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtnQkFDMUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLFVBQVUsTUFBTSxJQUFJLENBQUMsV0FBVyxXQUFXLElBQUksQ0FBQyxjQUFjLENBQUMsWUFBWSxJQUFJLENBQUMsQ0FBQTtnQkFDdEcsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUE7Z0JBRS9CLDJDQUEyQztnQkFDM0MsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDO29CQUM5QixJQUFJLENBQUMsTUFBTSxHQUFHLG1CQUFtQixDQUFBO29CQUNqQyxPQUFPLENBQUMsR0FBRyxDQUFDLHlFQUF5RSxDQUFDLENBQUE7Z0JBQ3hGLENBQUM7Z0JBQUMsSUFBSSxDQUFDLENBQUM7b0JBQ04sSUFBSSxDQUFDLE1BQU0sR0FBRyxPQUFPLENBQUE7Z0JBQ3ZCLENBQUM7Z0JBRUQsaUNBQWlDO2dCQUNqQyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztvQkFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQywrQkFBK0IsQ0FBQyxDQUFBO2dCQUM5QyxDQUFDO2dCQUNELE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7WUFDbEIsQ0FBQztRQUNILENBQUM7S0FBQTtDQUNGO0FBL0RELDBCQStEQyJ9
|
22
dist/tapbundle.classes.taptools.d.ts
vendored
22
dist/tapbundle.classes.taptools.d.ts
vendored
@ -1,22 +0,0 @@
|
||||
export interface IPromiseFunc {
|
||||
(): Promise<any>;
|
||||
}
|
||||
export declare class TapTools {
|
||||
/**
|
||||
* the referenced TapTest
|
||||
*/
|
||||
private _tapTest;
|
||||
constructor(TapTestArg: any);
|
||||
/**
|
||||
* allow failure
|
||||
*/
|
||||
allowFailure(): void;
|
||||
/**
|
||||
* async/await delay method
|
||||
*/
|
||||
delayFor(timeMilliArg: any): Promise<void>;
|
||||
delayForRandom(timeMilliMinArg: any, timeMilliMaxArg: any): Promise<void>;
|
||||
timeout(timeMilliArg: number): Promise<void>;
|
||||
checkIterationLeak(iterationfuncArg: IPromiseFunc): Promise<void>;
|
||||
returnError(throwingFuncArg: IPromiseFunc): Promise<Error>;
|
||||
}
|
64
dist/tapbundle.classes.taptools.js
vendored
64
dist/tapbundle.classes.taptools.js
vendored
@ -1,64 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./tapbundle.plugins");
|
||||
class TapTools {
|
||||
constructor(TapTestArg) {
|
||||
this._tapTest = TapTestArg;
|
||||
}
|
||||
/**
|
||||
* allow failure
|
||||
*/
|
||||
allowFailure() {
|
||||
this._tapTest.failureAllowed = true;
|
||||
}
|
||||
/**
|
||||
* async/await delay method
|
||||
*/
|
||||
delayFor(timeMilliArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield plugins.smartdelay.delayFor(timeMilliArg);
|
||||
});
|
||||
}
|
||||
delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
||||
});
|
||||
}
|
||||
timeout(timeMilliArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||
timeout.makeUnrefed();
|
||||
yield timeout.promise;
|
||||
if (this._tapTest.status === 'pending') {
|
||||
this._tapTest.status = 'timeout';
|
||||
}
|
||||
});
|
||||
}
|
||||
checkIterationLeak(iterationfuncArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield plugins.leakage.iterate.async(iterationfuncArg);
|
||||
});
|
||||
}
|
||||
returnError(throwingFuncArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let funcErr;
|
||||
try {
|
||||
yield throwingFuncArg();
|
||||
}
|
||||
catch (err) {
|
||||
funcErr = err;
|
||||
}
|
||||
return funcErr;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TapTools = TapTools;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUuY2xhc3Nlcy50YXB0b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBTzlDO0lBT0UsWUFBYSxVQUFVO1FBQ3JCLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFBO0lBQzVCLENBQUM7SUFFRDs7T0FFRztJQUNILFlBQVk7UUFDVixJQUFJLENBQUMsUUFBUSxDQUFDLGNBQWMsR0FBRyxJQUFJLENBQUE7SUFDckMsQ0FBQztJQUVEOztPQUVHO0lBQ0csUUFBUSxDQUFFLFlBQVk7O1lBQzFCLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakQsQ0FBQztLQUFBO0lBRUssY0FBYyxDQUFFLGVBQWUsRUFBRSxlQUFlOztZQUNwRCxNQUFNLE9BQU8sQ0FBQyxVQUFVLENBQUMsY0FBYyxDQUFDLGVBQWUsRUFBRSxlQUFlLENBQUMsQ0FBQTtRQUMzRSxDQUFDO0tBQUE7SUFFSyxPQUFPLENBQUUsWUFBb0I7O1lBQ2pDLElBQUksT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7WUFDMUQsT0FBTyxDQUFDLFdBQVcsRUFBRSxDQUFBO1lBQ3JCLE1BQU0sT0FBTyxDQUFDLE9BQU8sQ0FBQTtZQUNyQixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDO2dCQUN2QyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUE7WUFDbEMsQ0FBQztRQUNILENBQUM7S0FBQTtJQUVLLGtCQUFrQixDQUFFLGdCQUE4Qjs7WUFDdEQsTUFBTSxPQUFPLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtRQUN2RCxDQUFDO0tBQUE7SUFFSyxXQUFXLENBQUUsZUFBNkI7O1lBQzlDLElBQUksT0FBYyxDQUFBO1lBQ2xCLElBQUksQ0FBQztnQkFDSCxNQUFNLGVBQWUsRUFBRSxDQUFBO1lBQ3pCLENBQUM7WUFBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO2dCQUNiLE9BQU8sR0FBRyxHQUFHLENBQUE7WUFDZixDQUFDO1lBQ0QsTUFBTSxDQUFDLE9BQU8sQ0FBQTtRQUNoQixDQUFDO0tBQUE7Q0FDRjtBQW5ERCw0QkFtREMifQ==
|
14
dist/tapbundle.classes.tapwrap.d.ts
vendored
14
dist/tapbundle.classes.tapwrap.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
export interface ITapWrapFunction {
|
||||
(): Promise<any>;
|
||||
}
|
||||
export declare class TapWrap {
|
||||
wrapFunction: ITapWrapFunction;
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor(wrapFunctionArg: ITapWrapFunction);
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
run(): Promise<void>;
|
||||
}
|
29
dist/tapbundle.classes.tapwrap.js
vendored
29
dist/tapbundle.classes.tapwrap.js
vendored
@ -1,29 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class TapWrap {
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor(wrapFunctionArg) {
|
||||
// nothing here
|
||||
this.wrapFunction = wrapFunctionArg;
|
||||
}
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.wrapFunction();
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TapWrap = TapWrap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwd3JhcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3RhcGJ1bmRsZS5jbGFzc2VzLnRhcHdyYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQU1BO0lBR0U7O09BRUc7SUFDSCxZQUFhLGVBQWlDO1FBQzVDLGVBQWU7UUFDZixJQUFJLENBQUMsWUFBWSxHQUFHLGVBQWUsQ0FBQTtJQUNyQyxDQUFDO0lBRUQ7O09BRUc7SUFDRyxHQUFHOztZQUNQLE1BQU0sSUFBSSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzNCLENBQUM7S0FBQTtDQUNGO0FBakJELDBCQWlCQyJ9
|
6
dist/tapbundle.plugins.d.ts
vendored
6
dist/tapbundle.plugins.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
import 'typings-global';
|
||||
import * as early from 'early';
|
||||
import * as leakage from 'leakage';
|
||||
import * as smartdelay from 'smartdelay';
|
||||
import * as smartq from 'smartq';
|
||||
export { early, smartdelay, smartq, leakage };
|
12
dist/tapbundle.plugins.js
vendored
12
dist/tapbundle.plugins.js
vendored
@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-global");
|
||||
const early = require("early");
|
||||
exports.early = early;
|
||||
const leakage = require("leakage");
|
||||
exports.leakage = leakage;
|
||||
const smartdelay = require("smartdelay");
|
||||
exports.smartdelay = smartdelay;
|
||||
const smartq = require("smartq");
|
||||
exports.smartq = smartq;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QiwrQkFBOEI7QUFNNUIsc0JBQUs7QUFMUCxtQ0FBa0M7QUFRaEMsMEJBQU87QUFQVCx5Q0FBd0M7QUFLdEMsZ0NBQVU7QUFKWixpQ0FBZ0M7QUFLOUIsd0JBQU0ifQ==
|
3
dist/tapbundle.tapcreator.d.ts
vendored
3
dist/tapbundle.tapcreator.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
export declare class TapCreator {
|
||||
}
|
||||
export declare let tapCreator: TapCreator;
|
7
dist/tapbundle.tapcreator.js
vendored
7
dist/tapbundle.tapcreator.js
vendored
@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class TapCreator {
|
||||
}
|
||||
exports.TapCreator = TapCreator;
|
||||
exports.tapCreator = new TapCreator();
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLnRhcGNyZWF0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUudGFwY3JlYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0NBRUM7QUFGRCxnQ0FFQztBQUVVLFFBQUEsVUFBVSxHQUFHLElBQUksVUFBVSxFQUFFLENBQUEifQ==
|
@ -1,55 +1,56 @@
|
||||
# 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
|
||||
|
||||
- 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
|
||||
```javascript
|
||||
import { tap, expect } from 'tapbundle'; // has typings in place
|
||||
|
||||
tap.test('my awesome description', async (tools) => { // tools are optional parameter
|
||||
tools.timeout(2000) // test will fail if it takes longer than 2000 millisenconds
|
||||
})
|
||||
import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules
|
||||
|
||||
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 description', async tools => {
|
||||
// tools are optional parameter
|
||||
tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds
|
||||
});
|
||||
|
||||
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 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');
|
||||
});
|
||||
|
||||
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 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)
|
||||
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)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://push.rocks)
|
||||
|
@ -1,13 +1,16 @@
|
||||
# tapbundle
|
||||
|
||||
tap bundled for tapbuffer
|
||||
|
||||
## Availabililty
|
||||
|
||||
[](https://www.npmjs.com/package/tapbundle)
|
||||
[](https://GitLab.com/pushrocks/tapbundle)
|
||||
[](https://github.com/pushrocks/tapbundle)
|
||||
[](https://pushrocks.gitlab.io/tapbundle/)
|
||||
|
||||
## Status for master
|
||||
|
||||
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
||||
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
||||
[](https://www.npmjs.com/package/tapbundle)
|
||||
@ -21,6 +24,6 @@ tap bundled for tapbuffer
|
||||
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)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://push.rocks)
|
||||
|
@ -1,8 +1,7 @@
|
||||
{
|
||||
"npmci": {
|
||||
"globalNpmTools": [
|
||||
"npmts"
|
||||
]
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"npmts": {
|
||||
"testConfig": {
|
||||
|
1144
package-lock.json
generated
1144
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "tapbundle",
|
||||
"version": "1.1.7",
|
||||
"name": "@pushrocks/tapbundle",
|
||||
"private": false,
|
||||
"version": "3.0.4",
|
||||
"description": "tap bundled for tapbuffer",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(npmts)"
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -18,15 +20,17 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
||||
"dependencies": {
|
||||
"@types/node": "^8.0.33",
|
||||
"early": "^2.1.1",
|
||||
"leakage": "^0.3.0",
|
||||
"smartchai": "^1.0.3",
|
||||
"smartdelay": "^1.0.3",
|
||||
"smartq": "^1.1.1",
|
||||
"typings-global": "^1.0.19"
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.13",
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartdelay": "^2.0.1",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"leakage": "^0.4.0",
|
||||
"smartchai": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsrun": "^1.1.12",
|
||||
"@types/node": "^10.5.7",
|
||||
"randomstring": "^1.1.5"
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
import { tap, expect } from '../ts/index'
|
||||
import * as randomstring from 'randomstring'
|
||||
import { tap, expect } from '../ts/index';
|
||||
import * as randomstring from 'randomstring';
|
||||
|
||||
let test1 = tap.test('my first test -> expect true to be true', async (tools) => {
|
||||
let test1 = tap.test('my first test -> expect true to be true', async tools => {
|
||||
await tools.checkIterationLeak(async () => {
|
||||
let domain = randomstring.generate(1000)
|
||||
})
|
||||
})
|
||||
let domain = randomstring.generate(1000);
|
||||
});
|
||||
});
|
||||
|
||||
let outsideArray = []
|
||||
let outsideArray = [];
|
||||
|
||||
let test2 = tap.test('should throw', async (tools) => {
|
||||
let test2 = tap.test('should throw', async tools => {
|
||||
let err = await tools.returnError(async () => {
|
||||
await tools.checkIterationLeak(async () => {
|
||||
outsideArray.push(randomstring.generate(1000))
|
||||
})
|
||||
})
|
||||
expect(err).to.be.an.error()
|
||||
})
|
||||
outsideArray.push(randomstring.generate(1000));
|
||||
});
|
||||
});
|
||||
expect(err).to.be.instanceof(Error);
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.start();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { tap, expect } from '../dist/index'
|
||||
import { tap, expect } from '../ts/index';
|
||||
|
||||
let tapwrap = tap.wrap(async () => {
|
||||
tap.test('should do something', async () => {
|
||||
console.log('test1')
|
||||
})
|
||||
tap.start()
|
||||
})
|
||||
console.log('test1');
|
||||
});
|
||||
tap.start();
|
||||
});
|
||||
|
||||
tapwrap.run()
|
||||
tapwrap.run();
|
||||
|
52
test/test.ts
52
test/test.ts
@ -1,32 +1,36 @@
|
||||
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 () => {
|
||||
return expect(true).to.be.true()
|
||||
})
|
||||
return expect(true).to.be.true;
|
||||
});
|
||||
|
||||
let test2 = tap.test('my second test', async (tools) => {
|
||||
await tools.delayFor(1000)
|
||||
})
|
||||
let test2 = tap.test('my second test', async tools => {
|
||||
await tools.delayFor(1000);
|
||||
});
|
||||
|
||||
let test3 = tap.test('my third test -> test2 should take longer than test1 and endure at least 1000ms', async () => {
|
||||
expect((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).to.be.true()
|
||||
expect((await test2).hrtMeasurement.milliSeconds > 1000).to.be.true()
|
||||
})
|
||||
let test3 = tap.test(
|
||||
'my third test -> test2 should take longer than test1 and endure at least 1000ms',
|
||||
async () => {
|
||||
expect((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).to
|
||||
.be.true;
|
||||
expect((await test2).hrtMeasurement.milliSeconds > 1000).to.be.true;
|
||||
}
|
||||
);
|
||||
|
||||
let test4 = tap.skip.test('my 4th test -> should fail', async (tools) => {
|
||||
tools.allowFailure()
|
||||
expect(false).to.be.true()
|
||||
})
|
||||
let test4 = tap.skip.test('my 4th test -> should fail', async tools => {
|
||||
tools.allowFailure();
|
||||
expect(false).to.be.true;
|
||||
});
|
||||
|
||||
let test5 = tap.test('my 5th test -> should pass in about 500ms', async (tools) => {
|
||||
tools.timeout(1000)
|
||||
await tools.delayFor(500)
|
||||
})
|
||||
let test5 = tap.test('my 5th test -> should pass in about 500ms', async tools => {
|
||||
tools.timeout(1000);
|
||||
await tools.delayFor(500);
|
||||
});
|
||||
|
||||
let test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async (tools) => {
|
||||
tools.allowFailure()
|
||||
tools.timeout(1000)
|
||||
await tools.delayFor(2000)
|
||||
})
|
||||
let test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => {
|
||||
tools.allowFailure();
|
||||
tools.timeout(1000);
|
||||
await tools.delayFor(2000);
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.start();
|
||||
|
@ -1,3 +1,2 @@
|
||||
import 'typings-global'
|
||||
export { expect } from 'smartchai'
|
||||
export { tap } from './tapbundle.classes.tap'
|
||||
export { expect } from 'smartchai';
|
||||
export { tap } from './tapbundle.classes.tap';
|
||||
|
@ -1,40 +1,39 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest'
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap'
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
|
||||
export class Tap {
|
||||
|
||||
/**
|
||||
* skip a test
|
||||
*/
|
||||
skip = {
|
||||
test: (descriptionArg: string, functionArg: ITestFunction) => {
|
||||
console.log(`skipped test: ${descriptionArg}`)
|
||||
console.log(`skipped test: ${descriptionArg}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private _tapTests: TapTest[] = []
|
||||
private _tapTests: TapTest[] = [];
|
||||
|
||||
/**
|
||||
* Normal test function, will run one by one
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
async test (testDescription: string, testFunction: ITestFunction) {
|
||||
async test(testDescription: string, testFunction: ITestFunction) {
|
||||
let localTest = new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: false
|
||||
})
|
||||
this._tapTests.push(localTest)
|
||||
return localTest
|
||||
});
|
||||
this._tapTests.push(localTest);
|
||||
return localTest;
|
||||
}
|
||||
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap (functionArg: ITapWrapFunction) {
|
||||
return new TapWrap(functionArg)
|
||||
wrap(functionArg: ITapWrapFunction) {
|
||||
return new TapWrap(functionArg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,71 +41,70 @@ export class Tap {
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testParallel (testDescription: string, testFunction: ITestFunction) {
|
||||
this._tapTests.push(new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: true
|
||||
}))
|
||||
testParallel(testDescription: string, testFunction: ITestFunction) {
|
||||
this._tapTests.push(
|
||||
new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: true
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
async start(optionsArg?: {
|
||||
throwOnError: boolean
|
||||
}) {
|
||||
let promiseArray: Promise<any>[] = []
|
||||
async start(optionsArg?: { throwOnError: boolean }) {
|
||||
let promiseArray: Promise<any>[] = [];
|
||||
|
||||
// safeguard against empty test array
|
||||
if (this._tapTests.length === 0) {
|
||||
console.log('no tests specified. Ending here!')
|
||||
return
|
||||
console.log('no tests specified. Ending here!');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`1..${this._tapTests.length}`)
|
||||
console.log(`1..${this._tapTests.length}`);
|
||||
for (let testKey = 0; testKey < this._tapTests.length; testKey++) {
|
||||
let currentTest = this._tapTests[testKey]
|
||||
let testPromise = currentTest.run(testKey)
|
||||
let currentTest = this._tapTests[testKey];
|
||||
let testPromise = currentTest.run(testKey);
|
||||
if (currentTest.parallel) {
|
||||
promiseArray.push(testPromise)
|
||||
promiseArray.push(testPromise);
|
||||
} else {
|
||||
await testPromise
|
||||
await testPromise;
|
||||
}
|
||||
}
|
||||
await Promise.all(promiseArray)
|
||||
await Promise.all(promiseArray);
|
||||
|
||||
// when tests have been run and all promises are fullfilled
|
||||
let failReasons: string[] = []
|
||||
let executionNotes: string[] = []
|
||||
let failReasons: string[] = [];
|
||||
let executionNotes: string[] = [];
|
||||
// collect failed tests
|
||||
for (let tapTest of this._tapTests) {
|
||||
if (tapTest.status !== 'success') {
|
||||
failReasons.push(
|
||||
`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n`
|
||||
+ `|| ${tapTest.description}\n`
|
||||
+ `|| for more information please take a look the logs above`
|
||||
)
|
||||
`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n` +
|
||||
`|| ${tapTest.description}\n` +
|
||||
`|| for more information please take a look the logs above`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// render fail Reasons
|
||||
for (let failReason of failReasons) {
|
||||
console.log(failReason)
|
||||
console.log(failReason);
|
||||
}
|
||||
|
||||
if (optionsArg && optionsArg.throwOnError && failReasons.length > 0) {
|
||||
process.exit(1)
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* handle errors
|
||||
*/
|
||||
threw (err) {
|
||||
console.log(err)
|
||||
threw(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
export let tap = new Tap()
|
||||
|
||||
export let tap = new Tap();
|
||||
|
@ -1,80 +1,79 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
import { tapCreator } from './tapbundle.tapcreator'
|
||||
import { TapTools } from './tapbundle.classes.taptools'
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
import { tapCreator } from './tapbundle.tapcreator';
|
||||
import { TapTools } from './tapbundle.classes.taptools';
|
||||
|
||||
// imported interfaces
|
||||
import { HrtMeasurement } from 'early'
|
||||
import { Deferred } from 'smartq'
|
||||
import { HrtMeasurement } from '@pushrocks/early';
|
||||
import { Deferred } from 'smartq';
|
||||
|
||||
// interfaces
|
||||
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout'
|
||||
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
|
||||
|
||||
export interface ITestFunction {
|
||||
(tapTools?: TapTools): Promise<any>
|
||||
(tapTools?: TapTools): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
export class TapTest {
|
||||
description: string
|
||||
failureAllowed: boolean
|
||||
hrtMeasurement: HrtMeasurement
|
||||
parallel: boolean
|
||||
status: TTestStatus
|
||||
tapTools: TapTools
|
||||
testFunction: ITestFunction
|
||||
testKey: number // the testKey the position in the test qeue. Set upon calling .run()
|
||||
testDeferred: Deferred<TapTest> = plugins.smartq.defer()
|
||||
testPromise: Promise<TapTest> = this.testDeferred.promise
|
||||
description: string;
|
||||
failureAllowed: boolean;
|
||||
hrtMeasurement: HrtMeasurement;
|
||||
parallel: boolean;
|
||||
status: TTestStatus;
|
||||
tapTools: TapTools;
|
||||
testFunction: ITestFunction;
|
||||
testKey: number; // the testKey the position in the test qeue. Set upon calling .run()
|
||||
testDeferred: Deferred<TapTest> = plugins.smartpromise.defer();
|
||||
testPromise: Promise<TapTest> = this.testDeferred.promise;
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
constructor (optionsArg: {
|
||||
description: string,
|
||||
testFunction: ITestFunction,
|
||||
parallel: boolean
|
||||
}) {
|
||||
this.description = optionsArg.description
|
||||
this.hrtMeasurement = new HrtMeasurement()
|
||||
this.parallel = optionsArg.parallel
|
||||
this.status = 'pending'
|
||||
this.tapTools = new TapTools(this)
|
||||
this.testFunction = optionsArg.testFunction
|
||||
constructor(optionsArg: { description: string; testFunction: ITestFunction; parallel: boolean }) {
|
||||
this.description = optionsArg.description;
|
||||
this.hrtMeasurement = new HrtMeasurement();
|
||||
this.parallel = optionsArg.parallel;
|
||||
this.status = 'pending';
|
||||
this.tapTools = new TapTools(this);
|
||||
this.testFunction = optionsArg.testFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* run the test
|
||||
*/
|
||||
async run (testKeyArg: number) {
|
||||
this.hrtMeasurement.start()
|
||||
this.testKey = testKeyArg
|
||||
let testNumber = testKeyArg + 1
|
||||
async run(testKeyArg: number) {
|
||||
this.hrtMeasurement.start();
|
||||
this.testKey = testKeyArg;
|
||||
let testNumber = testKeyArg + 1;
|
||||
try {
|
||||
await this.testFunction(this.tapTools)
|
||||
await this.testFunction(this.tapTools);
|
||||
if (this.status === 'timeout') {
|
||||
throw new Error ('Test succeeded, but timed out...')
|
||||
throw new Error('Test succeeded, but timed out...');
|
||||
}
|
||||
this.hrtMeasurement.stop()
|
||||
console.log(`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`)
|
||||
this.status = 'success'
|
||||
this.testDeferred.resolve(this)
|
||||
this.hrtMeasurement.stop();
|
||||
console.log(
|
||||
`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
|
||||
);
|
||||
this.status = 'success';
|
||||
this.testDeferred.resolve(this);
|
||||
} catch (err) {
|
||||
this.hrtMeasurement.stop()
|
||||
console.log(`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`)
|
||||
this.testDeferred.resolve(this)
|
||||
this.hrtMeasurement.stop();
|
||||
console.log(
|
||||
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
|
||||
);
|
||||
this.testDeferred.resolve(this);
|
||||
|
||||
// if the test has already succeeded before
|
||||
if (this.status === 'success') {
|
||||
this.status = 'errorAfterSuccess'
|
||||
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull')
|
||||
this.status = 'errorAfterSuccess';
|
||||
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull');
|
||||
} else {
|
||||
this.status = 'error'
|
||||
this.status = 'error';
|
||||
}
|
||||
|
||||
// if the test is allowed to fail
|
||||
if (this.failureAllowed) {
|
||||
console.log(`please note: failure allowed!`)
|
||||
console.log(`please note: failure allowed!`);
|
||||
}
|
||||
console.log(err)
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,58 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
import { TapTest } from './tapbundle.classes.taptest'
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
import { TapTest } from './tapbundle.classes.taptest';
|
||||
|
||||
export interface IPromiseFunc {
|
||||
(): Promise<any>
|
||||
(): Promise<any>;
|
||||
}
|
||||
|
||||
export class TapTools {
|
||||
|
||||
/**
|
||||
* the referenced TapTest
|
||||
*/
|
||||
private _tapTest: TapTest
|
||||
private _tapTest: TapTest;
|
||||
|
||||
constructor (TapTestArg) {
|
||||
this._tapTest = TapTestArg
|
||||
constructor(TapTestArg) {
|
||||
this._tapTest = TapTestArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* allow failure
|
||||
*/
|
||||
allowFailure () {
|
||||
this._tapTest.failureAllowed = true
|
||||
allowFailure() {
|
||||
this._tapTest.failureAllowed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* async/await delay method
|
||||
*/
|
||||
async delayFor (timeMilliArg) {
|
||||
await plugins.smartdelay.delayFor(timeMilliArg)
|
||||
async delayFor(timeMilliArg) {
|
||||
await plugins.smartdelay.delayFor(timeMilliArg);
|
||||
}
|
||||
|
||||
async delayForRandom (timeMilliMinArg, timeMilliMaxArg) {
|
||||
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg)
|
||||
async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
||||
}
|
||||
|
||||
async timeout (timeMilliArg: number) {
|
||||
let timeout = new plugins.smartdelay.Timeout(timeMilliArg)
|
||||
timeout.makeUnrefed()
|
||||
await timeout.promise
|
||||
async timeout(timeMilliArg: number) {
|
||||
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||
timeout.makeUnrefed();
|
||||
await timeout.promise;
|
||||
if (this._tapTest.status === 'pending') {
|
||||
this._tapTest.status = 'timeout'
|
||||
this._tapTest.status = 'timeout';
|
||||
}
|
||||
}
|
||||
|
||||
async checkIterationLeak (iterationfuncArg: IPromiseFunc) {
|
||||
await plugins.leakage.iterate.async(iterationfuncArg)
|
||||
async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||
await plugins.leakage.iterate.async(iterationfuncArg);
|
||||
}
|
||||
|
||||
async returnError (throwingFuncArg: IPromiseFunc) {
|
||||
let funcErr: Error
|
||||
async returnError(throwingFuncArg: IPromiseFunc) {
|
||||
let funcErr: Error;
|
||||
try {
|
||||
await throwingFuncArg()
|
||||
await throwingFuncArg();
|
||||
} catch (err) {
|
||||
funcErr = err
|
||||
funcErr = err;
|
||||
}
|
||||
return funcErr
|
||||
return funcErr;
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
|
||||
export interface ITapWrapFunction {
|
||||
(): Promise<any>
|
||||
(): Promise<any>;
|
||||
}
|
||||
|
||||
export class TapWrap {
|
||||
wrapFunction: ITapWrapFunction
|
||||
wrapFunction: ITapWrapFunction;
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor (wrapFunctionArg: ITapWrapFunction) {
|
||||
constructor(wrapFunctionArg: ITapWrapFunction) {
|
||||
// nothing here
|
||||
this.wrapFunction = wrapFunctionArg
|
||||
this.wrapFunction = wrapFunctionArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
async run () {
|
||||
await this.wrapFunction()
|
||||
async run() {
|
||||
await this.wrapFunction();
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,6 @@
|
||||
import 'typings-global'
|
||||
import * as early from 'early'
|
||||
import * as leakage from 'leakage'
|
||||
import * as smartdelay from 'smartdelay'
|
||||
import * as smartq from 'smartq'
|
||||
import * as early from '@pushrocks/early';
|
||||
import * as leakage from 'leakage';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export {
|
||||
early,
|
||||
smartdelay,
|
||||
smartq,
|
||||
leakage
|
||||
}
|
||||
export { early, smartdelay, smartpromise, leakage };
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
|
||||
export class TapCreator {
|
||||
// TODO:
|
||||
}
|
||||
|
||||
export let tapCreator = new TapCreator()
|
||||
export let tapCreator = new TapCreator();
|
||||
|
331
yarn.lock
331
yarn.lock
@ -1,331 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/code@^4.0.3":
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/code/-/code-4.0.3.tgz#9c4de39f86eb3eba070146d2dab7dbc3f8eac35f"
|
||||
|
||||
"@types/glob@*":
|
||||
version "5.0.33"
|
||||
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.33.tgz#3dff7c6ce09d65abe919c7961dc3dee016f36ad7"
|
||||
dependencies:
|
||||
"@types/minimatch" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/minimatch@*":
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.1.tgz#b683eb60be358304ef146f5775db4c0e3696a550"
|
||||
|
||||
"@types/node@*", "@types/node@^8.0.33":
|
||||
version "8.0.33"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd"
|
||||
|
||||
"@types/shelljs@^0.7.4":
|
||||
version "0.7.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc"
|
||||
dependencies:
|
||||
"@types/glob" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/which@^1.0.28":
|
||||
version "1.0.28"
|
||||
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
|
||||
|
||||
ansi-256-colors@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
||||
|
||||
array-uniq@1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.2.tgz#5fcc373920775723cfd64d65c64bef53bf9eba6d"
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||
|
||||
beautycolor@^1.0.7:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
|
||||
dependencies:
|
||||
ansi-256-colors "^1.1.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
bindings@^1.2.1:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.8"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
||||
dependencies:
|
||||
balanced-match "^1.0.0"
|
||||
concat-map "0.0.1"
|
||||
|
||||
code@^5.1.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/code/-/code-5.1.0.tgz#205e4213536c3cf21b12194384901fadcd81bc1a"
|
||||
dependencies:
|
||||
hoek "4.x.x"
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
|
||||
define-properties@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
|
||||
dependencies:
|
||||
foreach "^2.0.5"
|
||||
object-keys "^1.0.8"
|
||||
|
||||
early@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
||||
dependencies:
|
||||
beautycolor "^1.0.7"
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
es-abstract@^1.5.1:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.9.0.tgz#690829a07cae36b222e7fd9b75c0d0573eb25227"
|
||||
dependencies:
|
||||
es-to-primitive "^1.1.1"
|
||||
function-bind "^1.1.1"
|
||||
has "^1.0.1"
|
||||
is-callable "^1.1.3"
|
||||
is-regex "^1.0.4"
|
||||
|
||||
es-to-primitive@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
|
||||
dependencies:
|
||||
is-callable "^1.1.1"
|
||||
is-date-object "^1.0.1"
|
||||
is-symbol "^1.0.1"
|
||||
|
||||
es6-error@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
|
||||
|
||||
foreach@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
|
||||
function-bind@^1.0.2, function-bind@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
|
||||
glob@^7.0.0:
|
||||
version "7.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.4"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
has@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
|
||||
dependencies:
|
||||
function-bind "^1.0.2"
|
||||
|
||||
hoek@4.x.x:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d"
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
dependencies:
|
||||
once "^1.3.0"
|
||||
wrappy "1"
|
||||
|
||||
inherits@2:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
|
||||
interpret@^1.0.0:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0"
|
||||
|
||||
is-callable@^1.1.1, is-callable@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
|
||||
|
||||
is-date-object@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
|
||||
|
||||
is-regex@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
||||
dependencies:
|
||||
has "^1.0.1"
|
||||
|
||||
is-symbol@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
|
||||
leakage@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
|
||||
dependencies:
|
||||
es6-error "^4.0.2"
|
||||
left-pad "^1.1.3"
|
||||
memwatch-next "^0.3.0"
|
||||
minimist "^1.2.0"
|
||||
pretty-bytes "^4.0.2"
|
||||
|
||||
left-pad@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
||||
|
||||
memwatch-next@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
||||
dependencies:
|
||||
bindings "^1.2.1"
|
||||
nan "^2.3.2"
|
||||
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||
|
||||
nan@^2.3.2:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46"
|
||||
|
||||
object-keys@^1.0.8:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
|
||||
|
||||
object.getownpropertydescriptors@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.5.1"
|
||||
|
||||
once@^1.3.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
path-is-absolute@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||
|
||||
path-parse@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
|
||||
|
||||
pretty-bytes@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||
|
||||
randomstring@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/randomstring/-/randomstring-1.1.5.tgz#6df0628f75cbd5932930d9fe3ab4e956a18518c3"
|
||||
dependencies:
|
||||
array-uniq "1.0.2"
|
||||
|
||||
rechoir@^0.6.2:
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
||||
dependencies:
|
||||
resolve "^1.1.6"
|
||||
|
||||
resolve@^1.1.6:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
|
||||
dependencies:
|
||||
path-parse "^1.0.5"
|
||||
|
||||
semver@^5.3.0:
|
||||
version "5.4.1"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
|
||||
|
||||
shelljs@^0.7.8:
|
||||
version "0.7.8"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
smartchai@^1.0.3:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902"
|
||||
dependencies:
|
||||
"@types/code" "^4.0.3"
|
||||
code "^5.1.0"
|
||||
typings-global "^1.0.20"
|
||||
|
||||
smartdelay@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.4.tgz#791c1a4ee6770494064c10b1d2d2b8e6f3105b82"
|
||||
dependencies:
|
||||
smartq "^1.1.1"
|
||||
typings-global "^1.0.16"
|
||||
|
||||
smartq@^1.1.1, smartq@^1.1.6:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
|
||||
dependencies:
|
||||
typings-global "^1.0.19"
|
||||
util.promisify "^1.0.0"
|
||||
|
||||
smartshell@^1.0.6:
|
||||
version "1.0.18"
|
||||
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.18.tgz#b84ccc65cedf3a875bf676cec78ee07f4b4aa9e5"
|
||||
dependencies:
|
||||
"@types/shelljs" "^0.7.4"
|
||||
"@types/which" "^1.0.28"
|
||||
shelljs "^0.7.8"
|
||||
smartq "^1.1.6"
|
||||
typings-global "^1.0.20"
|
||||
which "^1.3.0"
|
||||
|
||||
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20:
|
||||
version "1.0.20"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.20.tgz#3da769c54db538247c5d877d1d9e97eb2ec981ff"
|
||||
dependencies:
|
||||
semver "^5.3.0"
|
||||
smartshell "^1.0.6"
|
||||
|
||||
util.promisify@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
object.getownpropertydescriptors "^2.0.3"
|
||||
|
||||
which@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
Reference in New Issue
Block a user