fix(core): update
This commit is contained in:
parent
50f1aad895
commit
29ec99e63e
32
package-lock.json
generated
32
package-lock.json
generated
@ -1145,9 +1145,9 @@
|
||||
}
|
||||
},
|
||||
"@gitzone/tstest": {
|
||||
"version": "1.0.36",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.36.tgz",
|
||||
"integrity": "sha512-afyZQeCgpEs+/X4aqwbg8fBQcjfMe/Ir3Jmj/TDFGDXjwhmNGx93AasiOALjpFRTQ5foRYB9SqDKgVv6c3cKVQ==",
|
||||
"version": "1.0.41",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.41.tgz",
|
||||
"integrity": "sha512-L9ERXbAC9F6b1um6KCt/kXc6xRcRUt0mZkujA8vRhnVLhFQZ9k3gk/ABD8tQNu1qnPlIH4hjJeVC/CJL/SYgsw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@gitzone/tsbundle": "^1.0.72",
|
||||
@ -1837,9 +1837,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/webrequest": {
|
||||
"version": "2.0.9",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.9.tgz",
|
||||
"integrity": "sha512-cHKbVlS6j26SRzFMjvV+4hwwimXJ9NX/NnUmLmPSTZguzz6dEp1dYd+aNzGaGC8Da4ewvH7klhx7a5LI3Gv5tw==",
|
||||
"version": "2.0.10",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.10.tgz",
|
||||
"integrity": "sha512-uQ8MvKclGqdLaUjah3SUsr8RplvtEUDXpFYjyO1dsHabbLWNVPQipt70CAMvS/8hOzDDD/G+dUEHIz2yZSVKNQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.9",
|
||||
@ -2104,9 +2104,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.0.19",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.0.19.tgz",
|
||||
"integrity": "sha512-yf3BP/NIXF37BjrK5klu//asUWitOEoUP5xE1mhSUjazotwJ/eJDgEmMQNlOeWOVv72j24QQ+3bqXHE++CFGag=="
|
||||
"version": "14.0.22",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.0.22.tgz",
|
||||
"integrity": "sha512-emeGcJvdiZ4Z3ohbmw93E/64jRzUHAItSHt8nF7M4TGgQTiWqFVGB8KNpLGFmUHmHLvjvBgFwVlqNcq+VuGv9g=="
|
||||
},
|
||||
"@types/parcel-bundler": {
|
||||
"version": "1.12.1",
|
||||
@ -6672,9 +6672,9 @@
|
||||
}
|
||||
},
|
||||
"js-base64": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://verdaccio.lossless.one/js-base64/-/js-base64-2.6.2.tgz",
|
||||
"integrity": "sha512-1hgLrLIrmCgZG+ID3VoLNLOSwjGnoZa8tyrUdEteMeIzsT6PH7PMLyUvbDwzNE56P3PNxyvuIOx4Uh2E5rzQIw==",
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://verdaccio.lossless.one/js-base64/-/js-base64-2.6.3.tgz",
|
||||
"integrity": "sha512-fiUvdfCaAXoQTHdKMgTvg6IkecXDcVz6V5rlftUTclF9IKBjMizvSdQaCl/z/6TApDeby5NL+axYou3i0mu1Pg==",
|
||||
"dev": true
|
||||
},
|
||||
"js-tokens": {
|
||||
@ -8559,12 +8559,12 @@
|
||||
}
|
||||
},
|
||||
"public-ip": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/public-ip/-/public-ip-4.0.1.tgz",
|
||||
"integrity": "sha512-uy7G5RtP7MH9KILMX6cschB9aOxxRwFo0zv7Lf+ZXIw5IrH4EfdKQfACIwUEFilEHtkgJ9lpRfggwi1GVzN2vw==",
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/public-ip/-/public-ip-4.0.2.tgz",
|
||||
"integrity": "sha512-ZHqUjaYT/+FuSiy5/o2gBxvj0PF7M3MXGnaLJBsJNMCyXI4jzuXXHJKrk0gDxx1apiF/jYsBwjTQOM9V8G6oCQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"dns-socket": "^4.2.0",
|
||||
"dns-socket": "^4.2.1",
|
||||
"got": "^9.6.0",
|
||||
"is-ip": "^3.1.0"
|
||||
}
|
||||
|
@ -29,8 +29,8 @@
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.36",
|
||||
"@types/node": "^14.0.19",
|
||||
"@gitzone/tstest": "^1.0.41",
|
||||
"@types/node": "^14.0.22",
|
||||
"randomstring": "^1.1.5",
|
||||
"tslint": "^6.1.2",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
@ -46,5 +46,8 @@
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
29
readme.md
29
readme.md
@ -8,13 +8,20 @@ tap bundled for tapbuffer
|
||||
* [docs (typedoc)](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/@pushrocks/tapbundle.svg)](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
||||
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/tapbundle/badge.svg)](https://snyk.io/test/npm/@pushrocks/tapbundle)
|
||||
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
|
||||
|
||||
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
|
||||
|
||||
@ -35,24 +42,24 @@ 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 => {
|
||||
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 => {
|
||||
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 => {
|
||||
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 => {
|
||||
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');
|
||||
});
|
||||
|
@ -1,21 +0,0 @@
|
||||
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));
|
||||
});
|
||||
});
|
||||
expect(err).to.be.undefined;
|
||||
});
|
||||
|
||||
tap.start();
|
@ -1,10 +1,5 @@
|
||||
import { tap, expect } from '../ts/index';
|
||||
import { tap, expect, TapWrap } from '../ts/index';
|
||||
|
||||
const 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();
|
||||
|
@ -1,2 +1,3 @@
|
||||
export { expect } from 'smartchai';
|
||||
export { tap } from './tapbundle.classes.tap';
|
||||
export { TapWrap } from './tapbundle.classes.tapwrap';
|
||||
|
@ -2,7 +2,6 @@ import * as plugins from './tapbundle.plugins';
|
||||
|
||||
import { IPreTaskFunction, PreTask } from './tapbundle.classes.pretask';
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
|
||||
export class Tap {
|
||||
/**
|
||||
* skips a test
|
||||
@ -57,13 +56,6 @@ export class Tap {
|
||||
this._tapPreTasks.push(new PreTask(descriptionArg, functionArg));
|
||||
}
|
||||
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
public wrap(functionArg: ITapWrapFunction) {
|
||||
return new TapWrap(functionArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* A parallel test that will not be waited for before the next starts.
|
||||
* @param testDescription - A description of what the test does
|
||||
|
@ -42,10 +42,6 @@ export class TapTools {
|
||||
}
|
||||
}
|
||||
|
||||
public async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||
console.log('iteration leakage checks disabled for now due to incompatibilities with node v12');
|
||||
}
|
||||
|
||||
public async returnError(throwingFuncArg: IPromiseFunc) {
|
||||
let funcErr: Error;
|
||||
try {
|
||||
|
@ -1,25 +1,13 @@
|
||||
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() {
|
||||
// TODO: make sure it makes sense what we do here.
|
||||
await this.wrapFunction();
|
||||
public options: ITapWrapOptions;
|
||||
constructor(optionsArg: ITapWrapOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user