Compare commits

...

91 Commits

Author SHA1 Message Date
b3c4a58491 4.0.7 2022-02-15 16:49:29 +01:00
50c34f89ee fix(core): update 2022-02-15 16:49:29 +01:00
b813453c5f 4.0.6 2022-02-15 16:48:59 +01:00
9a6dc33b6b fix(core): update 2022-02-15 16:48:59 +01:00
8bf99ae7ec 4.0.5 2022-02-15 16:48:04 +01:00
cc708b29ae fix(core): update 2022-02-15 16:48:03 +01:00
5798d3e808 4.0.4 2022-02-15 16:40:22 +01:00
37fe299a45 fix(core): update 2022-02-15 16:40:21 +01:00
e24cdd9f0f 4.0.3 2022-02-02 08:11:01 +01:00
ae7aaab456 fix(core): update 2022-02-02 08:11:00 +01:00
bab360cc59 4.0.2 2022-02-02 07:38:27 +01:00
36dcd228fd fix(core): update 2022-02-02 07:38:26 +01:00
c7d6451758 4.0.1 2022-02-02 03:03:03 +01:00
aeedf14336 fix(core): update 2022-02-02 03:03:03 +01:00
14b95cfbc3 4.0.0 2022-01-21 19:54:08 +01:00
0884da7941 BREAKING CHANGE(core): switxh to @pushrocks/smartexpect 2022-01-21 19:54:07 +01:00
22df58b8bc 3.2.15 2021-12-10 17:34:06 +01:00
33399126f7 fix(core): update 2021-12-10 17:34:06 +01:00
d1e46fd2a7 3.2.14 2021-02-13 16:06:38 +00:00
9304e6d736 fix(core): update 2021-02-13 16:06:38 +00:00
588c532d6d 3.2.13 2021-02-13 16:02:40 +00:00
e3a756c775 fix(core): update 2021-02-13 16:02:40 +00:00
05defe6031 3.2.12 2021-01-26 03:19:50 +00:00
f4bb17dea1 fix(core): update 2021-01-26 03:19:49 +00:00
1023a94ff2 3.2.11 2021-01-26 03:15:50 +00:00
8ee456da5f fix(core): update 2021-01-26 03:15:50 +00:00
45ee6eca31 3.2.10 2021-01-26 02:35:03 +00:00
1eaf1e9a77 fix(core): update 2021-01-26 02:35:02 +00:00
715108b11b 3.2.9 2020-07-11 16:07:53 +00:00
7b1e8f47b1 fix(core): update 2020-07-11 16:07:52 +00:00
2b71ffe8c2 3.2.8 2020-07-11 16:07:31 +00:00
29ec99e63e fix(core): update 2020-07-11 16:07:30 +00:00
50f1aad895 3.2.7 2020-07-08 00:46:44 +00:00
f7e95df2b9 fix(core): update 2020-07-08 00:46:43 +00:00
a00536996c 3.2.6 2020-07-08 00:17:32 +00:00
66f49cf8aa fix(core): update 2020-07-08 00:17:31 +00:00
aa3f1eb21f update readme 2020-07-08 00:17:25 +00:00
d81a8006b1 3.2.5 2020-07-08 00:16:10 +00:00
5fa4c1cd85 fix(core): update 2020-07-08 00:16:09 +00:00
fc609858ff 3.2.4 2020-07-08 00:15:45 +00:00
19ecca0179 fix(core): update 2020-07-08 00:15:44 +00:00
ff55e596cb 3.2.3 2020-07-08 00:11:16 +00:00
ed8c8312c2 fix(core): update 2020-07-08 00:11:16 +00:00
a6dd8de0db 3.2.2 2020-07-07 22:54:15 +00:00
081347b23b fix(core): update 2020-07-07 22:54:15 +00:00
f23575a8a2 3.2.1 2020-03-15 16:36:26 +00:00
b2dbc9160b fix(core): update 2020-03-15 16:36:25 +00:00
1e8ab2d7a2 3.2.0 2019-11-16 23:40:38 +01:00
427878763e feat(pretask): introduce new pretask functionality for setting up testing environment 2019-11-16 23:40:36 +01:00
bdcc94e723 3.1.0 2019-11-16 19:22:21 +01:00
3ac46b2363 feat(tools): can now ensure certain directories 2019-11-16 19:22:20 +01:00
deae532820 3.0.14 2019-11-16 18:45:48 +01:00
99883eab82 fix(core): update 2019-11-16 18:45:47 +01:00
e27e59bbeb 3.0.13 2019-08-23 00:05:22 +02:00
fa54431280 fix(core): update 2019-08-23 00:05:21 +02:00
aa7c49548c 3.0.12 2019-08-22 23:57:28 +02:00
8d5352d000 fix(core): update 2019-08-22 23:57:27 +02:00
c3ae0bc211 3.0.11 2019-06-19 14:49:24 +02:00
0381f63b65 fix(core): update 2019-06-19 14:49:23 +02:00
f1441bf123 3.0.10 2019-06-19 13:18:46 +02:00
9892085140 fix(core): update 2019-06-19 13:18:45 +02:00
b6d1c3c083 3.0.9 2019-04-10 12:56:56 +02:00
6e6cfbadbd fix(core): update 2019-04-10 12:56:55 +02:00
02ff220c59 3.0.8 2019-04-10 12:56:18 +02:00
035cb84442 fix(core): update 2019-04-10 12:56:17 +02:00
505f624dd9 3.0.7 2018-09-03 00:01:53 +02:00
ea5fbd4637 fix(dependencies): update to latest versions 2018-09-03 00:01:53 +02:00
de780538a5 3.0.6 2018-09-02 23:54:59 +02:00
28b1f0bfed fix(core): add tap.only option 2018-09-02 23:54:59 +02:00
72b72a9ffb 3.0.5 2018-08-08 23:38:43 +02:00
be393199be fix(dependencies): update 2018-08-08 23:38:43 +02:00
7b6260bb15 3.0.4 2018-08-08 23:20:14 +02:00
2345e972d5 fix(dependencies): use @gitzone/tsbuild instead of npmts 2018-08-08 23:20:14 +02:00
22c44a8cd0 3.0.3 2018-08-08 23:17:06 +02:00
bae2aebf83 fix(dependencies): now typings-global free 2018-08-08 23:17:06 +02:00
5fe2358bfe 3.0.2 2018-07-18 08:31:22 +02:00
280ded573d fix(dependencies): update 2018-07-18 08:31:22 +02:00
6b6a92b709 3.0.1 2018-07-13 22:28:18 +02:00
c1589c2309 fix(package): npm access level 2018-07-13 22:28:17 +02:00
271d657f2c 3.0.0 2018-07-13 22:06:45 +02:00
63669ea6ff BREAKING CHANGE(package): change scope 2018-07-13 22:06:45 +02:00
4306272f45 2.0.2 2018-06-28 23:47:58 +02:00
4378b36069 fix(security): add snyk file 2018-06-28 23:47:57 +02:00
e8f7013435 2.0.1 2018-06-28 23:34:41 +02:00
3199943b59 fix(core): fix node 10.x.x compatibility 2018-06-28 23:34:41 +02:00
0028c5492b 2.0.0 2018-02-27 22:52:08 +01:00
e3b05cc43c update to use latest smartchai 2018-02-27 22:52:02 +01:00
f68da622d7 1.1.8 2017-10-11 14:18:17 +02:00
b7e57e8cdc update ci 2017-10-11 14:18:14 +02:00
93b46a1446 1.1.7 2017-10-11 14:01:07 +02:00
ca3ea788fd add new docs 2017-10-11 14:01:03 +02:00
40 changed files with 28096 additions and 1474 deletions

