Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3ae0bc211 | |||
0381f63b65 | |||
f1441bf123 | |||
9892085140 | |||
b6d1c3c083 | |||
6e6cfbadbd | |||
02ff220c59 | |||
035cb84442 | |||
505f624dd9 | |||
ea5fbd4637 | |||
de780538a5 | |||
28b1f0bfed | |||
72b72a9ffb | |||
be393199be | |||
7b6260bb15 | |||
2345e972d5 | |||
22c44a8cd0 | |||
bae2aebf83 | |||
5fe2358bfe | |||
280ded573d | |||
6b6a92b709 | |||
c1589c2309 | |||
271d657f2c | |||
63669ea6ff | |||
4306272f45 | |||
4378b36069 | |||
e8f7013435 | |||
3199943b59 | |||
0028c5492b | |||
e3b05cc43c | |||
f68da622d7 | |||
b7e57e8cdc | |||
93b46a1446 | |||
ca3ea788fd | |||
94a1bd4839 | |||
6c960f9fbd | |||
f2eddb169f | |||
ad2da38289 | |||
301b82a0fb | |||
d28609b513 | |||
d82d4e2eae | |||
d105bab740 | |||
a03bcf4583 | |||
2b21566fe1 | |||
d22fc1b688 | |||
15bbf7f10c | |||
c5e068d5cd | |||
95fa33df58 | |||
42933e6bb0 |
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,4 +1,22 @@
|
||||
node_modules/
|
||||
.nogit/
|
||||
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
|
||||
# caches
|
||||
.yarn/
|
||||
.cache/
|
||||
.rpt2_cache
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
|
||||
# custom
|
@ -1,71 +1,105 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .yarn/
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
- metadata
|
||||
|
||||
testLEGACY:
|
||||
stage: test
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci test legacy
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test lts
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test stable
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci publish
|
||||
- npmci node install lts
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: trigger
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- 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 @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
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: {}
|
80
README.md
80
README.md
@ -1,26 +1,72 @@
|
||||
# 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/)
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/tapbundle)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/tapbundle)
|
||||
* [docs (typedoc)](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)
|
||||
[](https://david-dm.org/pushrocks/tapbundle)
|
||||
[](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm)
|
||||
[](https://www.bithound.io/github/pushrocks/tapbundle)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[](http://standardjs.com/)
|
||||
[](https://gitlab.com/pushrocks/tapbundle/commits/master)
|
||||
[](https://gitlab.com/pushrocks/tapbundle/commits/master)
|
||||
[](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
||||
[](https://snyk.io/test/npm/@pushrocks/tapbundle)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
|
||||
For further information read the linked docs at the top of this README.
|
||||
## Usage
|
||||
|
||||
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)
|
||||
|
||||
[](https://push.rocks)
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
4
dist/index.d.ts
vendored
4
dist/index.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
import 'typings-global';
|
||||
import { expect } from 'smartchai';
|
||||
import { tap } from './tapbundle.classes.tap';
|
||||
export { tap, expect };
|
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");
|
||||
const smartchai_1 = require("smartchai");
|
||||
exports.expect = smartchai_1.expect;
|
||||
const tapbundle_classes_tap_1 = require("./tapbundle.classes.tap");
|
||||
exports.tap = tapbundle_classes_tap_1.tap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix5Q0FBa0M7QUFLaEMsaUJBTE8sa0JBQU0sQ0FLUDtBQUpSLG1FQUE2QztBQUczQyxjQUhPLDJCQUFHLENBR1AifQ==
|
34
dist/tapbundle.classes.tap.d.ts
vendored
34
dist/tapbundle.classes.tap.d.ts
vendored
@ -1,34 +0,0 @@
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||
export declare class Tap {
|
||||
skip: {
|
||||
test: (...args: any[]) => void;
|
||||
};
|
||||
private _tests;
|
||||
/**
|
||||
* 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>;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* tests leakage
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testLeakage(testDescription: string, testFunction: ITestFunction): void;
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
start(): Promise<void>;
|
||||
/**
|
||||
* handle errors
|
||||
*/
|
||||
threw(err: any): void;
|
||||
}
|
||||
export declare let tap: Tap;
|
90
dist/tapbundle.classes.tap.js
vendored
90
dist/tapbundle.classes.tap.js
vendored
@ -1,90 +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");
|
||||
class Tap {
|
||||
constructor() {
|
||||
this.skip = {
|
||||
test: (...args) => {
|
||||
console.log('skipped');
|
||||
}
|
||||
};
|
||||
this._tests = [];
|
||||
}
|
||||
/**
|
||||
* 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._tests.push(localTest);
|
||||
return localTest;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 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._tests.push(new tapbundle_classes_taptest_1.TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: true
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* tests leakage
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testLeakage(testDescription, testFunction) {
|
||||
}
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
start() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let promiseArray = [];
|
||||
// safeguard against empty test array
|
||||
if (this._tests.length === 0) {
|
||||
console.log('no tests specified. Ending here!');
|
||||
return;
|
||||
}
|
||||
console.log(`1..${this._tests.length}`);
|
||||
for (let testKey = 0; testKey < this._tests.length; testKey++) {
|
||||
let currentTest = this._tests[testKey];
|
||||
let testPromise = currentTest.run(testKey);
|
||||
if (currentTest.parallel) {
|
||||
promiseArray.push(testPromise);
|
||||
}
|
||||
else {
|
||||
yield testPromise;
|
||||
}
|
||||
}
|
||||
yield Promise.all(promiseArray);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* handle errors
|
||||
*/
|
||||
threw(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
exports.Tap = Tap;
|
||||
exports.tap = new Tap();
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFwYnVuZGxlLmNsYXNzZXMudGFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyRUFBb0U7QUFFcEU7SUFBQTtRQUNFLFNBQUksR0FBRztZQUNMLElBQUksRUFBRSxDQUFDLEdBQUcsSUFBSTtnQkFDWixPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFBO1lBQ3hCLENBQUM7U0FDRixDQUFBO1FBRU8sV0FBTSxHQUFjLEVBQUUsQ0FBQTtJQXNFaEMsQ0FBQztJQXBFQzs7OztPQUlHO0lBQ0csSUFBSSxDQUFDLGVBQXVCLEVBQUUsWUFBMkI7O1lBQzdELElBQUksU0FBUyxHQUFHLElBQUksbUNBQU8sQ0FBQztnQkFDMUIsV0FBVyxFQUFFLGVBQWU7Z0JBQzVCLFlBQVksRUFBRSxZQUFZO2dCQUMxQixRQUFRLEVBQUUsS0FBSzthQUNoQixDQUFDLENBQUE7WUFDRixJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtZQUMzQixNQUFNLENBQUMsU0FBUyxDQUFBO1FBQ2xCLENBQUM7S0FBQTtJQUVEOzs7O09BSUc7SUFDSCxZQUFZLENBQUMsZUFBdUIsRUFBRSxZQUEyQjtRQUMvRCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLG1DQUFPLENBQUM7WUFDM0IsV0FBVyxFQUFFLGVBQWU7WUFDNUIsWUFBWSxFQUFFLFlBQVk7WUFDMUIsUUFBUSxFQUFFLElBQUk7U0FDZixDQUFDLENBQUMsQ0FBQTtJQUNMLENBQUM7SUFFRDs7OztPQUlHO0lBQ0gsV0FBVyxDQUFDLGVBQXVCLEVBQUUsWUFBMkI7SUFFaEUsQ0FBQztJQUVEOztPQUVHO0lBQ0csS0FBSzs7WUFDVCxJQUFJLFlBQVksR0FBbUIsRUFBRSxDQUFBO1lBRXJDLHFDQUFxQztZQUNyQyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLE1BQU0sS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUM3QixPQUFPLENBQUMsR0FBRyxDQUFDLGtDQUFrQyxDQUFDLENBQUE7Z0JBQy9DLE1BQU0sQ0FBQTtZQUNSLENBQUM7WUFFRCxPQUFPLENBQUMsR0FBRyxDQUFDLE1BQU0sSUFBSSxDQUFDLE1BQU0sQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFBO1lBQ3ZDLEdBQUcsQ0FBQyxDQUFDLElBQUksT0FBTyxHQUFHLENBQUMsRUFBRSxPQUFPLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxNQUFNLEVBQUUsT0FBTyxFQUFFLEVBQUUsQ0FBQztnQkFDOUQsSUFBSSxXQUFXLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBRSxPQUFPLENBQUUsQ0FBQTtnQkFDeEMsSUFBSSxXQUFXLEdBQUcsV0FBVyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQTtnQkFDMUMsRUFBRSxDQUFDLENBQUMsV0FBVyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUM7b0JBQ3pCLFlBQVksQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7Z0JBQ2hDLENBQUM7Z0JBQUMsSUFBSSxDQUFDLENBQUM7b0JBQ04sTUFBTSxXQUFXLENBQUE7Z0JBQ25CLENBQUM7WUFDSCxDQUFDO1lBQ0QsTUFBTSxPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxDQUFBO1FBQ2pDLENBQUM7S0FBQTtJQUVEOztPQUVHO0lBQ0gsS0FBSyxDQUFDLEdBQUc7UUFDUCxPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBQ2xCLENBQUM7Q0FDRjtBQTdFRCxrQkE2RUM7QUFFVSxRQUFBLEdBQUcsR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFBIn0=
|
30
dist/tapbundle.classes.taptest.d.ts
vendored
30
dist/tapbundle.classes.taptest.d.ts
vendored
@ -1,30 +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;
|
||||
testDeferred: Deferred<TapTest>;
|
||||
testPromise: Promise<TapTest>;
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
constructor(optionsArg: {
|
||||
description: string;
|
||||
testFunction: ITestFunction;
|
||||
parallel: boolean;
|
||||
});
|
||||
/**
|
||||
* run the test
|
||||
*/
|
||||
run(testKeyArg: number): Promise<void>;
|
||||
}
|
64
dist/tapbundle.classes.taptest.js
vendored
64
dist/tapbundle.classes.taptest.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");
|
||||
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();
|
||||
try {
|
||||
yield this.testFunction(this.tapTools);
|
||||
if (this.status === 'timeout') {
|
||||
throw new Error('Test succeeded, but timed out...');
|
||||
}
|
||||
this.hrtMeasurement.stop();
|
||||
console.log(`ok ${testKeyArg + 1} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`);
|
||||
this.status = 'success';
|
||||
this.testDeferred.resolve(this);
|
||||
}
|
||||
catch (err) {
|
||||
this.hrtMeasurement.stop();
|
||||
console.log(`not ok ${testKeyArg + 1} - ${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');
|
||||
}
|
||||
// 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3RhcGJ1bmRsZS5jbGFzc2VzLnRhcHRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLCtDQUE4QztBQUU5Qyw2RUFBdUQ7QUFFdkQsc0JBQXNCO0FBQ3RCLGlDQUFzQztBQVd0QztJQVVFOztPQUVHO0lBQ0gsWUFBYSxVQUlaO1FBVEQsaUJBQVksR0FBc0IsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUN4RCxnQkFBVyxHQUFxQixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQTtRQVN2RCxJQUFJLENBQUMsV0FBVyxHQUFHLFVBQVUsQ0FBQyxXQUFXLENBQUE7UUFDekMsSUFBSSxDQUFDLGNBQWMsR0FBRyxJQUFJLHNCQUFjLEVBQUUsQ0FBQTtRQUMxQyxJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUE7UUFDbkMsSUFBSSxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUE7UUFDdkIsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLHFDQUFRLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDbEMsSUFBSSxDQUFDLFlBQVksR0FBRyxVQUFVLENBQUMsWUFBWSxDQUFBO0lBQzdDLENBQUM7SUFFRDs7T0FFRztJQUNHLEdBQUcsQ0FBRSxVQUFrQjs7WUFDM0IsSUFBSSxDQUFDLGNBQWMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtZQUMzQixJQUFJLENBQUM7Z0JBQ0gsTUFBTSxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQTtnQkFDdEMsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDO29CQUM5QixNQUFNLElBQUksS0FBSyxDQUFFLGtDQUFrQyxDQUFDLENBQUE7Z0JBQ3RELENBQUM7Z0JBQ0QsSUFBSSxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtnQkFDMUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNLFVBQVUsR0FBRyxDQUFDLE1BQU0sSUFBSSxDQUFDLFdBQVcsV0FBVyxJQUFJLENBQUMsY0FBYyxDQUFDLFlBQVksSUFBSSxDQUFDLENBQUE7Z0JBQ3RHLElBQUksQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFBO2dCQUN2QixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQTtZQUNqQyxDQUFDO1lBQUMsS0FBSyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDYixJQUFJLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxDQUFBO2dCQUMxQixPQUFPLENBQUMsR0FBRyxDQUFDLFVBQVUsVUFBVSxHQUFHLENBQUMsTUFBTSxJQUFJLENBQUMsV0FBVyxXQUFXLElBQUksQ0FBQyxjQUFjLENBQUMsWUFBWSxJQUFJLENBQUMsQ0FBQTtnQkFDMUcsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUE7Z0JBRS9CLDJDQUEyQztnQkFDM0MsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDO29CQUM5QixJQUFJLENBQUMsTUFBTSxHQUFHLG1CQUFtQixDQUFBO29CQUNqQyxPQUFPLENBQUMsR0FBRyxDQUFDLHlFQUF5RSxDQUFDLENBQUE7Z0JBQ3hGLENBQUM7Z0JBRUQsaUNBQWlDO2dCQUNqQyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztvQkFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQywrQkFBK0IsQ0FBQyxDQUFBO2dCQUM5QyxDQUFDO2dCQUNELE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7WUFDbEIsQ0FBQztRQUNILENBQUM7S0FBQTtDQUNGO0FBMURELDBCQTBEQyJ9
|
16
dist/tapbundle.classes.taptools.d.ts
vendored
16
dist/tapbundle.classes.taptools.d.ts
vendored
@ -1,16 +0,0 @@
|
||||
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>;
|
||||
timeout(timeMilliArg: number): Promise<void>;
|
||||
}
|
40
dist/tapbundle.classes.taptools.js
vendored
40
dist/tapbundle.classes.taptools.js
vendored
@ -1,40 +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);
|
||||
});
|
||||
}
|
||||
timeout(timeMilliArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield plugins.smartdelay.delayFor(timeMilliArg);
|
||||
if (this._tapTest.status === 'pending') {
|
||||
this._tapTest.status = 'timeout';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TapTools = TapTools;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUuY2xhc3Nlcy50YXB0b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBRzlDO0lBT0UsWUFBWSxVQUFVO1FBQ3BCLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFBO0lBQzVCLENBQUM7SUFFRDs7T0FFRztJQUNILFlBQVk7UUFDVixJQUFJLENBQUMsUUFBUSxDQUFDLGNBQWMsR0FBRyxJQUFJLENBQUE7SUFDckMsQ0FBQztJQUVEOztPQUVHO0lBQ0csUUFBUSxDQUFDLFlBQVk7O1lBQ3pCLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakQsQ0FBQztLQUFBO0lBRUssT0FBTyxDQUFFLFlBQW9COztZQUNqQyxNQUFNLE9BQU8sQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLFlBQVksQ0FBQyxDQUFBO1lBQy9DLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxLQUFLLFNBQVMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3ZDLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQTtZQUNsQyxDQUFDO1FBQ0gsQ0FBQztLQUFBO0NBRUY7QUFoQ0QsNEJBZ0NDIn0=
|
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,79 +0,0 @@
|
||||
# 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)
|
||||
[](https://david-dm.org/pushrocks/tapbundle)
|
||||
[](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm)
|
||||
[](https://www.bithound.io/github/pushrocks/tapbundle)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
[](http://standardjs.com/)
|
||||
|
||||
## Usage
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
This package includes
|
||||
|
||||
* tap compatible testing framework written in TypeScript
|
||||
* npm package chai (through smartchai)
|
||||
* npm package chai-as-promised (through smartchai)
|
||||
* npm package chai-string (through smartchai)
|
||||
* npm package @types/chai (through smartchai)
|
||||
* npm package @types/chai-as-promised (through smartchai)
|
||||
* npm package @types/chai-string (through smartchai)
|
||||
|
||||
It also implements its own tap testing engine, that is fully typed.
|
||||
|
||||
In other words: This package is fully typed :)
|
||||
|
||||
|
||||
### Get started with writing your first test file.
|
||||
```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)
|
||||
|
||||
[](https://push.rocks)
|
87
docs/mkdocs.yml
Normal file
87
docs/mkdocs.yml
Normal file
@ -0,0 +1,87 @@
|
||||
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
# Project information
|
||||
site_name: tapbundle | docs
|
||||
site_description: a taprunner
|
||||
site_author: Lossless GmbH
|
||||
site_url: https://push.rocks
|
||||
|
||||
# Repository
|
||||
repo_name: pushrocks/tapbundle
|
||||
repo_url: https://gitlab.com/pushrocks/tapbundle
|
||||
|
||||
# Copyright
|
||||
copyright: 'Copyright © 2014 Lossless GmbH'
|
||||
|
||||
# Theme directory
|
||||
theme: material
|
||||
theme_dir: 'theme'
|
||||
|
||||
# Options
|
||||
extra:
|
||||
feature:
|
||||
tabs: false
|
||||
palette:
|
||||
primary: indigo
|
||||
accent: indigo
|
||||
social:
|
||||
- type: globe
|
||||
link: http://lossless.com
|
||||
- type: github-alt
|
||||
link: https://github.com/philkunz
|
||||
- type: twitter
|
||||
link: https://twitter.com/philkunzcom
|
||||
- type: linkedin
|
||||
link: https://linkedin.com/in/philippkunz
|
||||
|
||||
# Extensions
|
||||
markdown_extensions:
|
||||
- markdown.extensions.admonition
|
||||
- markdown.extensions.codehilite(guess_lang=false, linenums=true)
|
||||
- markdown.extensions.def_list
|
||||
- markdown.extensions.footnotes
|
||||
- markdown.extensions.meta
|
||||
- markdown.extensions.toc(permalink=true)
|
||||
- pymdownx.arithmatex
|
||||
- pymdownx.betterem(smart_enable=all)
|
||||
- pymdownx.caret
|
||||
- pymdownx.critic
|
||||
- pymdownx.details
|
||||
- pymdownx.emoji:
|
||||
emoji_generator: !!python/name:pymdownx.emoji.to_svg
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.magiclink
|
||||
- pymdownx.mark
|
||||
- pymdownx.smartsymbols
|
||||
- pymdownx.superfences
|
||||
- pymdownx.tasklist(custom_checkbox=true)
|
||||
- pymdownx.tilde
|
||||
|
||||
# Page tree
|
||||
pages:
|
||||
- Repo Readme: index.md
|
||||
- Get Started: getstarted.md
|
||||
- License: license.md
|
||||
|
||||
# Google Analytics
|
||||
google_analytics:
|
||||
- !!python/object/apply:os.getenv ["GOOGLE_ANALYTICS_KEY"]
|
||||
- auto
|
56
docs/theme/partials/footer.html
vendored
Normal file
56
docs/theme/partials/footer.html
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
{% import "partials/language.html" as lang %}
|
||||
<footer class="md-footer">
|
||||
{% if page.previous_page or page.next_page %}
|
||||
<div class="md-footer-nav">
|
||||
<nav class="md-footer-nav__inner md-grid">
|
||||
{% if page.previous_page %}
|
||||
<a href="{{ page.previous_page.url }}" title="{{ page.previous_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||
<div class="md-flex__cell md-flex__cell--shrink">
|
||||
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||
</div>
|
||||
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||
<span class="md-flex__ellipsis">
|
||||
<span class="md-footer-nav__direction">
|
||||
{{ lang.t("footer.previous") }}
|
||||
</span>
|
||||
{{ page.previous_page.title }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if page.next_page %}
|
||||
<a href="{{ page.next_page.url }}" title="{{ page.next_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||
<span class="md-flex__ellipsis">
|
||||
<span class="md-footer-nav__direction">
|
||||
{{ lang.t("footer.next") }}
|
||||
</span>
|
||||
{{ page.next_page.title }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="md-flex__cell md-flex__cell--shrink">
|
||||
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="md-footer-meta md-typeset">
|
||||
<div class="md-footer-meta__inner md-grid">
|
||||
<div class="md-footer-copyright">
|
||||
{% if config.copyright %}
|
||||
<div class="md-footer-copyright__highlight">
|
||||
{{ config.copyright }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<a href="https://lossless.gmbh" title="push.rocks">Impressum</a>
|
||||
|
|
||||
<a href="https://lossless.com" title="Lossless GmbH">Company Website</a>
|
||||
</div>
|
||||
{% block social %}
|
||||
{% include "partials/social.html" %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
22
license
Normal file
22
license
Normal file
@ -0,0 +1,22 @@
|
||||
**MIT License**
|
||||
|
||||
Copright © 2016 Lossless GmbH
|
||||
Copyright © 2016 - 2017 Martin Donath
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
@ -1,7 +1,21 @@
|
||||
{
|
||||
"npmci": {
|
||||
"globalNpmTools": [
|
||||
"npmts"
|
||||
]
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"npmts": {
|
||||
"testConfig": {
|
||||
"parallel": false
|
||||
}
|
||||
},
|
||||
"gitzone": {
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitrepo": "tapbundle",
|
||||
"shortDescription": "tap bundled for tapbuffer",
|
||||
"npmPackagename": "@pushrocks/tapbundle",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
1738
package-lock.json
generated
Normal file
1738
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "tapbundle",
|
||||
"version": "1.0.13",
|
||||
"name": "@pushrocks/tapbundle",
|
||||
"private": false,
|
||||
"version": "3.0.11",
|
||||
"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,11 +20,29 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
||||
"dependencies": {
|
||||
"early": "^2.1.1",
|
||||
"leakage": "^0.2.0",
|
||||
"smartchai": "^1.0.3",
|
||||
"smartdelay": "^1.0.1",
|
||||
"smartq": "^1.1.1",
|
||||
"typings-global": "^1.0.16"
|
||||
}
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"leakage": "^0.4.0",
|
||||
"smartchai": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.11",
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
"@gitzone/tstest": "^1.0.24",
|
||||
"@types/node": "^12.0.8",
|
||||
"randomstring": "^1.1.5",
|
||||
"tslint": "^5.17.0",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/*",
|
||||
"ts_web/*",
|
||||
"dist/*",
|
||||
"dist_web/*",
|
||||
"assets/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
}
|
||||
|
23
test/test.iterationleak.ts
Normal file
23
test/test.iterationleak.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { tap, expect } from '../ts/index';
|
||||
import * as randomstring from 'randomstring';
|
||||
|
||||
const test1 = tap.test('my first test -> expect true to be true', async tools => {
|
||||
await tools.checkIterationLeak(async () => {
|
||||
const domain = randomstring.generate(1000);
|
||||
});
|
||||
});
|
||||
|
||||
const outsideArray = [];
|
||||
|
||||
const test2 = tap.test('should throw', async tools => {
|
||||
const err = await tools.returnError(async () => {
|
||||
await tools.checkIterationLeak(async () => {
|
||||
outsideArray.push(randomstring.generate(1000));
|
||||
});
|
||||
});
|
||||
if (!process.version.startsWith('v11')) {
|
||||
expect(err).to.be.instanceof(Error);
|
||||
}
|
||||
});
|
||||
|
||||
tap.start();
|
10
test/test.tapwrap.ts
Normal file
10
test/test.tapwrap.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { tap, expect } from '../ts/index';
|
||||
|
||||
const tapwrap = tap.wrap(async () => {
|
||||
tap.test('should do something', async () => {
|
||||
console.log('test1');
|
||||
});
|
||||
tap.start();
|
||||
});
|
||||
|
||||
tapwrap.run();
|
54
test/test.ts
54
test/test.ts
@ -1,32 +1,36 @@
|
||||
import { tap, expect } from '../dist/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
|
||||
})
|
||||
const test1 = tap.test('my first test -> expect true to be true', async () => {
|
||||
return expect(true).to.be.true;
|
||||
});
|
||||
|
||||
let test2 = tap.test('my second test', async (tools) => {
|
||||
await tools.delayFor(1000)
|
||||
})
|
||||
const 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
|
||||
})
|
||||
const 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
|
||||
})
|
||||
const 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)
|
||||
})
|
||||
const 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)
|
||||
})
|
||||
const 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();
|
||||
|
10
ts/index.ts
10
ts/index.ts
@ -1,8 +1,2 @@
|
||||
import 'typings-global'
|
||||
import { expect } from 'smartchai'
|
||||
import { tap } from './tapbundle.classes.tap'
|
||||
|
||||
export {
|
||||
tap,
|
||||
expect
|
||||
}
|
||||
export { expect } from 'smartchai';
|
||||
export { tap } from './tapbundle.classes.tap';
|
||||
|
@ -1,29 +1,61 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest'
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
|
||||
export class Tap {
|
||||
/**
|
||||
* skips a test
|
||||
* tests marked with tap.skip.test() are never executed
|
||||
*/
|
||||
skip = {
|
||||
test: (...args) => {
|
||||
console.log('skipped')
|
||||
}
|
||||
test: (descriptionArg: string, functionArg: ITestFunction) => {
|
||||
console.log(`skipped test: ${descriptionArg}`);
|
||||
},
|
||||
testParallel: (descriptionArg: string, functionArg: ITestFunction) => {
|
||||
console.log(`skipped test: ${descriptionArg}`);
|
||||
}
|
||||
};
|
||||
|
||||
private _tests: TapTest[] = []
|
||||
/**
|
||||
* only executes tests marked as ONLY
|
||||
*/
|
||||
only = {
|
||||
test: (descriptionArg: string, testFunctionArg: ITestFunction) => {
|
||||
this.test(descriptionArg, testFunctionArg, 'only');
|
||||
}
|
||||
};
|
||||
|
||||
private _tapTests: TapTest[] = [];
|
||||
private _tapTestsOnly: 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,
|
||||
modeArg: 'normal' | 'only' | 'skip' = 'normal'
|
||||
) {
|
||||
let localTest = new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: false
|
||||
})
|
||||
this._tests.push(localTest)
|
||||
return localTest
|
||||
});
|
||||
if (modeArg === 'normal') {
|
||||
this._tapTests.push(localTest);
|
||||
} else if (modeArg === 'only') {
|
||||
this._tapTestsOnly.push(localTest);
|
||||
}
|
||||
return localTest;
|
||||
}
|
||||
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap(functionArg: ITapWrapFunction) {
|
||||
return new TapWrap(functionArg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,54 +64,77 @@ export class Tap {
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testParallel(testDescription: string, testFunction: ITestFunction) {
|
||||
this._tests.push(new TapTest({
|
||||
this._tapTests.push(
|
||||
new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: true
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* tests leakage
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testLeakage(testDescription: string, testFunction: ITestFunction) {
|
||||
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
async start() {
|
||||
let promiseArray: Promise<any>[] = []
|
||||
async start(optionsArg?: { throwOnError: boolean }) {
|
||||
let promiseArray: Promise<any>[] = [];
|
||||
|
||||
// safeguard against empty test array
|
||||
if (this._tests.length === 0) {
|
||||
console.log('no tests specified. Ending here!')
|
||||
return
|
||||
if (this._tapTests.length === 0) {
|
||||
console.log('no tests specified. Ending here!');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`1..${this._tests.length}`)
|
||||
for (let testKey = 0; testKey < this._tests.length; testKey++) {
|
||||
let currentTest = this._tests[ testKey ]
|
||||
let testPromise = currentTest.run(testKey)
|
||||
if (currentTest.parallel) {
|
||||
promiseArray.push(testPromise)
|
||||
// determine which tests to run
|
||||
let concerningTests: TapTest[];
|
||||
if (this._tapTestsOnly.length > 0) {
|
||||
concerningTests = this._tapTestsOnly;
|
||||
} else {
|
||||
await testPromise
|
||||
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);
|
||||
if (currentTest.parallel) {
|
||||
promiseArray.push(testPromise);
|
||||
} else {
|
||||
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[] = [];
|
||||
// collect failed tests
|
||||
for (let tapTest of concerningTests) {
|
||||
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)
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
export let tap = new Tap()
|
||||
|
||||
export let tap = new Tap();
|
||||
|
@ -1,75 +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 '@pushrocks/smartpromise';
|
||||
|
||||
// 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
|
||||
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.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 ${testKeyArg + 1} - ${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 ${testKeyArg + 1} - ${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';
|
||||
}
|
||||
|
||||
// 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,36 +1,66 @@
|
||||
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>;
|
||||
}
|
||||
|
||||
export class TapTools {
|
||||
|
||||
/**
|
||||
* the referenced TapTest
|
||||
*/
|
||||
private _tapTest: TapTest
|
||||
private _tapTest: TapTest;
|
||||
|
||||
constructor(TapTestArg) {
|
||||
this._tapTest = TapTestArg
|
||||
this._tapTest = TapTestArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* allow failure
|
||||
*/
|
||||
allowFailure() {
|
||||
this._tapTest.failureAllowed = true
|
||||
public allowFailure() {
|
||||
this._tapTest.failureAllowed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* async/await delay method
|
||||
*/
|
||||
async delayFor(timeMilliArg) {
|
||||
await plugins.smartdelay.delayFor(timeMilliArg)
|
||||
public async delayFor(timeMilliArg) {
|
||||
await plugins.smartdelay.delayFor(timeMilliArg);
|
||||
}
|
||||
|
||||
async timeout (timeMilliArg: number) {
|
||||
await plugins.smartdelay.delayFor(timeMilliArg)
|
||||
public async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
||||
}
|
||||
|
||||
public async timeout(timeMilliArg: number) {
|
||||
const timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||
timeout.makeUnrefed();
|
||||
await timeout.promise;
|
||||
if (this._tapTest.status === 'pending') {
|
||||
this._tapTest.status = 'timeout'
|
||||
this._tapTest.status = 'timeout';
|
||||
}
|
||||
}
|
||||
|
||||
public async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||
if (process.version.startsWith('v11')) {
|
||||
console.log('iteration leakage checks disabled for now on version 11 due to low performance');
|
||||
} else {
|
||||
await plugins.leakage.iterate.async(iterationfuncArg);
|
||||
}
|
||||
}
|
||||
|
||||
public async returnError(throwingFuncArg: IPromiseFunc) {
|
||||
let funcErr: Error;
|
||||
try {
|
||||
await throwingFuncArg();
|
||||
} catch (err) {
|
||||
funcErr = err;
|
||||
}
|
||||
return funcErr;
|
||||
}
|
||||
|
||||
public defer() {
|
||||
return plugins.smartpromise.defer();
|
||||
}
|
||||
}
|
||||
|
24
ts/tapbundle.classes.tapwrap.ts
Normal file
24
ts/tapbundle.classes.tapwrap.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import * as plugins from './tapbundle.plugins';
|
||||
|
||||
export interface ITapWrapFunction {
|
||||
(): Promise<any>;
|
||||
}
|
||||
|
||||
export class TapWrap {
|
||||
wrapFunction: ITapWrapFunction;
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor(wrapFunctionArg: ITapWrapFunction) {
|
||||
// nothing here
|
||||
this.wrapFunction = wrapFunctionArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
async run() {
|
||||
await this.wrapFunction();
|
||||
}
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
import 'typings-global'
|
||||
import * as early from 'early'
|
||||
import * as leakage from 'leakage'
|
||||
import * as smartdelay from 'smartdelay'
|
||||
import * as smartq from 'smartq'
|
||||
// pushrocks
|
||||
import * as early from '@pushrocks/early';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export {
|
||||
early,
|
||||
smartdelay,
|
||||
smartq,
|
||||
leakage
|
||||
}
|
||||
export { early, smartdelay, smartpromise };
|
||||
|
||||
// third party
|
||||
import * as leakage from 'leakage';
|
||||
|
||||
export { 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();
|
||||
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
||||
{
|
||||
"extends": "tslint-config-standard"
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
|
247
yarn.lock
247
yarn.lock
@ -1,247 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/chai-as-promised@0.0.29":
|
||||
version "0.0.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
||||
dependencies:
|
||||
"@types/chai" "*"
|
||||
"@types/promises-a-plus" "*"
|
||||
|
||||
"@types/chai-string@^1.1.30":
|
||||
version "1.1.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
||||
dependencies:
|
||||
"@types/chai" "*"
|
||||
|
||||
"@types/chai@*", "@types/chai@^3.4.35":
|
||||
version "3.4.35"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.35.tgz#e8d65f83492d2944f816fc620741821c28a8c900"
|
||||
|
||||
"@types/promises-a-plus@*":
|
||||
version "0.0.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||
|
||||
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"
|
||||
|
||||
assertion-error@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
||||
|
||||
balanced-match@^0.4.1:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
||||
|
||||
beautycolor@^1.0.7:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
|
||||
dependencies:
|
||||
ansi-256-colors "^1.1.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
bindings@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
||||
|
||||
brace-expansion@^1.0.0:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
|
||||
dependencies:
|
||||
balanced-match "^0.4.1"
|
||||
concat-map "0.0.1"
|
||||
|
||||
chai-as-promised@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
||||
dependencies:
|
||||
check-error "^1.0.2"
|
||||
|
||||
chai-string@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7"
|
||||
|
||||
chai@^3.5.0:
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
||||
dependencies:
|
||||
assertion-error "^1.0.1"
|
||||
deep-eql "^0.1.3"
|
||||
type-detect "^1.0.0"
|
||||
|
||||
check-error@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
|
||||
deep-eql@^0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
||||
dependencies:
|
||||
type-detect "0.1.1"
|
||||
|
||||
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"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
|
||||
glob@^7.0.0:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.2"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
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.1"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
||||
|
||||
leakage@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.2.0.tgz#9e7a8cc1d241d8c8427e348769e192e172fd8733"
|
||||
dependencies:
|
||||
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.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||
dependencies:
|
||||
brace-expansion "^1.0.0"
|
||||
|
||||
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.6.2"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
||||
|
||||
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"
|
||||
|
||||
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.3.2"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235"
|
||||
dependencies:
|
||||
path-parse "^1.0.5"
|
||||
|
||||
semver@^5.3.0:
|
||||
version "5.3.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
||||
|
||||
shelljs@^0.7.7:
|
||||
version "0.7.7"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
smartchai@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
||||
dependencies:
|
||||
"@types/chai" "^3.4.35"
|
||||
"@types/chai-as-promised" "0.0.29"
|
||||
"@types/chai-string" "^1.1.30"
|
||||
chai "^3.5.0"
|
||||
chai-as-promised "^6.0.0"
|
||||
chai-string "^1.3.0"
|
||||
|
||||
smartdelay@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.1.tgz#687f8bcc09d7c62c9c5a8a1771c1aba3aff54156"
|
||||
dependencies:
|
||||
typings-global "^1.0.14"
|
||||
|
||||
smartq@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3"
|
||||
dependencies:
|
||||
typed-promisify "^0.3.0"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
type-detect@0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
||||
|
||||
type-detect@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
||||
|
||||
typed-promisify@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
||||
|
||||
typings-global@^1.0.14, typings-global@^1.0.16:
|
||||
version "1.0.16"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.16.tgz#489b71781af24268750c2899316400a5e482961f"
|
||||
dependencies:
|
||||
semver "^5.3.0"
|
||||
shelljs "^0.7.7"
|
||||
|
||||
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