Compare commits

...

4 Commits

Author SHA1 Message Date
588c532d6d 3.2.13 2021-02-13 16:02:40 +00:00
e3a756c775 fix(core): update 2021-02-13 16:02:40 +00:00
05defe6031 3.2.12 2021-01-26 03:19:50 +00:00
f4bb17dea1 fix(core): update 2021-01-26 03:19:49 +00:00
8 changed files with 949 additions and 1269 deletions

2174
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "@pushrocks/tapbundle",
"private": false,
"version": "3.2.11",
"version": "3.2.13",
"description": "tap bundled for tapbuffer",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -20,6 +20,7 @@
},
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": {
"@open-wc/testing-helpers": "^1.8.12",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartpromise": "^3.1.3",

View File

@ -1,6 +1,7 @@
import { tap, expect } from '../ts/index';
import { tap, expect, webhelpers } from '../ts/index';
tap.preTask('hi there', async () => {
const myElement = webhelpers.fixture(webhelpers.html`<div></div>`);
console.log('this is a pretask');
});

View File

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

View File

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

View File

@ -8,10 +8,10 @@ export class Tap <T> {
* tests marked with tap.skip.test() are never executed
*/
public skip = {
test: (descriptionArg: string, functionArg: ITestFunction) => {
test: (descriptionArg: string, functionArg: ITestFunction<T>) => {
console.log(`skipped test: ${descriptionArg}`);
},
testParallel: (descriptionArg: string, functionArg: ITestFunction) => {
testParallel: (descriptionArg: string, functionArg: ITestFunction<T>) => {
console.log(`skipped test: ${descriptionArg}`);
},
};
@ -38,7 +38,7 @@ export class Tap <T> {
testDescription: string,
testFunction: ITestFunction<T>,
modeArg: 'normal' | 'only' | 'skip' = 'normal'
) {
): TapTest<T> {
const localTest = new TapTest<T>({
description: testDescription,
testFunction,
@ -61,7 +61,7 @@ export class Tap <T> {
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
public testParallel(testDescription: string, testFunction: ITestFunction) {
public testParallel(testDescription: string, testFunction: ITestFunction<T>) {
this._tapTests.push(
new TapTest({
description: testDescription,

View File

@ -9,7 +9,7 @@ import { HrtMeasurement } from '@pushrocks/smarttime';
// interfaces
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
export interface ITestFunction <T = unknown> { (tapTools?: TapTools): Promise<T> };
export interface ITestFunction <T> { (tapTools?: TapTools): Promise<T> };
export class TapTest <T = unknown> {
public description: string;

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