diff --git a/package-lock.json b/package-lock.json index c114cab..e65235d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1145,9 +1145,9 @@ } }, "@gitzone/tstest": { - "version": "1.0.35", - "resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.35.tgz", - "integrity": "sha512-Eij/Cgxs/YGDtQ0NSndp0sT97ugwcQGUt9y2QzWgntTb0IY+HTZCxLTD00Xn9m5CRevUO5sB4dyRp0GGDtC5wA==", + "version": "1.0.36", + "resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.36.tgz", + "integrity": "sha512-afyZQeCgpEs+/X4aqwbg8fBQcjfMe/Ir3Jmj/TDFGDXjwhmNGx93AasiOALjpFRTQ5foRYB9SqDKgVv6c3cKVQ==", "dev": true, "requires": { "@gitzone/tsbundle": "^1.0.72", @@ -1323,7 +1323,6 @@ "version": "4.0.10", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartenv/-/smartenv-4.0.10.tgz", "integrity": "sha512-b9jJbBSaOl0nlujyEu/0q5lkOFSMmfcOwPGb3pYrF1B37O15qmVpuqYwA5T8BXj8A6y+oA2bwrrtDzQ7hYp1zg==", - "dev": true, "requires": { "@pushrocks/smartparam": "^1.1.6", "@pushrocks/smartpromise": "^3.0.6", @@ -1700,7 +1699,6 @@ "version": "1.1.6", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartparam/-/smartparam-1.1.6.tgz", "integrity": "sha512-1El/F2QTWYDGy4Nh6vz9Ry1JVg1FEeyexB7Uvi4zHElpXYVxwso6xImRTLj+SW50JAg7nwEZ+ljkzTG9XvnwWA==", - "dev": true, "requires": { "@pushrocks/smartpromise": "^3.0.6", "is-promise": "^2.1.0", @@ -2108,8 +2106,7 @@ "@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==", - "dev": true + "integrity": "sha512-yf3BP/NIXF37BjrK5klu//asUWitOEoUP5xE1mhSUjazotwJ/eJDgEmMQNlOeWOVv72j24QQ+3bqXHE++CFGag==" }, "@types/parcel-bundler": { "version": "1.12.1", @@ -2616,8 +2613,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -2786,7 +2782,6 @@ "version": "1.1.11", "resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3435,8 +3430,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://verdaccio.lossless.one/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { "version": "1.6.2", @@ -6558,8 +6552,7 @@ "is-promise": { "version": "2.2.2", "resolved": "https://verdaccio.lossless.one/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", - "dev": true + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==" }, "is-reference": { "version": "1.2.1", @@ -7245,7 +7238,6 @@ "version": "3.0.4", "resolved": "https://verdaccio.lossless.one/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } diff --git a/package.json b/package.json index 94ca32a..13e474f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "homepage": "https://gitlab.com/pushrocks/tapbundle#README", "dependencies": { "@pushrocks/smartdelay": "^2.0.9", + "@pushrocks/smartenv": "^4.0.10", "@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smarttime": "^3.0.19", "smartchai": "^2.0.1" @@ -28,7 +29,7 @@ "devDependencies": { "@gitzone/tsbuild": "^2.1.24", "@gitzone/tsrun": "^1.2.12", - "@gitzone/tstest": "^1.0.35", + "@gitzone/tstest": "^1.0.36", "@types/node": "^14.0.19", "randomstring": "^1.1.5", "tslint": "^6.1.2", diff --git a/test/test.browser.ts b/test/test.browser.ts index cecb34e..fa1bee9 100644 --- a/test/test.browser.ts +++ b/test/test.browser.ts @@ -9,7 +9,7 @@ const test1 = tap.test('my first test -> expect true to be true', async () => { }); const test2 = tap.test('my second test', async tools => { - await tools.delayFor(1000); + await tools.delayFor(50); }); const test3 = tap.test( @@ -17,7 +17,7 @@ const test3 = tap.test( async () => { expect((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).to .be.true; - expect((await test2).hrtMeasurement.milliSeconds > 1000).to.be.true; + expect((await test2).hrtMeasurement.milliSeconds > 10).to.be.true; } ); @@ -34,9 +34,7 @@ const test5 = tap.test('my 5th test -> should pass in about 500ms', async tools const test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => { tools.allowFailure(); tools.timeout(1000); - await tools.delayFor(2000); + await tools.delayFor(100); }); -tap.start().catch(err => { - console.log(err); -}); +tap.start(); diff --git a/ts/tapbundle.classes.tap.ts b/ts/tapbundle.classes.tap.ts index 9278d0f..675ea37 100644 --- a/ts/tapbundle.classes.tap.ts +++ b/ts/tapbundle.classes.tap.ts @@ -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> = []; // safeguard against empty test array diff --git a/ts/tapbundle.plugins.ts b/ts/tapbundle.plugins.ts index 994fc67..0e3d902 100644 --- a/ts/tapbundle.plugins.ts +++ b/ts/tapbundle.plugins.ts @@ -1,8 +1,9 @@ // pushrocks import * as smartdelay from '@pushrocks/smartdelay'; +import * as smartenv from '@pushrocks/smartenv'; import * as smartpromise from '@pushrocks/smartpromise'; -export { smartdelay, smartpromise }; +export { smartdelay, smartenv, smartpromise }; // third party /* import * as leakage from 'leakage';