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