Compare commits
45 Commits
Author | SHA1 | Date | |
---|---|---|---|
1b9f414e82 | |||
1aa4152de2 | |||
b93e962bdf | |||
0faf2ce3df | |||
831f67053e | |||
26e63372f8 | |||
929a67585f | |||
fb8d291441 | |||
5657b49a51 | |||
db39da1faf | |||
e9d6e9f9dd | |||
d8e638a07f | |||
85eb222bd9 | |||
189c0bae30 | |||
570422ae61 | |||
4ba34a4b88 | |||
ae2aabaa86 | |||
269a8c974e | |||
10ab777e7f | |||
898eed4584 | |||
7a1eae2bfb | |||
8f7167f201 | |||
6fa151f933 | |||
f846b91378 | |||
a0840ee9f4 | |||
041534f363 | |||
c89362ba8a | |||
f07879d2c1 | |||
eba3a19488 | |||
f83479a407 | |||
da711c119f | |||
6690238251 | |||
27a794b83c | |||
b3c4a58491 | |||
50c34f89ee | |||
b813453c5f | |||
9a6dc33b6b | |||
8bf99ae7ec | |||
cc708b29ae | |||
5798d3e808 | |||
37fe299a45 | |||
e24cdd9f0f | |||
ae7aaab456 | |||
bab360cc59 | |||
36dcd228fd |
@ -12,10 +12,10 @@
|
|||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "tapbundle",
|
"gitrepo": "tapbundle",
|
||||||
"shortDescription": "tap bundled for tapbuffer",
|
"shortDescription": "tap bundled for tapbuffer",
|
||||||
"npmPackagename": "@pushrocks/tapbundle",
|
"npmPackagename": "@push.rocks/tapbundle",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27090
package-lock.json
generated
27090
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/tapbundle",
|
"name": "@push.rocks/tapbundle",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "4.0.1",
|
"version": "5.0.14",
|
||||||
"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",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web --allowimplicitany --skiplibcheck)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -20,21 +21,19 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@open-wc/testing-helpers": "^2.0.3",
|
"@open-wc/testing": "^2.5.33",
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@pushrocks/smartenv": "^4.0.16",
|
"@push.rocks/smartenv": "^5.0.5",
|
||||||
"@pushrocks/smartexpect": "^1.0.8",
|
"@push.rocks/smartexpect": "^1.0.21",
|
||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"@pushrocks/smarttime": "^3.0.43"
|
"@push.rocks/smarttime": "^4.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.29",
|
"@gitzone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsrun": "^1.2.18",
|
"@gitzone/tsrun": "^1.2.43",
|
||||||
"@gitzone/tstest": "^1.0.60",
|
"@gitzone/tstest": "^1.0.77",
|
||||||
"@types/node": "^17.0.14",
|
"@types/node": "^20.4.10",
|
||||||
"randomstring": "^1.2.2",
|
"randomstring": "^1.3.0"
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
5918
pnpm-lock.yaml
generated
Normal file
5918
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
readme.md
29
readme.md
@ -1,5 +1,5 @@
|
|||||||
# @pushrocks/tapbundle
|
# @pushrocks/tapbundle
|
||||||
tap bundled for tapbuffer
|
tap based testing framework for use with @gitzone/tstest
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/tapbundle)
|
||||||
@ -31,14 +31,17 @@ A few words on TypeScript
|
|||||||
|
|
||||||
### Included in this package
|
### Included in this package
|
||||||
|
|
||||||
- tap compatible testing framework written in TypeScript
|
* tap compatible testing framework written in TypeScript
|
||||||
- a collection of test tools
|
* `expect` and `expectAsync` from the package `@pushrocks/smartexpect`
|
||||||
- **code** testing framework with typings
|
|
||||||
|
### A few words on tap
|
||||||
|
|
||||||
|
**"tap"** stands for **"test anything protocol"**. Its programming language agnostic as long as the test interpreter can read the tap console output. This package is optimized to work with @gitzone/tstest as interpreter, which offers different V8 based runtime environments like nodejs, chrome, and deno.
|
||||||
|
|
||||||
### Write your first tests
|
### Write your first tests
|
||||||
|
|
||||||
```javascript
|
```typescript
|
||||||
import { tap, expect } from 'tapbundle'; // has typings in place
|
import { tap, expect, expectAsync } from 'tapbundle'; // has typings in place
|
||||||
|
|
||||||
import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules
|
import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules
|
||||||
|
|
||||||
@ -47,25 +50,27 @@ tap.test('my awesome description', async (tools) => {
|
|||||||
tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds
|
tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds
|
||||||
});
|
});
|
||||||
|
|
||||||
let myTest2 = tap.test('my awesome test 2', async (tools) => {
|
const myTest2 = tap.test('my awesome test 2', async (tools) => {
|
||||||
myAwsomeModuleToTest.doSomethingAsync(); // we don't wait here
|
myAwsomeModuleToTest.doSomethingAsync(); // we don't wait here
|
||||||
await tools.delayFor(3000); // yay! :) promise based timeouts :)
|
await tools.delayFor(3000); // yay! :) promise based timeouts :)
|
||||||
console.log('This gets logged 3000 ms into the test');
|
console.log('This gets logged 3000 ms into the test');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('my awesome test 3', async (tools) => {
|
tap.test('my awesome test 3', async (tools) => {
|
||||||
expect(true).to.be.true; // will not throw
|
expect(true).toBeTrue(); // will not throw
|
||||||
await expect(tools.delayFor(2000)).to.eventually.be.fulfilled; // yay expect promises :)
|
await expectAsync(tools.delayFor(2000)).toBeUndefined(); // yay expect promises :)
|
||||||
expect((await myTest2.promise).hrtMeasurement.milliSeconds > 1000).to.be.true; // access other tests metadata :)
|
expectAsync(myTest2.promise) // access other tests metadata :)
|
||||||
|
.property('hrtMeasurement') // and drill down into properties
|
||||||
|
.property('milliSeconds').toBeGreaterThan(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
let myTest4 = tap.testParallel('my awesome test 4', async (tools) => {
|
const myTest4 = tap.testParallel('my awesome test 4', async (tools) => {
|
||||||
await tools.delayFor(4000);
|
await tools.delayFor(4000);
|
||||||
console.log('logs to console after 4 seconds into this test');
|
console.log('logs to console after 4 seconds into this test');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('my awesome test 5', async () => {
|
tap.test('my awesome test 5', async () => {
|
||||||
expect(myTest4.status).to.equal('pending'); // since this test will likely finish before myTest4.
|
expect(myTest4.status).toEqual('pending'); // since this test will likely finish before myTest4.
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start(); // start the test, will automtically plan tests for you (so the tap parser knows when tests exit bofore they are finished)
|
tap.start(); // start the test, will automtically plan tests for you (so the tap parser knows when tests exit bofore they are finished)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { tap, expect, webhelpers } from '../ts/index';
|
import { tap, expect, webhelpers } from '../ts/index.js';
|
||||||
|
|
||||||
tap.preTask('custompretask', async () => {
|
tap.preTask('custompretask', async () => {
|
||||||
console.log('this is a pretask');
|
console.log('this is a pretask');
|
||||||
@ -21,8 +21,8 @@ const test2 = tap.test('my second test', async (tools) => {
|
|||||||
const test3 = tap.test(
|
const test3 = tap.test(
|
||||||
'my third test -> test2 should take longer than test1 and endure at least 1000ms',
|
'my third test -> test2 should take longer than test1 and endure at least 1000ms',
|
||||||
async () => {
|
async () => {
|
||||||
expect((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).toBeTrue();
|
expect((await test1.testPromise).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).toBeTrue();
|
||||||
expect((await test2).hrtMeasurement.milliSeconds > 10).toBeTrue();
|
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 10).toBeTrue();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import { tap, expect, TapWrap } from '../ts/index';
|
import { tap, expect, TapWrap } from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('should run a test', async () => {});
|
tap.test('should run a test', async () => {});
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { tap, expect } from '../ts/index';
|
import { tap, expect } from '../ts/index.js';
|
||||||
|
|
||||||
tap.preTask('hi there', async () => {
|
tap.preTask('hi there', async () => {
|
||||||
console.log('this is a pretask');
|
console.log('this is a pretask');
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@push.rocks/tapbundle',
|
||||||
|
version: '5.0.14',
|
||||||
|
description: 'tap bundled for tapbuffer'
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
export { tap } from './tapbundle.classes.tap';
|
export { tap } from './tapbundle.classes.tap.js';
|
||||||
export { TapWrap } from './tapbundle.classes.tapwrap';
|
export { TapWrap } from './tapbundle.classes.tapwrap.js';
|
||||||
export { webhelpers } from './webhelpers';
|
export { webhelpers } from './webhelpers.js';
|
||||||
|
|
||||||
import { expect, expectAsync } from '@pushrocks/smartexpect';
|
import { expect, expectAsync } from '@push.rocks/smartexpect';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
expect,
|
expect,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
import { TapTools } from './tapbundle.classes.taptools';
|
import { TapTools } from './tapbundle.classes.taptools.js';
|
||||||
|
|
||||||
export interface IPreTaskFunction {
|
export interface IPreTaskFunction {
|
||||||
(tapTools?: TapTools): Promise<any>;
|
(tapTools?: TapTools): Promise<any>;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
|
|
||||||
import { IPreTaskFunction, PreTask } from './tapbundle.classes.pretask';
|
import { type IPreTaskFunction, PreTask } from './tapbundle.classes.pretask.js';
|
||||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
import { TapTest, type ITestFunction } from './tapbundle.classes.taptest.js';
|
||||||
export class Tap <T> {
|
export class Tap<T> {
|
||||||
/**
|
/**
|
||||||
* skips a test
|
* skips a test
|
||||||
* tests marked with tap.skip.test() are never executed
|
* tests marked with tap.skip.test() are never executed
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
import { tapCreator } from './tapbundle.tapcreator';
|
import { tapCreator } from './tapbundle.tapcreator.js';
|
||||||
import { TapTools } from './tapbundle.classes.taptools';
|
import { TapTools } from './tapbundle.classes.taptools.js';
|
||||||
|
|
||||||
// imported interfaces
|
// imported interfaces
|
||||||
import { Deferred } from '@pushrocks/smartpromise';
|
import { Deferred } from '@push.rocks/smartpromise';
|
||||||
import { HrtMeasurement } from '@pushrocks/smarttime';
|
import { HrtMeasurement } from '@push.rocks/smarttime';
|
||||||
|
|
||||||
// interfaces
|
// interfaces
|
||||||
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
|
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
import { TapTest } from './tapbundle.classes.taptest';
|
import { TapTest } from './tapbundle.classes.taptest.js';
|
||||||
|
|
||||||
export interface IPromiseFunc {
|
export interface IPromiseFunc {
|
||||||
(): Promise<any>;
|
(): Promise<any>;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
|
|
||||||
export interface ITapWrapOptions {
|
export interface ITapWrapOptions {
|
||||||
before: () => Promise<any>;
|
before: () => Promise<any>;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// pushrocks
|
// pushrocks
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartenv from '@pushrocks/smartenv';
|
import * as smartenv from '@push.rocks/smartenv';
|
||||||
import * as smartexpect from '@pushrocks/smartexpect';
|
import * as smartexpect from '@push.rocks/smartexpect';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
|
||||||
export { smartdelay, smartenv, smartexpect, smartpromise };
|
export { smartdelay, smartenv, smartexpect, smartpromise };
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
|
|
||||||
export class TapCreator {
|
export class TapCreator {
|
||||||
// TODO:
|
// TODO:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from './tapbundle.plugins';
|
import * as plugins from './tapbundle.plugins.js';
|
||||||
import type { fixture, html } from '@open-wc/testing-helpers';
|
import type { fixture, html } from '@open-wc/testing';
|
||||||
import { tap } from './tapbundle.classes.tap';
|
import { tap } from './tapbundle.classes.tap.js';
|
||||||
|
|
||||||
class WebHelpers {
|
class WebHelpers {
|
||||||
html: typeof html;
|
html: typeof html;
|
||||||
@ -15,7 +15,7 @@ class WebHelpers {
|
|||||||
|
|
||||||
public enable() {
|
public enable() {
|
||||||
tap.preTask('enable webhelpers', async () => {
|
tap.preTask('enable webhelpers', async () => {
|
||||||
const webhelpers = await import('@open-wc/testing-helpers')
|
const webhelpers = await import('@open-wc/testing');
|
||||||
this.html = webhelpers.html;
|
this.html = webhelpers.html;
|
||||||
this.fixture = webhelpers.fixture;
|
this.fixture = webhelpers.fixture;
|
||||||
})
|
})
|
||||||
|
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
}
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Reference in New Issue
Block a user