fix(core): update

This commit is contained in:
Philipp Kunz 2020-07-07 22:54:15 +00:00
parent f23575a8a2
commit 081347b23b
6 changed files with 10245 additions and 692 deletions

10869
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,19 +20,18 @@
}, },
"homepage": "https://gitlab.com/pushrocks/tapbundle#README", "homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": { "dependencies": {
"@pushrocks/early": "^3.0.3", "@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartfile": "^7.0.9",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smarttime": "^3.0.19",
"smartchai": "^2.0.1" "smartchai": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.20", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.24", "@gitzone/tstest": "^1.0.35",
"@types/node": "^13.9.0", "@types/node": "^14.0.19",
"randomstring": "^1.1.5", "randomstring": "^1.1.5",
"tslint": "^6.1.0", "tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"files": [ "files": [

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

@ -0,0 +1,42 @@
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(1000);
});
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;
}
);
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(2000);
});
tap.start().catch(err => {
console.log(err);
});

View File

@ -3,8 +3,8 @@ import { tapCreator } from './tapbundle.tapcreator';
import { TapTools } from './tapbundle.classes.taptools'; import { TapTools } from './tapbundle.classes.taptools';
// imported interfaces // imported interfaces
import { HrtMeasurement } from '@pushrocks/early';
import { Deferred } from '@pushrocks/smartpromise'; import { Deferred } from '@pushrocks/smartpromise';
import { HrtMeasurement } from '@pushrocks/smarttime';
// interfaces // interfaces
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout'; export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
@ -42,6 +42,7 @@ export class TapTest {
this.testKey = testKeyArg; this.testKey = testKeyArg;
const testNumber = testKeyArg + 1; const testNumber = testKeyArg + 1;
try { try {
await this.testFunction(this.tapTools); await this.testFunction(this.tapTools);
if (this.status === 'timeout') { if (this.status === 'timeout') {
throw new Error('Test succeeded, but timed out...'); 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) { public async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
console.log('iteration leakage checks disabled for now due to incompatibilities with node v12'); console.log('iteration leakage checks disabled for now due to incompatibilities with node v12');
} }

View File

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