@@ -16,12 +16,14 @@ const __dirname = path.dirname(__filename);
1616process . chdir ( path . resolve ( __dirname ) ) ;
1717
1818test ( "simplest case" , async ( ) => {
19- fs . rmSync ( ".output" , { recursive : true , force : true } ) ;
19+ const outputDir = path . join ( __dirname , ".output" ) ;
20+ fs . rmSync ( outputDir , { recursive : true , force : true } ) ;
21+ fs . mkdirSync ( outputDir , { recursive : true } ) ;
2022
2123 await esbuild . build ( {
22- entryPoints : [ "basic/index.js" ] ,
24+ entryPoints : [ path . join ( __dirname , "basic/index.js" ) ] ,
2325 bundle : true ,
24- outfile : ".output/ bundle.js",
26+ outfile : path . join ( outputDir , " bundle.js") ,
2527 plugins : [
2628 postCssPlugin ( {
2729 plugins : [ autoPrefixerPlugin ] ,
@@ -30,10 +32,12 @@ test("simplest case", async () => {
3032 } ) ;
3133 esbuild . stop ( ) ;
3234
33- assert . ok ( fs . existsSync ( "./.output/ bundle.js") ) ;
34- assert . ok ( fs . existsSync ( "./.output/ bundle.css") ) ;
35+ assert . ok ( fs . existsSync ( path . join ( outputDir , " bundle.js") ) ) ;
36+ assert . ok ( fs . existsSync ( path . join ( outputDir , " bundle.css") ) ) ;
3537
36- const fileContent = fs . readFileSync ( "./.output/bundle.css" ) . toString ( ) ;
38+ const fileContent = fs
39+ . readFileSync ( path . join ( outputDir , "bundle.css" ) )
40+ . toString ( ) ;
3741
3842 assert . ok ( fileContent . includes ( "-webkit-border-radius" ) ) ;
3943 assert . ok ( fileContent . includes ( "display: flex" ) ) ;
0 commit comments