18
.gitignore vendored
View File

@ -1,4 +1,20 @@
node_modules/
.nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,38 +1,76 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- test
- release
- trigger
- pages
- security
- test
- release
- metadata
testLEGACY:
stage: test
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
testLTS:
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci test lts
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
testBuild:
stage: test
script:
- npmci test stable
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
@ -40,32 +78,60 @@ testSTABLE:
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- 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 node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,26 +0,0 @@
# tapbundle
tap bundled for tapbuffer
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tapbundle)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/tapbundle)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/tapbundle)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/tapbundle/)
## Status for master
[![build status](https://GitLab.com/pushrocks/tapbundle/badges/master/build.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
[![coverage report](https://GitLab.com/pushrocks/tapbundle/badges/master/coverage.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/tapbundle.svg)](https://www.npmjs.com/package/tapbundle)
[![Dependency Status](https://david-dm.org/pushrocks/tapbundle.svg)](https://david-dm.org/pushrocks/tapbundle)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/tapbundle/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/tapbundle/badges/code.svg)](https://www.bithound.io/github/pushrocks/tapbundle)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

3
dist/index.d.ts vendored
View File

@ -1,3 +0,0 @@
import 'typings-global';
export { expect } from 'smartchai';
export { tap } from './tapbundle.classes.tap';

8
dist/index.js vendored
View File

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

View File

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

View File

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

View File

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

View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3RhcGJ1bmRsZS5jbGFzc2VzLnRhcHRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLCtDQUE4QztBQUU5Qyw2RUFBdUQ7QUFFdkQsc0JBQXNCO0FBQ3RCLGlDQUFzQztBQVd0QztJQVdFOztPQUVHO0lBQ0gsWUFBYSxVQUlaO1FBVEQsaUJBQVksR0FBc0IsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUN4RCxnQkFBVyxHQUFxQixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQTtRQVN2RCxJQUFJLENBQUMsV0FBVyxHQUFHLFVBQVUsQ0FBQyxXQUFXLENBQUE7UUFDekMsSUFBSSxDQU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FPLENBQUMsSUFBSSxDQUFDLENBQUE7WUFDakMsQ0FBQztZQUFDLEtBQUssQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7Z0JBQ2IsSUFBSSxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtnQkFDMUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLFVBQVUsTUFBTSxJQUFJLENBQUMsV0FBVyxXQUFXLElBQUksQ0FBQyxjQUFjLENBQUMsWUFBWSxJQUFJLENBQUMsQ0FBQTtnQkFDdEcsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUE7Z0JBRS9CLDJDQUEyQztnQkFDM0MsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDO29CQUM5QixJQUFJLENBQUMsTUFBTSxHQUFHLG1CQUFtQixDQUFBO29CQUNqQyxPQUFPLENBQUMsR0FBRyxDQUFDLHlFQUF5RSxDQUFDLENBQUE7Z0JBQ3hGLENBQUM7Z0JBQUMsSUFBSSxDQUFDLENBQUM7b0JBQ04sSUFBSSxDQUFDLE1BQU0sR0FBRyxPQUFPLENBQUE7Z0JBQ3ZCLENBQUM7Z0JBRUQsaUNBQWlDO2dCQUNqQyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztvQkFDeEIsT0FBTyxDQUFDLEdBQUcsQ0FBQywrQkFBK0IsQ0FBQyxDQUFBO2dCQUM5QyxDQUFDO2dCQUNELE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7WUFDbEIsQ0FBQztRQUNILENBQUM7S0FBQTtDQUNGO0FBL0RELDBCQStEQyJ9

View File

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

View File

@ -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;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UFJLENBQUMsUUFBUSxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUE7WUFDbEMsQ0FBQztRQUNILENBQUM7S0FBQTtJQUVLLGtCQUFrQixDQUFFLGdCQUE4Qjs7WUFDdEQsTUFBTSxPQUFPLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtRQUN2RCxDQUFDO0tBQUE7SUFFSyxXQUFXLENBQUUsZUFBNkI7O1lBQzlDLElBQUksT0FBYyxDQUFBO1lBQ2xCLElBQUksQ0FBQztnQkFDSCxNQUFNLGVBQWUsRUFBRSxDQUFBO1lBQ3pCLENBQUM7WUFBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO2dCQUNiLE9BQU8sR0FBRyxHQUFHLENBQUE7WUFDZixDQUFDO1lBQ0QsTUFBTSxDQUFDLE9BQU8sQ0FBQTtRQUNoQixDQUFDO0tBQUE7Q0FDRjtBQW5ERCw0QkFtREMifQ==

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +0,0 @@
export declare class TapCreator {
}
export declare let tapCreator: TapCreator;

View File

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

View File

@ -1,79 +0,0 @@
# tapbundle
tap bundled for tapbuffer
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tapbundle)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/tapbundle)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/tapbundle)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/tapbundle/)
## Status for master
[![build status](https://GitLab.com/pushrocks/tapbundle/badges/master/build.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
[![coverage report](https://GitLab.com/pushrocks/tapbundle/badges/master/coverage.svg)](https://GitLab.com/pushrocks/tapbundle/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/tapbundle.svg)](https://www.npmjs.com/package/tapbundle)
[![Dependency Status](https://david-dm.org/pushrocks/tapbundle.svg)](https://david-dm.org/pushrocks/tapbundle)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/tapbundle/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/tapbundle/badges/code.svg)](https://www.bithound.io/github/pushrocks/tapbundle)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## 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 | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

22
license Normal file
View File

@ -0,0 +1,22 @@
**MIT License**
Copright &copy; 2016 Lossless GmbH
Copyright &copy; 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.

View File

@ -1,12 +1,22 @@
{
"npmci": {
"globalNpmTools": [
"npmts"
]
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"npmts": {
"testConfig": {
"parallel": false
}
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "tapbundle",
"shortDescription": "tap bundled for tapbuffer",
"npmPackagename": "@pushrocks/tapbundle",
"license": "MIT"
}
}
}

27698
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@
{
"name": "tapbundle",
"version": "1.1.6",
"name": "@pushrocks/tapbundle",
"private": false,
"version": "4.0.7",
"description": "tap bundled for tapbuffer",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild --web)"
},
"repository": {
"type": "git",
@ -18,15 +20,35 @@
},
"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"
"@open-wc/testing-helpers": "^2.0.4",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartexpect": "^1.0.12",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smarttime": "^3.0.45"
},
"devDependencies": {
"randomstring": "^1.1.5"
}
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.64",
"@types/node": "^17.0.18",
"randomstring": "^1.2.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

88
readme.md Normal file
View File

@ -0,0 +1,88 @@
# @pushrocks/tapbundle
tap based testing framework for use with @gitzone/tstest
## 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
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/tapbundle/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/tapbundle/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/tapbundle)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/tapbundle)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/tapbundle)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/tapbundle)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/tapbundle)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
A few words on TypeScript
### Included in this package
* tap compatible testing framework written in TypeScript
* `expect` and `expectAsync` from the package `@pushrocks/smartexpect`
### A few words on tap
**"tap"** stands for **"test anything protocol"**. Its programming language agnostic as long as the test interpreter can read the tap console output. This package is optimized to work with @gitzone/tstest as interpreter, which offers different V8 based runtime environments like nodejs, chrome, and deno.
### Write your first tests
```typescript
import { tap, expect, expectAsync } 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
});
const 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).toBeTrue(); // will not throw
await expectAsync(tools.delayFor(2000)).toBeUndefined(); // yay expect promises :)
expectAsync(myTest2.promise) // access other tests metadata :)
.property('hrtMeasurement') // and drill down into properties
.property('milliSeconds').toBeGreaterThan(1000);
});
const 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).toEqual('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)
```
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

45
test/test.browser.ts Normal file
View File

@ -0,0 +1,45 @@
import { tap, expect, webhelpers } from '../ts/index';
tap.preTask('custompretask', async () => {
console.log('this is a pretask');
});
tap.test('should have access to webhelpers', async () => {
const myElement = await webhelpers.fixture(webhelpers.html`<div></div>`);
expect(myElement).toBeInstanceOf(HTMLElement);
console.log(myElement);
});
const test1 = tap.test('my first test -> expect true to be true', async () => {
return expect(true).toBeTrue();
});
const test2 = tap.test('my second test', async (tools) => {
await tools.delayFor(50);
});
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).toBeTrue();
expect((await test2).hrtMeasurement.milliSeconds > 10).toBeTrue();
}
);
const test4 = tap.skip.test('my 4th test -> should fail', async (tools) => {
tools.allowFailure();
expect(false).toBeTrue();
});
const test5 = tap.test('my 5th test -> should pass in about 500ms', async (tools) => {
tools.timeout(1000);
await tools.delayFor(500);
});
const test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async (tools) => {
tools.allowFailure();
tools.timeout(1000);
await tools.delayFor(100);
});
tap.start();

