fix(core): update
This commit is contained in:
@ -23,7 +23,7 @@ export class Tap {
|
||||
test: (descriptionArg: string, testFunctionArg: ITestFunction) => {
|
||||
this.test(descriptionArg, testFunctionArg, 'only');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private _tapTests: TapTest[] = [];
|
||||
private _tapTestsOnly: TapTest[] = [];
|
||||
@ -33,13 +33,17 @@ 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, modeArg: 'normal' | 'only' | 'skip' = 'normal' ) {
|
||||
async test(
|
||||
testDescription: string,
|
||||
testFunction: ITestFunction,
|
||||
modeArg: 'normal' | 'only' | 'skip' = 'normal'
|
||||
) {
|
||||
let localTest = new TapTest({
|
||||
description: testDescription,
|
||||
testFunction: testFunction,
|
||||
parallel: false
|
||||
});
|
||||
if(modeArg === 'normal') {
|
||||
if (modeArg === 'normal') {
|
||||
this._tapTests.push(localTest);
|
||||
} else if (modeArg === 'only') {
|
||||
this._tapTestsOnly.push(localTest);
|
||||
@ -83,7 +87,7 @@ export class Tap {
|
||||
|
||||
// determine which tests to run
|
||||
let concerningTests: TapTest[];
|
||||
if(this._tapTestsOnly.length > 0) {
|
||||
if (this._tapTestsOnly.length > 0) {
|
||||
concerningTests = this._tapTestsOnly;
|
||||
} else {
|
||||
concerningTests = this._tapTests;
|
||||
|
@ -18,23 +18,23 @@ export class TapTools {
|
||||
/**
|
||||
* allow failure
|
||||
*/
|
||||
allowFailure() {
|
||||
public allowFailure() {
|
||||
this._tapTest.failureAllowed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* async/await delay method
|
||||
*/
|
||||
async delayFor(timeMilliArg) {
|
||||
public async delayFor(timeMilliArg) {
|
||||
await plugins.smartdelay.delayFor(timeMilliArg);
|
||||
}
|
||||
|
||||
async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||
public async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
||||
}
|
||||
|
||||
async timeout(timeMilliArg: number) {
|
||||
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||
public async timeout(timeMilliArg: number) {
|
||||
const timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||
timeout.makeUnrefed();
|
||||
await timeout.promise;
|
||||
if (this._tapTest.status === 'pending') {
|
||||
@ -42,11 +42,15 @@ export class TapTools {
|
||||
}
|
||||
}
|
||||
|
||||
async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||
public async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||
if (process.version.startsWith('v11')) {
|
||||
console.log('iteration leakage checks disabled for now on version 11 due to low performance');
|
||||
} else {
|
||||
await plugins.leakage.iterate.async(iterationfuncArg);
|
||||
}
|
||||
}
|
||||
|
||||
async returnError(throwingFuncArg: IPromiseFunc) {
|
||||
public async returnError(throwingFuncArg: IPromiseFunc) {
|
||||
let funcErr: Error;
|
||||
try {
|
||||
await throwingFuncArg();
|
||||
@ -55,4 +59,8 @@ export class TapTools {
|
||||
}
|
||||
return funcErr;
|
||||
}
|
||||
|
||||
public defer () {
|
||||
return plugins.smartpromise.defer();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user