File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
packages/cli/src/__tests__ Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,16 @@ import fs from 'fs-extra';
33import path from 'path' ;
44import { getId } from '@walkeros/core' ;
55
6+ // Resolve paths relative to the cli package root (two levels up from __tests__)
7+ // so the test works regardless of Jest's cwd.
8+ const pkgRoot = path . resolve ( __dirname , '..' , '..' ) ;
9+
610describe ( 'CLI Bundle Command' , ( ) => {
7- const testOutputDir = path . join ( '.tmp' , `cli-${ Date . now ( ) } -${ getId ( ) } ` ) ;
11+ const testOutputDir = path . join (
12+ pkgRoot ,
13+ '.tmp' ,
14+ `cli-${ Date . now ( ) } -${ getId ( ) } ` ,
15+ ) ;
816 const testConfigPath = path . join ( testOutputDir , 'test.config.json' ) ;
917
1018 beforeEach ( async ( ) => {
@@ -24,10 +32,15 @@ describe('CLI Bundle Command', () => {
2432 args : string [ ] ,
2533 ) : Promise < { stdout : string ; stderr : string ; exitCode : number } > => {
2634 return new Promise ( ( resolve ) => {
27- const child = spawn ( 'node' , [ 'dist/index.js' , ...args ] , {
28- stdio : 'pipe' ,
29- shell : false ,
30- } ) ;
35+ const child = spawn (
36+ 'node' ,
37+ [ path . join ( pkgRoot , 'dist/index.js' ) , ...args ] ,
38+ {
39+ stdio : 'pipe' ,
40+ shell : false ,
41+ cwd : pkgRoot ,
42+ } ,
43+ ) ;
3144
3245 let stdout = '' ;
3346 let stderr = '' ;
You can’t perform that action at this time.
0 commit comments