MCPcopy Create free account
hub / github.com/TanStack/cli / createAppFixture

Function createAppFixture

packages/cli/tests-e2e/helpers.ts:328–486  ·  view source on GitHub ↗
(
  options: CreateAppFixtureOptions,
)

Source from the content-addressed store, hash-verified

326}
327
328export async function createAppFixture(
329 options: CreateAppFixtureOptions,
330): Promise<E2EApp> {
331 await access(cliDistPath)
332
333 const timings: Array<[string, number]> = []
334 const now = () => performance.now()
335 const start = now()
336 const mark = (label: string, startedAt: number) => {
337 timings.push([label, now() - startedAt])
338 }
339 const logTimings = () => {
340 if (!envBoolean('E2E_TIMINGS', true)) {
341 return
342 }
343
344 const totalMs = now() - start
345 const summary = timings.map(([label, ms]) => `${label}=${Math.round(ms)}ms`).join(' | ')
346 console.log(`[e2e:timing] ${options.appName} :: ${summary} | total=${Math.round(totalMs)}ms`)
347 }
348
349 const rootDir = await mkdtemp(join(tmpdir(), 'tanstack-cli-e2e-'))
350 const {
351 appName,
352 template,
353 addOns,
354 postCreateAddOns,
355 skipDevServer,
356 runQualityGatesChecks = false,
357 framework = 'react',
358 packageManager = 'pnpm',
359 routerOnly = false,
360 } = options
361 const appDir = join(rootDir, appName)
362
363 const createArgs = [
364 cliDistPath,
365 'create',
366 appName,
367 '--framework',
368 framework,
369 '--package-manager',
370 packageManager,
371 '--no-git',
372 ]
373
374 if (routerOnly) {
375 createArgs.push('--router-only')
376 }
377
378 if (template) {
379 createArgs.push('--template', template)
380 }
381
382 if (addOns?.length) {
383 createArgs.push('--add-ons', addOns.join(','))
384 }
385

Callers 3

createReactAppFixtureFunction · 0.85

Calls 10

nowFunction · 0.85
runCommandFunction · 0.85
markFunction · 0.85
patchViteConfigForE2EFunction · 0.85
runQualityGatesFunction · 0.85
logTimingsFunction · 0.85
waitForDevServerURLFunction · 0.85
waitForServerFunction · 0.85
stopChildFunction · 0.85

Tested by

no test coverage detected