now supports tap.wrap
This commit is contained in:
parent
15bbf7f10c
commit
d22fc1b688
5
dist/index.d.ts
vendored
5
dist/index.d.ts
vendored
@ -1,4 +1,3 @@
|
||||
import 'typings-global';
|
||||
import { expect } from 'smartchai';
|
||||
import { tap } from './tapbundle.classes.tap';
|
||||
export { tap, expect };
|
||||
export { expect } from 'smartchai';
|
||||
export { tap } from './tapbundle.classes.tap';
|
||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-global");
|
||||
const smartchai_1 = require("smartchai");
|
||||
var smartchai_1 = require("smartchai");
|
||||
exports.expect = smartchai_1.expect;
|
||||
const tapbundle_classes_tap_1 = require("./tapbundle.classes.tap");
|
||||
var tapbundle_classes_tap_1 = require("./tapbundle.classes.tap");
|
||||
exports.tap = tapbundle_classes_tap_1.tap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix5Q0FBa0M7QUFLaEMsaUJBTE8sa0JBQU0sQ0FLUDtBQUpSLG1FQUE2QztBQUczQyxjQUhPLDJCQUFHLENBR1AifQ==
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix1Q0FBa0M7QUFBekIsNkJBQUEsTUFBTSxDQUFBO0FBQ2YsaUVBQTZDO0FBQXBDLHNDQUFBLEdBQUcsQ0FBQSJ9
|
10
dist/tapbundle.classes.tap.d.ts
vendored
10
dist/tapbundle.classes.tap.d.ts
vendored
@ -1,7 +1,11 @@
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
|
||||
export declare class Tap {
|
||||
/**
|
||||
* skip a test
|
||||
*/
|
||||
skip: {
|
||||
test: (...args: any[]) => void;
|
||||
test: (descriptionArg: string, functionArg: ITestFunction) => void;
|
||||
};
|
||||
private _tests;
|
||||
/**
|
||||
@ -10,6 +14,10 @@ export declare class Tap {
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
test(testDescription: string, testFunction: ITestFunction): Promise<TapTest>;
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap(functionArg: ITapWrapFunction): TapWrap;
|
||||
/**
|
||||
* A parallel test that will not be waited for before the next starts.
|
||||
* @param testDescription - A description of what the test does
|
||||
|
16
dist/tapbundle.classes.tap.js
vendored
16
dist/tapbundle.classes.tap.js
vendored
@ -9,11 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tapbundle_classes_taptest_1 = require("./tapbundle.classes.taptest");
|
||||
const tapbundle_classes_tapwrap_1 = require("./tapbundle.classes.tapwrap");
|
||||
class Tap {
|
||||
constructor() {
|
||||
/**
|
||||
* skip a test
|
||||
*/
|
||||
this.skip = {
|
||||
test: (...args) => {
|
||||
console.log('skipped');
|
||||
test: (descriptionArg, functionArg) => {
|
||||
console.log(`skipped test: ${descriptionArg}`);
|
||||
}
|
||||
};
|
||||
this._tests = [];
|
||||
@ -34,6 +38,12 @@ class Tap {
|
||||
return localTest;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap(functionArg) {
|
||||
return new tapbundle_classes_tapwrap_1.TapWrap(functionArg);
|
||||
}
|
||||
/**
|
||||
* A parallel test that will not be waited for before the next starts.
|
||||
* @param testDescription - A description of what the test does
|
||||
@ -87,4 +97,4 @@ class Tap {
|
||||
}
|
||||
exports.Tap = Tap;
|
||||
exports.tap = new Tap();
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFwYnVuZGxlLmNsYXNzZXMudGFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyRUFBb0U7QUFFcEU7SUFBQTtRQUNFLFNBQUksR0FBRztZQUNMLElBQUksRUFBRSxDQUFDLEdBQUcsSUFBSTtnQkFDWixPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFBO1lBQ3hCLENBQUM7U0FDRixDQUFBO1FBRU8sV0FBTSxHQUFjLEVBQUUsQ0FBQTtJQXNFaEMsQ0FBQztJQXBFQzs7OztPQUlHO0lBQ0csSUFBSSxDQUFDLGVBQXVCLEVBQUUsWUFBMkI7O1lBQzdELElBQUksU0FBUyxHQUFHLElBQUksbUNBQU8sQ0FBQztnQkFDMUIsV0FBVyxFQUFFLGVBQWU7Z0JBQzVCLFlBQVksRUFBRSxZQUFZO2dCQUMxQixRQUFRLEVBQUUsS0FBSzthQUNoQixDQUFDLENBQUE7WUFDRixJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtZQUMzQixNQUFNLENBQUMsU0FBUyxDQUFBO1FBQ2xCLENBQUM7S0FBQTtJQUVEOzs7O09BSUc7SUFDSCxZQUFZLENBQUMsZUFBdUIsRUFBRSxZQUEyQjtRQUMvRCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLG1DQUFPLENBQUM7WUFDM0IsV0FBVyxFQUFFLGVBQWU7WUFDNUIsWUFBWSxFQUFFLFlBQVk7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5RCxJQUFJLFdBQVcsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFFLE9BQU8sQ0FBRSxDQUFBO2dCQUN4QyxJQUFJLFdBQVcsR0FBRyxXQUFXLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUMxQyxFQUFFLENBQUMsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQztvQkFDekIsWUFBWSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQTtnQkFDaEMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixNQUFNLFdBQVcsQ0FBQTtnQkFDbkIsQ0FBQztZQUNILENBQUM7WUFDRCxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakMsQ0FBQztLQUFBO0lBRUQ7O09BRUc7SUFDSCxLQUFLLENBQUUsR0FBRztRQUNSLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7SUFDbEIsQ0FBQztDQUNGO0FBeEZELGtCQXdGQztBQUVVLFFBQUEsR0FBRyxHQUFHLElBQUksR0FBRyxFQUFFLENBQUEifQ==
|
2
dist/tapbundle.classes.taptools.js
vendored
2
dist/tapbundle.classes.taptools.js
vendored
@ -39,4 +39,4 @@ class TapTools {
|
||||
}
|
||||
}
|
||||
exports.TapTools = TapTools;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUuY2xhc3Nlcy50YXB0b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBRzlDO0lBT0UsWUFBWSxVQUFVO1FBQ3BCLElBQUksQ0FBQyxRQUFRLEdBQUc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BQVk7UUFDVixJQUFJLENBQUMsUUFBUSxDQUFDLGNBQWMsR0FBRyxJQUFJLENBQUE7SUFDckMsQ0FBQztJQUVEOztPQUVHO0lBQ0csUUFBUSxDQUFFLFlBQVk7O1lBQzFCLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakQsQ0FBQztLQUFBO0lBRUssT0FBTyxDQUFFLFlBQW9COztZQUNqQyxJQUFJLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFBO1lBQzFELE9BQU8sQ0FBQyxXQUFXLEVBQUUsQ0FBQTtZQUNyQixNQUFNLE9BQU8sQ0FBQyxPQUFPLENBQUE7WUFDckIsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxNQUFNLEtBQUssU0FBUyxDQUFDLENBQUMsQ0FBQztnQkFDdkMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFBO1lBQ2xDLENBQUM7UUFDSCxDQUFDO0tBQUE7Q0FFRjtBQWxDRCw0QkFrQ0MifQ==
|
14
dist/tapbundle.classes.tapwrap.d.ts
vendored
Normal file
14
dist/tapbundle.classes.tapwrap.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
export interface ITapWrapFunction {
|
||||
(): Promise<any>;
|
||||
}
|
||||
export declare class TapWrap {
|
||||
wrapFunction: ITapWrapFunction;
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor(wrapFunctionArg: ITapWrapFunction);
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
run(): Promise<void>;
|
||||
}
|
29
dist/tapbundle.classes.tapwrap.js
vendored
Normal file
29
dist/tapbundle.classes.tapwrap.js
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class TapWrap {
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor(wrapFunctionArg) {
|
||||
// nothing here
|
||||
this.wrapFunction = wrapFunctionArg;
|
||||
}
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.wrapFunction();
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.TapWrap = TapWrap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwd3JhcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3RhcGJ1bmRsZS5jbGFzc2VzLnRhcHdyYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQU1BO0lBR0U7O09BRUc7SUFDSCxZQUFhLGVBQWlDO1FBQzVDLGVBQWU7UUFDZixJQUFJLENBQUMsWUFBWSxHQUFHLGVBQWUsQ0FBQTtJQUNyQyxDQUFDO0lBRUQ7O09BRUc7SUFDRyxHQUFHOztZQUNQLE1BQU0sSUFBSSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzNCLENBQUM7S0FBQTtDQUNGO0FBakJELDBCQWlCQyJ9
|
@ -3,5 +3,10 @@
|
||||
"globalNpmTools": [
|
||||
"npmts"
|
||||
]
|
||||
},
|
||||
"npmts": {
|
||||
"testConfig": {
|
||||
"parallel": false
|
||||
}
|
||||
}
|
||||
}
|
10
test/test.tapwrap.ts
Normal file
10
test/test.tapwrap.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { tap, expect } from '../dist/index'
|
||||
|
||||
let tapwrap = tap.wrap(async () => {
|
||||
tap.test('should do something', async () => {
|
||||
console.log('test1')
|
||||
})
|
||||
tap.start()
|
||||
})
|
||||
|
||||
tapwrap.run()
|
@ -1,11 +1,15 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
|
||||
import { TapTest, ITestFunction } from './tapbundle.classes.taptest'
|
||||
import { TapWrap } from './tapbundle.classes.tapwrap'
|
||||
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap'
|
||||
export class Tap {
|
||||
|
||||
/**
|
||||
* skip a test
|
||||
*/
|
||||
skip = {
|
||||
test: (...args) => {
|
||||
console.log('skipped')
|
||||
test: (descriptionArg: string, functionArg: ITestFunction) => {
|
||||
console.log(`skipped test: ${descriptionArg}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +20,7 @@ export class Tap {
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
async test(testDescription: string, testFunction: ITestFunction) {
|
||||
async test (testDescription: string, testFunction: ITestFunction) {
|
||||
let localTest = new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
@ -26,12 +30,19 @@ export class Tap {
|
||||
return localTest
|
||||
}
|
||||
|
||||
/**
|
||||
* wraps function
|
||||
*/
|
||||
wrap (functionArg: ITapWrapFunction) {
|
||||
return new TapWrap(functionArg)
|
||||
}
|
||||
|
||||
/**
|
||||
* A parallel test that will not be waited for before the next starts.
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testParallel(testDescription: string, testFunction: ITestFunction) {
|
||||
testParallel (testDescription: string, testFunction: ITestFunction) {
|
||||
this._tests.push(new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
@ -44,14 +55,14 @@ export class Tap {
|
||||
* @param testDescription - A description of what the test does
|
||||
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
||||
*/
|
||||
testLeakage(testDescription: string, testFunction: ITestFunction) {
|
||||
testLeakage (testDescription: string, testFunction: ITestFunction) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
async start() {
|
||||
async start () {
|
||||
let promiseArray: Promise<any>[] = []
|
||||
|
||||
// safeguard against empty test array
|
||||
@ -76,7 +87,7 @@ export class Tap {
|
||||
/**
|
||||
* handle errors
|
||||
*/
|
||||
threw(err) {
|
||||
threw (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export class TapTools {
|
||||
*/
|
||||
private _tapTest: TapTest
|
||||
|
||||
constructor(TapTestArg) {
|
||||
constructor (TapTestArg) {
|
||||
this._tapTest = TapTestArg
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,20 @@ export interface ITapWrapFunction {
|
||||
}
|
||||
|
||||
export class TapWrap {
|
||||
asyncFunction: ITapWrapFunction
|
||||
constructor(functionArg: ITapWrapFunction) {
|
||||
wrapFunction: ITapWrapFunction
|
||||
|
||||
/**
|
||||
* the constructor
|
||||
*/
|
||||
constructor (wrapFunctionArg: ITapWrapFunction) {
|
||||
// nothing here
|
||||
|
||||
|
||||
this.wrapFunction = wrapFunctionArg
|
||||
}
|
||||
|
||||
/**
|
||||
* run the wrapFunction
|
||||
*/
|
||||
async run () {
|
||||
await this.wrapFunction()
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
|
||||
export class TapCreator {
|
||||
|
||||
// TODO:
|
||||
}
|
||||
|
||||
export let tapCreator = new TapCreator()
|
Loading…
Reference in New Issue
Block a user