View File

@ -1,21 +0,0 @@
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) => {
await tools.checkIterationLeak(async () => {
let domain = randomstring.generate(1000)
})
})
let outsideArray = []
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()
})
tap.start()

View File

@ -1,10 +1,5 @@
import { tap, expect } from '../dist/index'
import { tap, expect, TapWrap } from '../ts/index';
let tapwrap = tap.wrap(async () => {
tap.test('should do something', async () => {
console.log('test1')
})
tap.start()
})
tap.test('should run a test', async () => {});
tapwrap.run()
tap.start();

View File

@ -1,32 +1,44 @@
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()
})
tap.preTask('hi there', async () => {
console.log('this is a pretask');
});
let test2 = tap.test('my second test', async (tools) => {
await tools.delayFor(1000)
})
const test1 = tap.test('my first test -> expect true to be true', async () => {
return expect(true).toBeTrue();
});
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 test2 = tap.test('my second test', async (tools) => {
await tools.delayFor(1000);
});
let test4 = tap.skip.test('my 4th test -> should fail', async (tools) => {
tools.allowFailure()
expect(false).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.testPromise).hrtMeasurement.milliSeconds <
(await test2).hrtMeasurement.milliSeconds
).toBeTrue();
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 1000).toBeTrue();
}
);
let test5 = tap.test('my 5th test -> should pass in about 500ms', async (tools) => {
tools.timeout(1000)
await tools.delayFor(500)
})
const test4 = tap.test('my 4th test -> should fail', async (tools) => {
tools.allowFailure();
expect(false).toBeFalse();
return 'hello';
});
let test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async (tools) => {
tools.allowFailure()
tools.timeout(1000)
await tools.delayFor(2000)
})
const test5 = tap.test('my 5th test -> should pass in about 500ms', async (tools) => {
const test4Result = await test4.testResultPromise;
tools.timeout(1000);
await tools.delayFor(500);
});
tap.start()
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();

