@@ -178,8 +178,7 @@ const getModuleIdsFromBundle = (bundle) => {
178
178
. reduce ( ( moduleIds , chunk ) => moduleIds . concat ( Object . keys ( chunk . modules ) ) , [ ] ) ) ;
179
179
} ;
180
180
181
- // Tests in Rollup
182
- test ( t => rollup ( {
181
+ test ( 'Works in rollup' , t => rollup ( {
183
182
input : './test/files/index.js' ,
184
183
plugins : [ alias ( {
185
184
fancyNumber : './aliasMe' ,
@@ -189,11 +188,20 @@ test(t => rollup({
189
188
} ) ] ,
190
189
} ) . then ( getModuleIdsFromBundle )
191
190
. then ( ( moduleIds ) => {
192
- moduleIds . sort ( ) ;
193
- t . is ( moduleIds . length , 5 ) ;
194
- t . is ( moduleIds [ 0 ] . endsWith ( path . normalize ( '/files/aliasMe.js' ) ) , true ) ;
195
- t . is ( moduleIds [ 1 ] . endsWith ( path . normalize ( '/files/folder/anotherNumber.js' ) ) , true ) ;
196
- t . is ( moduleIds [ 2 ] . endsWith ( path . normalize ( '/files/index.js' ) ) , true ) ;
197
- t . is ( moduleIds [ 3 ] . endsWith ( path . normalize ( '/files/localAliasMe.js' ) ) , true ) ;
198
- t . is ( moduleIds [ 4 ] . endsWith ( path . normalize ( '/files/nonAliased.js' ) ) , true ) ;
191
+ const normalizedIds = moduleIds . map ( id => path . resolve ( id ) ) . sort ( ) ;
192
+ t . is ( normalizedIds . length , 5 ) ;
193
+ console . log ( normalizedIds ) ;
194
+ [
195
+ '/files/aliasMe.js' ,
196
+ '/files/folder/anotherNumber.js' ,
197
+ '/files/index.js' ,
198
+ '/files/localAliasMe.js' ,
199
+ '/files/nonAliased.js' ,
200
+ ] . forEach (
201
+ ( expectedId , index ) => t . is (
202
+ normalizedIds [ index ] . endsWith ( path . normalize ( expectedId ) ) ,
203
+ true ,
204
+ `expected ${ normalizedIds [ index ] } to end with ${ path . normalize ( expectedId ) } ` ,
205
+ ) ,
206
+ ) ;
199
207
} ) ) ;
0 commit comments