fix(core): fix node 10.x.x compatibility

This commit is contained in:
Phil Kunz
2018-06-28 23:34:41 +02:00
parent 0028c5492b
commit 3199943b59
31 changed files with 681 additions and 1096 deletions

View File

@@ -1,59 +1,58 @@
import * as plugins from './tapbundle.plugins'
import { TapTest } from './tapbundle.classes.taptest'
import * as plugins from './tapbundle.plugins';
import { TapTest } from './tapbundle.classes.taptest';
export interface IPromiseFunc {
(): Promise<any>
(): Promise<any>;
}
export class TapTools {
/**
* the referenced TapTest
*/
private _tapTest: TapTest
private _tapTest: TapTest;
constructor (TapTestArg) {
this._tapTest = TapTestArg
constructor(TapTestArg) {
this._tapTest = TapTestArg;
}
/**
* allow failure
*/
allowFailure () {
this._tapTest.failureAllowed = true
allowFailure() {
this._tapTest.failureAllowed = true;
}
/**
* async/await delay method
*/
async delayFor (timeMilliArg) {
await plugins.smartdelay.delayFor(timeMilliArg)
async delayFor(timeMilliArg) {
await plugins.smartdelay.delayFor(timeMilliArg);
}
async delayForRandom (timeMilliMinArg, timeMilliMaxArg) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg)
async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
}
async timeout (timeMilliArg: number) {
let timeout = new plugins.smartdelay.Timeout(timeMilliArg)
timeout.makeUnrefed()
await timeout.promise
async timeout(timeMilliArg: number) {
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
timeout.makeUnrefed();
await timeout.promise;
if (this._tapTest.status === 'pending') {
this._tapTest.status = 'timeout'
this._tapTest.status = 'timeout';
}
}
async checkIterationLeak (iterationfuncArg: IPromiseFunc) {
await plugins.leakage.iterate.async(iterationfuncArg)
async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
await plugins.leakage.iterate.async(iterationfuncArg);
}
async returnError (throwingFuncArg: IPromiseFunc) {
let funcErr: Error
async returnError(throwingFuncArg: IPromiseFunc) {
let funcErr: Error;
try {
await throwingFuncArg()
await throwingFuncArg();
} catch (err) {
funcErr = err
funcErr = err;
}
return funcErr
return funcErr;
}
}