( options: CreateAppFixtureOptions, )
| 326 | } |
| 327 | |
| 328 | export 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 |
no test coverage detected