File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
tests/rspack-test/configCases/rslib/hashbang-and-chmod Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,16 @@ testCases.forEach(({ name, file }) => {
1515 expect ( content . startsWith ( '#!/usr/bin/env node\n' ) ) . toBe ( true ) ;
1616 } ) ;
1717
18- it ( `should set executable permissions (0o755) for files with hashbang (${ name } )` , ( ) => {
19- const filePath = path . resolve ( __dirname , file ) ;
20- const stats = fs . statSync ( filePath ) ;
21- const permissions = stats . mode & 0o777 ;
18+ // File permissions (chmod) are only supported on Unix-like systems (Linux, macOS, BSD, etc.).
19+ // Skip on Windows and WASM environments where Unix permissions are not supported.
20+ const onUnix = process . platform !== 'win32' && ! process . env . WASM ;
21+ if ( onUnix ) {
22+ it ( `should set executable permissions (0o755) for files with hashbang (${ name } )` , ( ) => {
23+ const filePath = path . resolve ( __dirname , file ) ;
24+ const stats = fs . statSync ( filePath ) ;
25+ const permissions = stats . mode & 0o777 ;
2226
23- expect ( permissions ) . toBe ( 0o755 ) ;
24- } ) ;
27+ expect ( permissions ) . toBe ( 0o755 ) ;
28+ } ) ;
29+ }
2530} ) ;
You can’t perform that action at this time.
0 commit comments