()
| 218 | } |
| 219 | |
| 220 | async function main() { |
| 221 | // Ensure we have the arguments awaited from yargs. |
| 222 | argv = await argv |
| 223 | |
| 224 | // Check for stale or missing build |
| 225 | await checkBuildFreshness() |
| 226 | |
| 227 | // `.github/workflows/build_reusable.yml` sets this, we should use it unless |
| 228 | // it's overridden by an explicit `--concurrency` argument. |
| 229 | const envConcurrency = |
| 230 | process.env.TEST_CONCURRENCY && parseInt(process.env.TEST_CONCURRENCY, 10) |
| 231 | |
| 232 | const options = { |
| 233 | concurrency: argv.concurrency ?? envConcurrency ?? DEFAULT_CONCURRENCY, |
| 234 | debug: argv.debug ?? false, |
| 235 | timings: argv.timings ?? false, |
| 236 | writeTimings: argv.writeTimings ?? false, |
| 237 | group: argv.group ?? false, |
| 238 | testPattern: argv.testPattern ?? false, |
| 239 | type: argv.type ?? false, |
| 240 | retries: argv.retries ?? DEFAULT_NUM_RETRIES, |
| 241 | requireTimings: argv.requireTimings ?? false, |
| 242 | dry: argv.dry ?? false, |
| 243 | local: argv.local ?? false, |
| 244 | printTests: argv.printTests ?? false, |
| 245 | } |
| 246 | let numRetries = options.retries |
| 247 | const hideOutput = !options.debug && !options.dry |
| 248 | |
| 249 | let filterTestsBy |
| 250 | |
| 251 | switch (options.type) { |
| 252 | case 'unit': { |
| 253 | numRetries = 0 |
| 254 | filterTestsBy = testFilters.unit |
| 255 | break |
| 256 | } |
| 257 | case 'all': { |
| 258 | filterTestsBy = 'none' |
| 259 | break |
| 260 | } |
| 261 | default: { |
| 262 | filterTestsBy = testFilters[options.type] |
| 263 | break |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | console.log( |
| 268 | 'Running tests with concurrency:', |
| 269 | options.concurrency, |
| 270 | 'in test mode', |
| 271 | process.env.NEXT_TEST_MODE |
| 272 | ) |
| 273 | |
| 274 | // Only fetch/update shared timing data during grouped CI runs to avoid |
| 275 | // individual test runs from polluting the timing data |
| 276 | const shouldUseSharedTimings = options.timings && options.group |
| 277 |
no test coverage detected