Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit 38ad09a

Browse files
committed
Make assertions windows compatible
1 parent b37a7f3 commit 38ad09a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

test/index.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ const getModuleIdsFromBundle = (bundle) => {
178178
.reduce((moduleIds, chunk) => moduleIds.concat(Object.keys(chunk.modules)), []));
179179
};
180180

181-
// Tests in Rollup
182-
test(t => rollup({
181+
test('Works in rollup', t => rollup({
183182
input: './test/files/index.js',
184183
plugins: [alias({
185184
fancyNumber: './aliasMe',
@@ -189,11 +188,19 @@ test(t => rollup({
189188
})],
190189
}).then(getModuleIdsFromBundle)
191190
.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+
);
199206
}));

0 commit comments

Comments
 (0)