Compare commits

...

10 Commits

Author SHA1 Message Date
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
9 changed files with 10305 additions and 851 deletions

11066
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{
"name": "@pushrocks/tapbundle",
"private": false,
"version": "3.2.0",
"version": "3.2.5",
"description": "tap bundled for tapbuffer",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)"
"build": "(tsbuild --web)"
},
"repository": {
"type": "git",
@ -20,19 +20,19 @@
},
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": {
"@pushrocks/early": "^3.0.3",
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartenv": "^4.0.10",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smarttime": "^3.0.19",
"smartchai": "^2.0.1"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24",
"@types/node": "^12.7.2",
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.36",
"@types/node": "^14.0.19",
"randomstring": "^1.1.5",
"tslint": "^5.19.0",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0"
},
"files": [

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

@ -0,0 +1,40 @@
import { tap, expect } from '../ts/index';
tap.preTask('hi there', async () => {
console.log('this is a pretask');
});
const test1 = tap.test('my first test -> expect true to be true', async () => {
return expect(true).to.be.true;
});
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).to
.be.true;
expect((await test2).hrtMeasurement.milliSeconds > 10).to.be.true;
}
);
const test4 = tap.skip.test('my 4th test -> should fail', async tools => {
tools.allowFailure();
expect(false).to.be.true;
});
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,5 +1,9 @@
import { tap, expect } from '../ts/index';
tap.preTask('hi there', async () => {
console.log('this is a pretask');
})
const test1 = tap.test('my first test -> expect true to be true', async () => {
return expect(true).to.be.true;
});

View File

@ -7,13 +7,16 @@ export interface IPreTaskFunction {
}
export class PreTask {
public description: string;
public preTaskFunction: IPreTaskFunction;
constructor(preTaskFunctionArg: 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

@ -53,8 +53,8 @@ export class Tap {
return localTest;
}
public preTask (functionArg: IPreTaskFunction) {
this._tapPreTasks.push(new PreTask(functionArg));
public preTask (descriptionArg: string, functionArg: IPreTaskFunction) {
this._tapPreTasks.push(new PreTask(descriptionArg, functionArg));
}
/**
@ -83,6 +83,11 @@ export class Tap {
* starts the test evaluation
*/
public async start(optionsArg?: { throwOnError: boolean }) {
// lets set the tapbundle promise
const smartenvInstance = new plugins.smartenv.Smartenv();
smartenvInstance.isBrowser ? globalThis.tapbundleDeferred = plugins.smartpromise.defer() : null;
// lets continue with running the tests
const promiseArray: Array<Promise<any>> = [];
// safeguard against empty test array

View File

@ -3,8 +3,8 @@ import { tapCreator } from './tapbundle.tapcreator';
import { TapTools } from './tapbundle.classes.taptools';
// imported interfaces
import { HrtMeasurement } from '@pushrocks/early';
import { Deferred } from '@pushrocks/smartpromise';
import { HrtMeasurement } from '@pushrocks/smarttime';
// interfaces
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
@ -42,6 +42,7 @@ export class TapTest {
this.testKey = testKeyArg;
const testNumber = testKeyArg + 1;
try {
await this.testFunction(this.tapTools);
if (this.status === 'timeout') {
throw new Error('Test succeeded, but timed out...');

View File

@ -42,10 +42,6 @@ export class TapTools {
}
}
public async ensureDir(pathArg: string) {
await plugins.smartfile.fs.ensureDir(pathArg);
}
public async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
console.log('iteration leakage checks disabled for now due to incompatibilities with node v12');
}

View File

@ -1,10 +1,9 @@
// pushrocks
import * as early from '@pushrocks/early';
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartfile from '@pushrocks/smartfile';
import * as smartenv from '@pushrocks/smartenv';
import * as smartpromise from '@pushrocks/smartpromise';
export { early, smartfile, smartdelay, smartpromise };
export { smartdelay, smartenv, smartpromise };
// third party
/* import * as leakage from 'leakage';