now has working leak detection

This commit is contained in:
Philipp Kunz 2017-10-10 17:14:14 +02:00
parent f2eddb169f
commit 6c960f9fbd
9 changed files with 88 additions and 27 deletions

View File

@ -24,12 +24,6 @@ export declare class Tap {
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testParallel(testDescription: string, testFunction: ITestFunction): void;
/**
* 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): void;
/**
* starts the test evaluation
*/

View File

@ -56,13 +56,6 @@ class Tap {
parallel: true
}));
}
/**
* 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, testFunction) {
}
/**
* starts the test evaluation
*/
@ -115,4 +108,4 @@ class Tap {
}
exports.Tap = Tap;
exports.tap = new Tap();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFwYnVuZGxlLmNsYXNzZXMudGFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyRUFBb0U7QUFDcEUsMkVBQXVFO0FBQ3ZFO0lBQUE7UUFFRTs7V0FFRztRQUNILFNBQUksR0FBRztZQUNMLElBQUksRUFBRSxDQUFDLGNBQXNCLEVBQUUsV0FBMEIsRUFBRSxFQUFFO2dCQUMzRCxPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixjQUFjLEVBQUUsQ0FBQyxDQUFBO1lBQ2hELENBQUM7U0FDRixDQUFBO1FBRU8sY0FBUyxHQUFjLEVBQUUsQ0FBQTtJQXNHbkMsQ0FBQztJQXBHQzs7OztPQUlHO0lBQ0csSUFBSSxDQUFDLGVBQXVCLEVBQUUsWUFBMkI7O1lBQzdELElBQUksU0FBUyxHQUFHLElB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csQ0FBQyxJQUFJLENBQ2QsUUFBUSxPQUFPLENBQUMsT0FBTyxHQUFHLENBQUMsdUJBQXVCLE9BQU8sQ0FBQyxNQUFNLEtBQUs7MEJBQ25FLE1BQU0sT0FBTyxDQUFDLFdBQVcsSUFBSTswQkFDN0IsMkRBQTJELENBQzlELENBQUE7Z0JBQ0gsQ0FBQztZQUNILENBQUM7WUFFRCxzQkFBc0I7WUFDdEIsR0FBRyxDQUFDLENBQUMsSUFBSSxVQUFVLElBQUksV0FBVyxDQUFDLENBQUMsQ0FBQztnQkFDbkMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQTtZQUN6QixDQUFDO1lBRUQsRUFBRSxDQUFDLENBQUMsVUFBVSxJQUFJLFVBQVUsQ0FBQyxZQUFZLElBQUksV0FBVyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUNwRSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFBO1lBQ2pCLENBQUM7UUFDSCxDQUFDO0tBQUE7SUFFRDs7T0FFRztJQUNILEtBQUssQ0FBRSxHQUFHO1FBQ1IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUNsQixDQUFDO0NBQ0Y7QUF4R0Qsa0JBd0dDO0FBRVUsUUFBQSxHQUFHLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQSJ9

View File

@ -1,3 +1,6 @@
export interface IPromiseFunc {
(): Promise<any>;
}
export declare class TapTools {
/**
* the referenced TapTest
@ -12,5 +15,8 @@ export declare class TapTools {
* async/await delay method
*/
delayFor(timeMilliArg: any): Promise<void>;
delayForRandom(timeMilliMinArg: any, timeMilliMaxArg: any): Promise<void>;
timeout(timeMilliArg: number): Promise<void>;
checkIterationLeak(iterationfuncArg: IPromiseFunc): Promise<void>;
returnError(throwingFuncArg: IPromiseFunc): Promise<Error>;
}

View File

