@@ -2,6 +2,9 @@ import t from 'tap'
22import glob from '../'
33
44import { resolve } from 'path'
5+ import { sep } from 'path'
6+ const alphasort = ( a :string , b :string ) => a . localeCompare ( b , 'en' )
7+ const j = ( a : string [ ] ) => a . map ( s => s . split ( '/' ) . join ( sep ) ) . sort ( alphasort )
58
69const fixtureDir = resolve ( __dirname , 'fixtures' )
710
@@ -12,18 +15,14 @@ if (process.platform !== 'win32') {
1215 expect . push ( 'a/symlink/a' , 'a/symlink/a/b/c/a' )
1316}
1417
15- const alphasort = ( a : string , b : string ) => a . localeCompare ( b , 'en' )
16-
17- expect . sort ( alphasort )
18-
1918t . test ( 'chdir' , async t => {
2019 const origCwd = process . cwd ( )
2120 process . chdir ( fixtureDir )
2221 t . teardown ( ( ) => process . chdir ( origCwd ) )
23- t . same ( glob . sync ( pattern , { matchBase : true } ) . sort ( alphasort ) , expect )
22+ t . same ( glob . sync ( pattern , { matchBase : true } ) . sort ( alphasort ) , j ( expect ) )
2423 t . same (
2524 ( await glob ( pattern , { matchBase : true } ) ) . sort ( alphasort ) ,
26- expect
25+ j ( expect )
2726 )
2827} )
2928
@@ -32,13 +31,13 @@ t.test('cwd', async t => {
3231 glob
3332 . sync ( pattern , { matchBase : true , cwd : fixtureDir } )
3433 . sort ( alphasort ) ,
35- expect
34+ j ( expect )
3635 )
3736 t . same (
3837 ( await glob ( pattern , { matchBase : true , cwd : fixtureDir } ) ) . sort (
3938 alphasort
4039 ) ,
41- expect
40+ j ( expect )
4241 )
4342} )
4443
@@ -55,13 +54,13 @@ t.test('pattern includes /', async t => {
5554 glob
5655 . sync ( pattern , { matchBase : true , cwd : fixtureDir } )
5756 . sort ( alphasort ) ,
58- expect
57+ j ( expect )
5958 )
6059 t . same (
6160 ( await glob ( pattern , { matchBase : true , cwd : fixtureDir } ) ) . sort (
6261 alphasort
6362 ) ,
64- expect
63+ j ( expect )
6564 )
6665} )
6766
@@ -72,13 +71,13 @@ t.test('one brace section of pattern includes /', async t => {
7271 glob
7372 . sync ( pattern , { matchBase : true , cwd : fixtureDir } )
7473 . sort ( alphasort ) ,
75- exp
74+ j ( exp )
7675 )
7776 t . same (
7877 ( await glob ( pattern , { matchBase : true , cwd : fixtureDir } ) ) . sort (
7978 alphasort
8079 ) ,
81- exp
80+ j ( exp )
8281 )
8382} )
8483
@@ -89,12 +88,12 @@ t.test('one array member of pattern includes /', async t => {
8988 glob
9089 . sync ( pattern , { matchBase : true , cwd : fixtureDir } )
9190 . sort ( alphasort ) ,
92- exp
91+ j ( exp )
9392 )
9493 t . same (
9594 ( await glob ( pattern , { matchBase : true , cwd : fixtureDir } ) ) . sort (
9695 alphasort
9796 ) ,
98- exp
97+ j ( exp )
9998 )
10099} )
0 commit comments