@@ -8,10 +8,10 @@ export default testSuite(({ describe }, nodePath: string) => {
88 describe ( 'bin' , ( { test } ) => {
99 test ( 'supports single path' , async ( ) => {
1010 await using fixture = await createFixture ( {
11- ...packageFixture ( ) ,
11+ // Using a subpath tests that the paths are joined correctly on Windows
12+ 'src/subpath/bin.ts' : 'console.log("Hello, world!");' ,
1213 'package.json' : createPackageJson ( {
13- bin : './dist/index.mjs' ,
14- exports : './dist/index.mjs' ,
14+ bin : './dist/subpath/bin.mjs' ,
1515 } ) ,
1616 } ) ;
1717
@@ -24,12 +24,12 @@ export default testSuite(({ describe }, nodePath: string) => {
2424 expect ( pkgrollProcess . stderr ) . toBe ( '' ) ;
2525
2626 await test ( 'is executable' , async ( ) => {
27- const content = await fixture . readFile ( 'dist/index .mjs' , 'utf8' ) ;
27+ const content = await fixture . readFile ( 'dist/subpath/bin .mjs' , 'utf8' ) ;
2828 expect ( content ) . toMatch ( '#!/usr/bin/env node' ) ;
2929
3030 // File modes don't exist on Windows
3131 if ( process . platform !== 'win32' ) {
32- const stats = await fs . stat ( ` ${ fixture . path } / dist/index .mjs` ) ;
32+ const stats = await fs . stat ( fixture . getPath ( ' dist/subpath/bin .mjs' ) ) ;
3333 const unixFilePermissions = `0${ ( stats . mode & 0o777 ) . toString ( 8 ) } ` ; // eslint-disable-line no-bitwise
3434
3535 expect ( unixFilePermissions ) . toBe ( '0755' ) ;
0 commit comments