File tree Expand file tree Collapse file tree 7 files changed +34
-55
lines changed
Expand file tree Collapse file tree 7 files changed +34
-55
lines changed Original file line number Diff line number Diff line change @@ -11,28 +11,33 @@ const BASE_URL = `http://localhost:${PORT}`;
1111export default defineConfig ( {
1212 testDir : "../e2e" , // all E2E specs live here
1313 snapshotDir : "../snapshots" ,
14- workers : 1 ,
15- timeout : 300_000 ,
14+ workers : 2 ,
15+ timeout : 30_000 ,
1616 expect : {
17- timeout : 150_000 ,
17+ timeout : 15_000 ,
1818 } ,
1919 reporter : "html" ,
20- globalSetup : path . resolve ( __dirname , "../helpers/globalSetup.next.js" ) ,
2120
2221 use : {
2322 headless : true ,
2423 baseURL : BASE_URL ,
2524
2625 } ,
2726
28- // One project = one fixture app (Next, Vite, etc.)
2927 projects : [
28+ {
29+ name : "setup" ,
30+ testMatch : / n e x t S e t u p \. j s / ,
31+ } ,
32+ {
33+ name : "next-cli-e2e" ,
34+ dependencies : [ "setup" ] ,
35+ testMatch : / c l i - n e x t \. s p e c \. j s / ,
36+ } ,
3037 {
3138 name : "next-e2e" ,
32- testMatch : / .* n e x t .* \. s p e c \. j s / , // Matches both cli-next.spec.js and next.spec.js
33- use : {
34- baseURL : BASE_URL ,
35- } ,
39+ dependencies : [ "next-cli-e2e" ] ,
40+ testMatch : / n e x t \. s p e c \. j s / ,
3641 } ,
3742 ] ,
3843 webServer : {
Original file line number Diff line number Diff line change @@ -11,13 +11,12 @@ const BASE_URL = `http://localhost:${PORT}`;
1111export default defineConfig ( {
1212 testDir : "../e2e" , // all E2E specs live here
1313 snapshotDir : "../snapshots" ,
14- workers : 1 ,
15- timeout : 300_000 ,
14+ workers : 2 ,
15+ timeout : 30_000 ,
1616 expect : {
17- timeout : 150_000 ,
17+ timeout : 15_000 ,
1818 } ,
1919 reporter : "html" ,
20- globalSetup : path . resolve ( __dirname , "../helpers/globalSetup.vite.js" ) ,
2120
2221 use : {
2322 headless : true ,
@@ -26,19 +25,19 @@ export default defineConfig({
2625
2726 // One project = one fixture app (Next, Vite, etc.)
2827 projects : [
28+ {
29+ name : "setup" ,
30+ testMatch : / v i t e S e t u p \. j s / ,
31+ } ,
2932 {
3033 name : "vite-cli-e2e" ,
34+ dependencies : [ "setup" ] ,
3135 testMatch : / c l i - v i t e \. s p e c \. j s / , // Matches both cli-vite.spec.js and vite.spec.js
32- use : {
33- baseURL : BASE_URL ,
34- } ,
3536 } ,
3637 {
3738 name : "vite-e2e" ,
39+ dependencies : [ "vite-cli-e2e" ] ,
3840 testMatch : / v i t e \. s p e c \. j s / , // Matches both cli-vite.spec.js and vite.spec.js
39- use : {
40- baseURL : BASE_URL ,
41- } ,
4241 } ,
4342 ] ,
4443 webServer : {
Original file line number Diff line number Diff line change 1- // packages/core/__tests__/helpers/globalSetup.next.js
21import { resetZeroUiState } from '../helpers/resetProjectState.js' ;
32import { loadCliFromFixture } from '../helpers/loadCli.js' ;
43import path from 'node:path' ;
54import { fileURLToPath } from 'node:url' ;
65
76const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
8- console . log ( '__dirname: ' , __dirname ) ;
97
108export default async function globalSetup ( ) {
119 const projectDir = path . resolve ( __dirname , '../fixtures/next' ) ;
12- console . log ( 'projectDir: ' , projectDir ) ;
1310
1411 // Reset and setup the Next.js fixture
1512 console . log ( '[Global Setup] Setting up Next.js fixture...' ) ;
@@ -18,5 +15,5 @@ export default async function globalSetup() {
1815 const zeroUiCli = await loadCliFromFixture ( projectDir ) ;
1916 await zeroUiCli ( [ ] ) ;
2017
21- console . log ( '[Global Setup] Next.js fixture setup complete!' ) ;
18+ console . log ( '[Global Setup] ✅ Next.js fixture setup complete!✅ ' ) ;
2219}
Original file line number Diff line number Diff line change 1- // packages/core/__tests__/helpers/globalSetup.vite.js
2- import { resetZeroUiState } from './resetProjectState.js' ;
3- import { loadCliFromFixture } from './loadCli.js' ;
1+ import { resetZeroUiState } from '../helpers/resetProjectState.js' ;
2+ import { loadCliFromFixture } from '../helpers/loadCli.js' ;
43import path from 'node:path' ;
54import { fileURLToPath } from 'node:url' ;
65
@@ -16,5 +15,5 @@ export default async function globalSetup() {
1615 const zeroUiCli = await loadCliFromFixture ( projectDir ) ;
1716 await zeroUiCli ( [ ] ) ;
1817
19- console . log ( '[Global Setup] Vite fixture setup complete!' ) ;
18+ console . log ( '[Global Setup] ✅ Vite fixture setup complete!✅ ' ) ;
2019}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,14 +6,15 @@ export async function loadCliFromFixture(fixtureDir) {
66 const r = createRequire ( path . join ( fixtureDir , 'package.json' ) ) ;
77 const modulePath = r . resolve ( '../../../src/cli/init.cjs' ) ; // get the path
88 const mod = r ( modulePath ) ; // actually require the module
9-
9+ console . log ( '[Global Setup] Loaded CLI from fixture:' , modulePath ) ;
1010 // Return a wrapper function that changes directory before running CLI
1111 const wrappedCli = async ( args = [ ] ) => {
1212 const originalCwd = process . cwd ( ) ;
1313 try {
1414 process . chdir ( fixtureDir ) ; // Change to fixture directory
1515
1616 // The init.cjs exports a cli function, so call it
17+
1718 if ( typeof mod === 'function' ) {
1819 return await Promise . resolve ( mod ( args ) ) ; // run the CLI
1920 } else if ( typeof mod . default === 'function' ) {
@@ -23,6 +24,7 @@ export async function loadCliFromFixture(fixtureDir) {
2324 }
2425 } finally {
2526 process . chdir ( originalCwd ) ; // Always restore original directory
27+ console . log ( '[Global Setup] Restored original directory:' , originalCwd ) ;
2628 }
2729 } ;
2830
Original file line number Diff line number Diff line change @@ -15,15 +15,12 @@ const fixtures = [
1515for ( const dir of fixtures ) {
1616 const pkgJson = join ( dir , "package.json" ) ;
1717
18- // 1: Install base deps
19- execSync ( `pnpm --dir ${ dir } install --silent` , { stdio : "inherit" } ) ;
20-
21- // 2: Inject the packed tarball
18+ // 1: Inject the packed tarball
2219 execSync ( `pnpm --dir ${ dir } add ${ join ( dist , pkg ) } ` , { stdio : "inherit" } ) ;
2320
24- // 3: Re-install to resolve tree
25- execSync ( `pnpm --dir ${ dir } install --silent ` , { stdio : "inherit" } ) ;
21+ // 2: Install to resolve tree
22+ execSync ( `pnpm --dir ${ dir } install` , { stdio : "inherit" } ) ;
2623
27- // ✅ 4 : Undo changes to package.json
24+ // 3 : Undo changes to package.json
2825 execSync ( `git restore ${ pkgJson } ` , { stdio : "inherit" } ) ;
2926}
You can’t perform that action at this time.
0 commit comments