View File

@ -1,3 +1,10 @@
import 'typings-global'
export { expect } from 'smartchai'
export { tap } from './tapbundle.classes.tap'
export { tap } from './tapbundle.classes.tap';
export { TapWrap } from './tapbundle.classes.tapwrap';
export { webhelpers } from './webhelpers';
import { expect, expectAsync } from '@pushrocks/smartexpect';
export {
expect,
expectAsync
}

View File

@ -0,0 +1,21 @@
import * as plugins from './tapbundle.plugins';
import { TapTools } from './tapbundle.classes.taptools';
export interface IPreTaskFunction {
(tapTools?: TapTools): Promise<any>;
}
export class PreTask {
public description: string;
public preTaskFunction: IPreTaskFunction;
constructor(descriptionArg: string, preTaskFunctionArg: IPreTaskFunction) {
this.description = descriptionArg;
this.preTaskFunction = preTaskFunctionArg;
}
public async run() {
console.log(`::__PRETASK: ${this.description}`);
await this.preTaskFunction(new TapTools(null));
}
}

View File

@ -1,40 +1,59 @@
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'
export class Tap {
import { IPreTaskFunction, PreTask } from './tapbundle.classes.pretask';
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
export class Tap <T> {
/**
* skips a test
* tests marked with tap.skip.test() are never executed
*/
public skip = {
test: (descriptionArg: string, functionArg: ITestFunction<T>) => {
console.log(`skipped test: ${descriptionArg}`);
},
testParallel: (descriptionArg: string, functionArg: ITestFunction<T>) => {
console.log(`skipped test: ${descriptionArg}`);
},
};
/**
* skip a test
* only executes tests marked as ONLY
*/
skip = {
test: (descriptionArg: string, functionArg: ITestFunction) => {
console.log(`skipped test: ${descriptionArg}`)
}
}
public only = {
test: (descriptionArg: string, testFunctionArg: ITestFunction<T>) => {
this.test(descriptionArg, testFunctionArg, 'only');
},
};
private _tapTests: TapTest[] = []
private _tapPreTasks: PreTask[] = [];
private _tapTests: TapTest<any>[] = [];
private _tapTestsOnly: TapTest<any>[] = [];
/**
* 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) {
let localTest = new TapTest({
public test(
testDescription: string,
testFunction: ITestFunction<T>,
modeArg: 'normal' | 'only' | 'skip' = 'normal'
): TapTest<T> {
const localTest = new TapTest<T>({
description: testDescription,
testFunction: testFunction,
parallel: false
})
this._tapTests.push(localTest)
return localTest
testFunction,
parallel: false,
});
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)
public preTask(descriptionArg: string, functionArg: IPreTaskFunction) {
this._tapPreTasks.push(new PreTask(descriptionArg, functionArg));
}
/**
@ -42,71 +61,94 @@ 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({
public testParallel(testDescription: string, testFunction: ITestFunction<T>) {
this._tapTests.push(
new TapTest({
description: testDescription,
testFunction: testFunction,
parallel: true
}))
testFunction,
parallel: true,
})
);
}
/**
* starts the test evaluation
*/
async start(optionsArg?: {
throwOnError: boolean
}) {
let promiseArray: Promise<any>[] = []
public async start(optionsArg?: { throwOnError: boolean }) {
// lets set the tapbundle promise
const smartenvInstance = new plugins.smartenv.Smartenv();
smartenvInstance.isBrowser
? ((globalThis as any).tapbundleDeferred = plugins.smartpromise.defer())
: null;
// lets continue with running the tests
const promiseArray: Array<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!');
// TODO: throw proper error
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)
// determine which tests to run
let concerningTests: TapTest[];
if (this._tapTestsOnly.length > 0) {
concerningTests = this._tapTestsOnly;
} else {
await testPromise
concerningTests = this._tapTests;
}
// lets run the pretasks
for (const preTask of this._tapPreTasks) {
await preTask.run();
}
console.log(`1..${concerningTests.length}`);
for (let testKey = 0; testKey < concerningTests.length; testKey++) {
const currentTest = concerningTests[testKey];
const 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[] = []
const failReasons: string[] = [];
const executionNotes: string[] = [];
// collect failed tests
for (let tapTest of this._tapTests) {
for (const 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`
)
`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)
for (const failReason of failReasons) {
console.log(failReason);
}
if (optionsArg && optionsArg.throwOnError && failReasons.length > 0) {
process.exit(1)
if (!smartenvInstance.isBrowser) process.exit(1);
}
if (smartenvInstance.isBrowser) {
(globalThis as any).tapbundleDeferred.resolve();
}
}
/**
* handle errors
*/
threw (err) {
console.log(err)
public threw(err: Error) {
console.log(err);
}
}
export let tap = new Tap()
export let tap = new Tap();

View File

@ -1,80 +1,81 @@
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 { Deferred } from '@pushrocks/smartpromise';
import { HrtMeasurement } from '@pushrocks/smarttime';
// interfaces
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout'
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
export interface ITestFunction {
(tapTools?: TapTools): Promise<any>
}
export interface ITestFunction <T> { (tapTools?: TapTools): Promise<T> };
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
export class TapTest <T = unknown> {
public description: string;
public failureAllowed: boolean;
public hrtMeasurement: HrtMeasurement;
public parallel: boolean;
public status: TTestStatus;
public tapTools: TapTools;
public testFunction: ITestFunction<T>;
public testKey: number; // the testKey the position in the test qeue. Set upon calling .run()
private testDeferred: Deferred<TapTest<T>> = plugins.smartpromise.defer();
public testPromise: Promise<TapTest<T>> = this.testDeferred.promise;
private testResultDeferred: Deferred<T> = plugins.smartpromise.defer();
public testResultPromise: Promise<T> = this.testResultDeferred.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<T>; 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
public async run(testKeyArg: number) {
this.hrtMeasurement.start();
this.testKey = testKeyArg;
const testNumber = testKeyArg + 1;
try {
await this.testFunction(this.tapTools)
const testReturnValue = 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)
} 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(
`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
);
this.status = 'success';
this.testDeferred.resolve(this);
this.testResultDeferred.resolve(testReturnValue);
} catch (err: any) {
this.hrtMeasurement.stop();
console.log(
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
);
this.testDeferred.resolve(this);
this.testResultDeferred.resolve(err);
// 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);
}
}
}

View File

@ -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: TapTest<any>) {
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: number) {
await plugins.smartdelay.delayFor(timeMilliArg);
}
async delayForRandom (timeMilliMinArg, timeMilliMaxArg) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg)
public async delayForRandom(timeMilliMinArg: number, timeMilliMaxArg: number) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
}
async timeout (timeMilliArg: number) {
let timeout = new plugins.smartdelay.Timeout(timeMilliArg)
timeout.makeUnrefed()
await timeout.promise
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';
}
}
async checkIterationLeak (iterationfuncArg: IPromiseFunc) {
await plugins.leakage.iterate.async(iterationfuncArg)
}
async returnError (throwingFuncArg: IPromiseFunc) {
let funcErr: Error
public async returnError(throwingFuncArg: IPromiseFunc) {
let funcErr: Error;
try {
await throwingFuncArg()
} catch (err) {
funcErr = err
await throwingFuncArg();
} catch (err: any) {
funcErr = err;
}
return funcErr
return funcErr;
}
public defer() {
return plugins.smartpromise.defer();
}
}

View File

@ -1,24 +1,13 @@
import * as plugins from './tapbundle.plugins'
import * as plugins from './tapbundle.plugins';
export interface ITapWrapFunction {
(): Promise<any>
export interface ITapWrapOptions {
before: () => Promise<any>;
after: () => {};
}
export class TapWrap {
wrapFunction: ITapWrapFunction
/**
* the constructor
*/
constructor (wrapFunctionArg: ITapWrapFunction) {
// nothing here
this.wrapFunction = wrapFunctionArg
}
/**
* run the wrapFunction
*/
async run () {
await this.wrapFunction()
public options: ITapWrapOptions;
constructor(optionsArg: ITapWrapOptions) {
this.options = optionsArg;
}
}

View File

@ -1,12 +1,7 @@
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 smartdelay from '@pushrocks/smartdelay';
import * as smartenv from '@pushrocks/smartenv';
import * as smartexpect from '@pushrocks/smartexpect';
import * as smartpromise from '@pushrocks/smartpromise';
export {
early,
smartdelay,
smartq,
leakage
}
export { smartdelay, smartenv, smartexpect, smartpromise };

View File

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

25
ts/webhelpers.ts Normal file
View File

@ -0,0 +1,25 @@
import * as plugins from './tapbundle.plugins';
import type { fixture, html } from '@open-wc/testing-helpers';
import { tap } from './tapbundle.classes.tap';
class WebHelpers {
html: typeof html;
fixture: typeof fixture;
constructor() {
const smartenv = new plugins.smartenv.Smartenv();
if(smartenv.isBrowser) {
this.enable();
}
}
public enable() {
tap.preTask('enable webhelpers', async () => {
const webhelpers = await import('@open-wc/testing-helpers')
this.html = webhelpers.html;
this.fixture = webhelpers.fixture;
})
}
}
export const webhelpers = new WebHelpers();

View File

@ -1,3 +1,17 @@
{
"extends": "tslint-config-standard"
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}

331
yarn.lock
View File

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