Compare commits

...

6 Commits

Author SHA1 Message Date
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
10 changed files with 19197 additions and 3619 deletions

22738
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "@pushrocks/tapbundle", "name": "@pushrocks/tapbundle",
"private": false, "private": false,
"version": "3.2.12", "version": "3.2.15",
"description": "tap bundled for tapbuffer", "description": "tap bundled for tapbuffer",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
@ -20,18 +20,19 @@
}, },
"homepage": "https://gitlab.com/pushrocks/tapbundle#README", "homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.10", "@open-wc/testing-helpers": "^2.0.2",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16", "@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartpromise": "^3.1.3", "@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smarttime": "^3.0.38", "@pushrocks/smarttime": "^3.0.43",
"smartchai": "^2.0.1" "smartchai": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.28",
"@gitzone/tsrun": "^1.2.12", "@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.60",
"@types/node": "^14.14.22", "@types/node": "^16.11.12",
"randomstring": "^1.1.5", "randomstring": "^1.2.1",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },

View File

@ -1,9 +1,15 @@
import { tap, expect } from '../ts/index'; import { tap, expect, webhelpers } from '../ts/index';
tap.preTask('hi there', async () => { tap.preTask('custompretask', async () => {
console.log('this is a pretask'); 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).to.be.instanceOf(HTMLElement);
console.log(myElement);
});
const test1 = tap.test('my first test -> expect true to be true', async () => { const test1 = tap.test('my first test -> expect true to be true', async () => {
return expect(true).to.be.true; return expect(true).to.be.true;
}); });

View File

@ -25,7 +25,7 @@ const test3 = tap.test(
const test4 = tap.test('my 4th test -> should fail', async (tools) => { const test4 = tap.test('my 4th test -> should fail', async (tools) => {
tools.allowFailure(); tools.allowFailure();
expect(false).to.be.true; expect(false).to.be.false;
return 'hello'; return 'hello';
}); });

View File

@ -1,3 +1,4 @@
export { expect } from 'smartchai'; export { expect } from 'smartchai';
export { tap } from './tapbundle.classes.tap'; export { tap } from './tapbundle.classes.tap';
export { TapWrap } from './tapbundle.classes.tapwrap'; export { TapWrap } from './tapbundle.classes.tapwrap';
export { webhelpers } from './webhelpers';

View File

@ -78,7 +78,7 @@ export class Tap <T> {
// lets set the tapbundle promise // lets set the tapbundle promise
const smartenvInstance = new plugins.smartenv.Smartenv(); const smartenvInstance = new plugins.smartenv.Smartenv();
smartenvInstance.isBrowser smartenvInstance.isBrowser
? (globalThis.tapbundleDeferred = plugins.smartpromise.defer()) ? ((globalThis as any).tapbundleDeferred = plugins.smartpromise.defer())
: null; : null;
// lets continue with running the tests // lets continue with running the tests
@ -139,14 +139,14 @@ export class Tap <T> {
if (!smartenvInstance.isBrowser) process.exit(1); if (!smartenvInstance.isBrowser) process.exit(1);
} }
if (smartenvInstance.isBrowser) { if (smartenvInstance.isBrowser) {
globalThis.tapbundleDeferred.resolve(); (globalThis as any).tapbundleDeferred.resolve();
} }
} }
/** /**
* handle errors * handle errors
*/ */
public threw(err) { public threw(err: Error) {
console.log(err); console.log(err);
} }
} }

View File

@ -55,7 +55,7 @@ export class TapTest <T = unknown> {
this.status = 'success'; this.status = 'success';
this.testDeferred.resolve(this); this.testDeferred.resolve(this);
this.testResultDeferred.resolve(testReturnValue); this.testResultDeferred.resolve(testReturnValue);
} catch (err) { } catch (err: any) {
this.hrtMeasurement.stop(); this.hrtMeasurement.stop();
console.log( console.log(
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms` `not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`

View File

@ -11,7 +11,7 @@ export class TapTools {
*/ */
private _tapTest: TapTest; private _tapTest: TapTest;
constructor(TapTestArg) { constructor(TapTestArg: TapTest<any>) {
this._tapTest = TapTestArg; this._tapTest = TapTestArg;
} }
@ -25,11 +25,11 @@ export class TapTools {
/** /**
* async/await delay method * async/await delay method
*/ */
public async delayFor(timeMilliArg) { public async delayFor(timeMilliArg: number) {
await plugins.smartdelay.delayFor(timeMilliArg); await plugins.smartdelay.delayFor(timeMilliArg);
} }
public async delayForRandom(timeMilliMinArg, timeMilliMaxArg) { public async delayForRandom(timeMilliMinArg: number, timeMilliMaxArg: number) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg); await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
} }
@ -46,7 +46,7 @@ export class TapTools {
let funcErr: Error; let funcErr: Error;
try { try {
await throwingFuncArg(); await throwingFuncArg();
} catch (err) { } catch (err: any) {
funcErr = err; funcErr = err;
} }
return funcErr; return funcErr;

View File

@ -4,8 +4,3 @@ import * as smartenv from '@pushrocks/smartenv';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
export { smartdelay, smartenv, smartpromise }; export { smartdelay, smartenv, smartpromise };
// third party
/* import * as leakage from 'leakage';
export { leakage }; */

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