@@ -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,19 @@ 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
+ [
194
+ '/files/aliasMe.js' ,
195
+ '/files/folder/anotherNumber.js' ,
196
+ '/files/index.js' ,
197
+ '/files/localAliasMe.js' ,
198
+ '/files/nonAliased.js' ,
199
+ ] . map ( id => path . normalize ( id ) ) . forEach (
200
+ ( expectedId , index ) => t . is (
201
+ normalizedIds [ index ] . endsWith ( expectedId ) ,
202
+ true ,
203
+ `expected ${ normalizedIds [ index ] } to end with ${ expectedId } ` ,
204
+ ) ,
205
+ ) ;
199
206
} ) ) ;
0 commit comments