* @param avaDeclareFunction either test or test.serial
(
title: string | undefined,
macros: AvaMacro<any[], Context>[],
avaDeclareFunction: Function & { skip: Function },
args: any[],
skip = false
)
| 195 | * @param avaDeclareFunction either test or test.serial |
| 196 | */ |
| 197 | function declareTest( |
| 198 | title: string | undefined, |
| 199 | macros: AvaMacro<any[], Context>[], |
| 200 | avaDeclareFunction: Function & { skip: Function }, |
| 201 | args: any[], |
| 202 | skip = false |
| 203 | ) { |
| 204 | const wrappedMacros = macros.map((macro) => { |
| 205 | return async function (t: ExecutionContext<Context>, ...args: any[]) { |
| 206 | return concurrencyLimiter( |
| 207 | errorPostprocessor(async () => { |
| 208 | let i = 0; |
| 209 | for (const func of beforeEachFunctions) { |
| 210 | await func(t); |
| 211 | i++; |
| 212 | } |
| 213 | return macro(t, ...args); |
| 214 | }) |
| 215 | ); |
| 216 | }; |
| 217 | }); |
| 218 | const computedTitle = computeTitle(title, macros, ...args); |
| 219 | (automaticallySkip || skip ? avaDeclareFunction.skip : avaDeclareFunction)( |
| 220 | computedTitle, |
| 221 | wrappedMacros, |
| 222 | ...args |
| 223 | ); |
| 224 | } |
| 225 | function test(...inputArgs: any[]) { |
| 226 | assertOrderingForDeclaringTest(); |
| 227 | // TODO is this safe to disable? |
searching dependent graphs…