(args: IArguments, syncTest: Function, asyncTest?: Function)
| 52 | }; |
| 53 | |
| 54 | function modifyArguments(args: IArguments, syncTest: Function, asyncTest?: Function): any[] { |
| 55 | for (let i = 0; i < args.length; i++) { |
| 56 | let arg = args[i]; |
| 57 | if (typeof arg === 'function') { |
| 58 | // The `done` callback is only passed through if the function expects at |
| 59 | // least one argument. |
| 60 | // Note we have to make a function with correct number of arguments, |
| 61 | // otherwise mocha will |
| 62 | // think that all functions are sync or async. |
| 63 | args[i] = arg.length === 0 ? syncTest(arg) : asyncTest!(arg); |
| 64 | // Mocha uses toString to view the test body in the result list, make sure we return the |
| 65 | // correct function body |
| 66 | args[i].toString = function () { |
| 67 | return arg.toString(); |
| 68 | }; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return args as any; |
| 73 | } |
| 74 | |
| 75 | function wrapDescribeInZone(args: IArguments): any[] { |
| 76 | const syncTest: any = function (fn: Function) { |
no test coverage detected
searching dependent graphs…