File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change 22import t from 'tap'
33
44import { globSync } from '../dist/esm/index.js'
5-
6- if ( process . platform !== 'win32' ) {
7- t . pass ( 'no need to test this except on windows' )
8- process . exit ( 0 )
9- }
5+ import { statSync } from 'node:fs'
106
117const dir = t . testdir ( {
128 'program files' : {
@@ -16,6 +12,25 @@ const dir = t.testdir({
1612 } ,
1713} )
1814
15+ // gut check that we're on a system that does tilde expansion
16+ // this can be disabled on some Windows systems for security,
17+ // which of course breaks this test.
18+ try {
19+ const programFiles = statSync ( `${ dir } /program files` )
20+ const prograTilde = statSync ( `${ dir } /progra~1` )
21+ if (
22+ ! programFiles . isDirectory ( ) ||
23+ ! prograTilde . isDirectory ( ) ||
24+ programFiles . dev !== prograTilde . dev ||
25+ programFiles . ino !== prograTilde . ino
26+ ) {
27+ throw 'nope'
28+ }
29+ } catch {
30+ t . pass ( 'n/a' , { skip : 'this system does not do tilde expansion' } )
31+ process . exit ( 0 )
32+ }
33+
1934t . strictSame (
2035 globSync ( 'progra~1\\*' , { cwd : dir , windowsPathsNoEscape : true } ) . sort (
2136 ( a , b ) => a . localeCompare ( b , 'en' ) ,
You can’t perform that action at this time.
0 commit comments