@ -27,6 +27,11 @@ class TapTools {
yield plugins.smartdelay.delayFor(timeMilliArg);
});
}
delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
return __awaiter(this, void 0, void 0, function* () {
yield plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
});
}
timeout(timeMilliArg) {
return __awaiter(this, void 0, void 0, function* () {
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
@ -37,6 +42,23 @@ class TapTools {
}
});
}
checkIterationLeak(iterationfuncArg) {
return __awaiter(this, void 0, void 0, function* () {
yield plugins.leakage.iterate.async(iterationfuncArg);
});
}
returnError(throwingFuncArg) {
return __awaiter(this, void 0, void 0, function* () {
let funcErr;
try {
yield throwingFuncArg();
}
catch (err) {
funcErr = err;
}
return funcErr;
});
}
}
exports.TapTools = TapTools;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUuY2xhc3Nlcy50YXB0b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBRzlDO0lBT0UsWUFBYSxVQUFVO1FBQ3JCLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFBO0lBQzVCLENBQUM7SUFFRDs7T0FFRztJQUNILFlBQVk7UUFDVixJQUFJLENBQUMsUUFBUSxDQUFDLGNBQWMsR0FBRyxJQUFJLENBQUE7SUFDckMsQ0FBQztJQUVEOztPQUVHO0lBQ0csUUFBUSxDQUFFLFlBQVk7O1lBQzFCLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakQsQ0FBQztLQUFBO0lBRUssT0FBTyxDQUFFLFlBQW9COztZQUNqQyxJQUFJLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ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FBQTtRQUMzRSxDQUFDO0tBQUE7SUFFSyxPQUFPLENBQUUsWUFBb0I7O1lBQ2pDLElBQUksT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7WUFDMUQsT0FBTyxDQUFDLFdBQVcsRUFBRSxDQUFBO1lBQ3JCLE1BQU0sT0FBTyxDQUFDLE9BQU8sQ0FBQTtZQUNyQixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sS0FBSyxTQUFTLENBQUMsQ0FBQyxDQUFDO2dCQUN2QyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUE7WUFDbEMsQ0FBQztRQUNILENBQUM7S0FBQTtJQUVLLGtCQUFrQixDQUFFLGdCQUE4Qjs7WUFDdEQsTUFBTSxPQUFPLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtRQUN2RCxDQUFDO0tBQUE7SUFFSyxXQUFXLENBQUUsZUFBNkI7O1lBQzlDLElBQUksT0FBYyxDQUFBO1lBQ2xCLElBQUksQ0FBQztnQkFDSCxNQUFNLGVBQWUsRUFBRSxDQUFBO1lBQ3pCLENBQUM7WUFBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO2dCQUNiLE9BQU8sR0FBRyxHQUFHLENBQUE7WUFDZixDQUFDO1lBQ0QsTUFBTSxDQUFDLE9BQU8sQ0FBQTtRQUNoQixDQUFDO0tBQUE7Q0FDRjtBQW5ERCw0QkFtREMifQ==

View File

@ -25,5 +25,8 @@
"smartdelay": "^1.0.3",
"smartq": "^1.1.1",
"typings-global": "^1.0.19"
},
"devDependencies": {
"randomstring": "^1.1.5"
}
}

View File

@ -0,0 +1,21 @@
import { tap, expect } from '../ts/index'
import * as randomstring from 'randomstring'
let test1 = tap.test('my first test -> expect true to be true', async (tools) => {
await tools.checkIterationLeak(async () => {
let domain = randomstring.generate(1000)
})
})
let outsideArray = []
let test2 = tap.test('should throw', async (tools) => {
let err = await tools.returnError(async () => {
await tools.checkIterationLeak(async () => {
outsideArray.push(randomstring.generate(1000))
})
})
expect(err).to.be.an.error()
})
tap.start()

View File

@ -50,15 +50,6 @@ 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
*/

View File

@ -1,6 +1,10 @@
import * as plugins from './tapbundle.plugins'
import { TapTest } from './tapbundle.classes.taptest'
export interface IPromiseFunc {
(): Promise<any>
}
export class TapTools {
/**
@ -26,6 +30,10 @@ export class TapTools {
await plugins.smartdelay.delayFor(timeMilliArg)
}
async delayForRandom (timeMilliMinArg, timeMilliMaxArg) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg)
}
async timeout (timeMilliArg: number) {
let timeout = new plugins.smartdelay.Timeout(timeMilliArg)
timeout.makeUnrefed()
@ -35,4 +43,17 @@ export class TapTools {
}
}
async checkIterationLeak (iterationfuncArg: IPromiseFunc) {
await plugins.leakage.iterate.async(iterationfuncArg)
}
async returnError (throwingFuncArg: IPromiseFunc) {
let funcErr: Error
try {
await throwingFuncArg()
} catch (err) {
funcErr = err
}
return funcErr
}
}

View File

@ -36,6 +36,10 @@ ansi-256-colors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
array-uniq@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.2.tgz#5fcc373920775723cfd64d65c64bef53bf9eba6d"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
@ -239,6 +243,12 @@ pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
randomstring@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/randomstring/-/randomstring-1.1.5.tgz#6df0628f75cbd5932930d9fe3ab4e956a18518c3"
dependencies:
array-uniq "1.0.2"
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"