@@ -3,24 +3,36 @@ import glob from 'glob';
33import path from 'path' ;
44import fs from 'fs-extra' ;
55
6- const bin = './ dist/ cli.js';
6+ const bin = path . join ( __dirname , '..' , ' dist' , ' cli.js') ;
77const cache = path . join ( __dirname , '.cache' ) ;
88
99const run = ( recipe : string ) => {
1010 // Setup the test files
11- const originalInput = `./ recipes/ ${ recipe } / input` ;
11+ const originalInput = path . join ( __dirname , '..' , ' recipes' , recipe , ' input' ) ;
1212 const inputDest = path . resolve ( cache , recipe ) ;
1313 fs . copySync ( originalInput , inputDest ) ;
1414
1515 // Run the command
16- const transform = `./recipes/${ recipe } /transform.ts` ;
17- const inputGlob = `${ inputDest } /**/*.css` ;
16+ const transform = path . join (
17+ __dirname ,
18+ '..' ,
19+ 'recipes' ,
20+ recipe ,
21+ 'transform.ts'
22+ ) ;
23+ const inputGlob = path . join ( inputDest , '**' , '*.css' ) ;
1824 const command = `${ bin } -t ${ transform } '${ inputGlob } '` ;
1925 execSync ( command ) ;
2026
2127 // Compare results
22- const expectedOutput = `./recipes/${ recipe } /output` ;
23- const expectedOutputGlob = `${ expectedOutput } /**/*.css` ;
28+ const expectedOutput = path . join (
29+ __dirname ,
30+ '..' ,
31+ 'recipes' ,
32+ recipe ,
33+ 'output'
34+ ) ;
35+ const expectedOutputGlob = path . join ( expectedOutput , '**' , '*.css' ) ;
2436 const expectedFiles = glob . sync ( expectedOutputGlob ) ;
2537
2638 expectedFiles . forEach ( expectedFile => {
@@ -32,7 +44,7 @@ const run = (recipe: string) => {
3244 } ) ;
3345} ;
3446
35- const recipes = fs . readdirSync ( path . resolve ( __dirname , '../ recipes' ) ) ;
47+ const recipes = fs . readdirSync ( path . resolve ( __dirname , '..' , ' recipes') ) ;
3648
3749describe ( 'cli' , ( ) => {
3850 beforeAll ( ( ) => {
0 commit comments