@@ -99,6 +99,10 @@ test('async symlink from node_modules to other dir when preserveSymlinks = false
99
99
} ) ;
100
100
101
101
test ( 'packageFilter' , function ( t ) {
102
+ function relative ( x ) {
103
+ return path . relative ( __dirname , x ) ;
104
+ }
105
+
102
106
function testPackageFilter ( preserveSymlinks ) {
103
107
return function ( st ) {
104
108
st . plan ( 5 ) ;
@@ -118,13 +122,13 @@ test('packageFilter', function (t) {
118
122
}
119
123
} ) ;
120
124
st . equal (
121
- actualPath . replace ( __dirname + '/' , '' ) ,
122
- preserveSymlinks ? destMain : sourceMain ,
125
+ relative ( actualPath ) ,
126
+ path . normalize ( preserveSymlinks ? destMain : sourceMain ) ,
123
127
'sync: actual path is correct'
124
128
) ;
125
129
st . deepEqual (
126
- map ( packageFilterPath , function ( x ) { return x . replace ( __dirname + '/' , '' ) ; } ) ,
127
- preserveSymlinks ? [ destPkg , destPkg ] : [ sourcePkg , sourcePkg ] ,
130
+ map ( packageFilterPath , relative ) ,
131
+ map ( preserveSymlinks ? [ destPkg , destPkg ] : [ sourcePkg , sourcePkg ] , path . normalize ) ,
128
132
'sync: packageFilter pkgfile arg is correct'
129
133
) ;
130
134
@@ -141,13 +145,13 @@ test('packageFilter', function (t) {
141
145
function ( err , actualPath ) {
142
146
st . error ( err , 'no error' ) ;
143
147
st . equal (
144
- actualPath . replace ( __dirname + '/' , '' ) ,
145
- preserveSymlinks ? destMain : sourceMain ,
148
+ relative ( actualPath ) ,
149
+ path . normalize ( preserveSymlinks ? destMain : sourceMain ) ,
146
150
'async: actual path is correct'
147
151
) ;
148
152
st . deepEqual (
149
- map ( asyncPackageFilterPath , function ( x ) { return x . replace ( __dirname + '/' , '' ) ; } ) ,
150
- preserveSymlinks ? [ destPkg , destPkg , destPkg ] : [ sourcePkg , sourcePkg , sourcePkg ] ,
153
+ map ( packageFilterPath , relative ) ,
154
+ map ( preserveSymlinks ? [ destPkg , destPkg ] : [ sourcePkg , sourcePkg ] , path . normalize ) ,
151
155
'async: packageFilter pkgfile arg is correct'
152
156
) ;
153
157
}
0 commit comments