@@ -8,10 +8,10 @@ export default testSuite(({ describe }, nodePath: string) => {
8
8
describe ( 'bin' , ( { test } ) => {
9
9
test ( 'supports single path' , async ( ) => {
10
10
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!");' ,
12
13
'package.json' : createPackageJson ( {
13
- bin : './dist/index.mjs' ,
14
- exports : './dist/index.mjs' ,
14
+ bin : './dist/subpath/bin.mjs' ,
15
15
} ) ,
16
16
} ) ;
17
17
@@ -24,12 +24,12 @@ export default testSuite(({ describe }, nodePath: string) => {
24
24
expect ( pkgrollProcess . stderr ) . toBe ( '' ) ;
25
25
26
26
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' ) ;
28
28
expect ( content ) . toMatch ( '#!/usr/bin/env node' ) ;
29
29
30
30
// File modes don't exist on Windows
31
31
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' ) ) ;
33
33
const unixFilePermissions = `0${ ( stats . mode & 0o777 ) . toString ( 8 ) } ` ; // eslint-disable-line no-bitwise
34
34
35
35
expect ( unixFilePermissions ) . toBe ( '0755' ) ;
0 commit comments