@@ -66,12 +66,35 @@ pkgs:
6666
6767 // Mock artisan that writes a marker file
6868 const artisan = path . join ( binDir , 'artisan' )
69- fs . writeFileSync ( artisan , `#!/bin/sh\necho \"artisan called with args: $@\" > \"${ path . join ( projectDir , 'artisan-debug.log' ) } \"\nif [ \"$1\" = \"migrate:fresh\" ]; then echo migrated > \"${ path . join ( projectDir , 'migrated.marker' ) } \"; fi; exit 0\n` )
69+ fs . writeFileSync ( artisan , `#!/bin/sh
70+ echo "artisan called with args: $@" > "${ path . join ( projectDir , 'artisan-debug.log' ) } "
71+ echo "First arg: '$1'" >> "${ path . join ( projectDir , 'artisan-debug.log' ) } "
72+ echo "Checking condition: [ '$1' = 'migrate:fresh' ]" >> "${ path . join ( projectDir , 'artisan-debug.log' ) } "
73+ if [ "$1" = "migrate:fresh" ]; then
74+ echo "Condition matched! Creating marker file..." >> "${ path . join ( projectDir , 'artisan-debug.log' ) } "
75+ echo migrated > "${ path . join ( projectDir , 'migrated.marker' ) } "
76+ echo "Marker file created: $?" >> "${ path . join ( projectDir , 'artisan-debug.log' ) } "
77+ else
78+ echo "Condition NOT matched" >> "${ path . join ( projectDir , 'artisan-debug.log' ) } "
79+ fi
80+ exit 0
81+ ` )
7082 fs . chmodSync ( artisan , 0o755 )
7183
72- // Compute envDir exactly like dump.ts
73- const envHash = generateProjectHashForTest ( projectDir )
74- envDir = path . join ( os . homedir ( ) , '.local' , 'share' , 'launchpad' , 'envs' , envHash )
84+ // Compute envDir exactly like dump.ts (including dependency suffix)
85+ const envHash = generateProjectHashForTest ( projectDir )
86+ // Compute dependency fingerprint to match dump.ts logic
87+ let depSuffix = ''
88+ try {
89+ const depsFilePath = path . join ( projectDir , 'deps.yaml' )
90+ if ( fs . existsSync ( depsFilePath ) ) {
91+ const depContent = fs . readFileSync ( depsFilePath )
92+ const depHash = crypto . createHash ( 'md5' ) . update ( depContent ) . digest ( 'hex' ) . slice ( 0 , 8 )
93+ depSuffix = `-d${ depHash } `
94+ }
95+ }
96+ catch { }
97+ envDir = path . join ( os . homedir ( ) , '.local' , 'share' , 'launchpad' , 'envs' , `${ envHash } ${ depSuffix } ` )
7598 fs . mkdirSync ( envDir , { recursive : true } )
7699 fs . writeFileSync ( path . join ( envDir , '.launchpad_ready' ) , '1' )
77100 // Create expected bin/sbin to satisfy composed PATH
95118 catch { }
96119 } )
97120
98- it . skip ( 'runs post-setup after services and completes without connection errors' , async ( ) => {
99- await dump ( projectDir , { shellOutput : true , quiet : true } )
121+ it ( 'runs post-setup after services and completes without connection errors' , async ( ) => {
122+ await dump ( projectDir , { shellOutput : false , quiet : true } )
100123
101124 // Check if artisan was called at all
102125 const debugLogPath = path . join ( projectDir , 'artisan-debug.log' )
@@ -107,9 +130,25 @@ pkgs:
107130
108131 // Expect our mock artisan to have executed
109132 const markerPath = path . join ( projectDir , 'migrated.marker' )
133+ console . log ( 'Expected marker path:' , markerPath )
134+ console . log ( 'Marker exists:' , fs . existsSync ( markerPath ) )
135+ console . log ( 'Project dir contents:' , fs . readdirSync ( projectDir ) )
136+ if ( fs . existsSync ( markerPath ) ) {
137+ console . log ( 'Marker content:' , fs . readFileSync ( markerPath , 'utf8' ) )
138+ }
110139 expect ( fs . existsSync ( markerPath ) ) . toBe ( true )
111140 // And the idempotent marker to be created
112141 const postMarker = path . join ( envDir , 'pkgs' , '.post_setup_done' )
142+ console . log ( 'Expected post marker path:' , postMarker )
143+ console . log ( 'EnvDir exists:' , fs . existsSync ( envDir ) )
144+ console . log ( 'EnvDir/pkgs exists:' , fs . existsSync ( path . join ( envDir , 'pkgs' ) ) )
145+ if ( fs . existsSync ( envDir ) ) {
146+ console . log ( 'EnvDir contents:' , fs . readdirSync ( envDir ) )
147+ if ( fs . existsSync ( path . join ( envDir , 'pkgs' ) ) ) {
148+ console . log ( 'EnvDir/pkgs contents:' , fs . readdirSync ( path . join ( envDir , 'pkgs' ) ) )
149+ }
150+ }
151+ console . log ( 'Post marker exists:' , fs . existsSync ( postMarker ) )
113152 expect ( fs . existsSync ( postMarker ) ) . toBe ( true )
114153 } )
115154} )
0 commit comments