MCPcopy
hub / github.com/vercel/next.js / main

Function main

run-tests.js:220–881  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218}
219
220async 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

Callers 1

run-tests.jsFile · 0.70

Calls 15

acquireMethod · 0.95
releaseMethod · 0.95
checkBuildFreshnessFunction · 0.85
isMatchingPatternFunction · 0.85
cleanUpAndExitFunction · 0.85
getTestTimingsFunction · 0.85
createNextInstallFunction · 0.85
mockTraceFunction · 0.85
retryKVOperationFunction · 0.85
someMethod · 0.80
splitMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected