implemet errorAfterSuccess
This commit is contained in:
@ -6,4 +6,4 @@ import { tap } from './tapbundle.tap'
|
||||
export {
|
||||
tap,
|
||||
expect
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'typings-global'
|
||||
import * as smartq from 'smartq'
|
||||
import * as leakage from 'leakage'
|
||||
|
||||
export {
|
||||
smartq
|
||||
smartq,
|
||||
leakage
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
|
||||
import { tapCreator } from './tapbundle.tapcreator'
|
||||
|
||||
// interfaces
|
||||
export type TTestStatus = 'success' | 'error' | 'pending'
|
||||
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess'
|
||||
|
||||
export interface ITestFunction {
|
||||
(): Promise<any>
|
||||
@ -35,8 +37,14 @@ export class TapTest {
|
||||
async run (testKeyArg: number) {
|
||||
try {
|
||||
await this.testFunction()
|
||||
console.log(`ok ${testKeyArg + 1} - ${this.description}`)
|
||||
console.log(`ok ${testKeyArg + 1} - ${this.description} # time=20.040ms`)
|
||||
this.status = 'success'
|
||||
} catch (err) {
|
||||
console.log(`not ok ${testKeyArg + 1} - ${this.description} # time=20.040ms`)
|
||||
if (this.status === 'success') {
|
||||
this.status = 'errorAfterSuccess'
|
||||
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull')
|
||||
}
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
@ -45,6 +53,11 @@ export class TapTest {
|
||||
export class Tap {
|
||||
private _tests: TapTest[] = []
|
||||
|
||||
/**
|
||||
* Normal test function, will run one by one
|
||||
* @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) {
|
||||
this._tests.push(new TapTest({
|
||||
description: testDescription,
|
||||
@ -53,6 +66,11 @@ export class Tap {
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
this._tests.push(new TapTest({
|
||||
description: testDescription,
|
||||
@ -61,6 +79,15 @@ export class Tap {
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* tests leakage
|
||||
* @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) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the test evaluation
|
||||
*/
|
||||
|
7
ts/tapbundle.tapcreator.ts
Normal file
7
ts/tapbundle.tapcreator.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import * as plugins from './tapbundle.plugins'
|
||||
|
||||
export class TapCreator {
|
||||
|
||||
}
|
||||
|
||||
export let tapCreator = new TapCreator()
|
Reference in New Issue
Block a user