Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make assertions windows compatible
  • Loading branch information
lukastaegert committed Dec 10, 2018
commit 38ad09af380870e00f40954db68f46f0c4d96751
25 changes: 16 additions & 9 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ const getModuleIdsFromBundle = (bundle) => {
.reduce((moduleIds, chunk) => moduleIds.concat(Object.keys(chunk.modules)), []));
};

// Tests in Rollup
test(t => rollup({
test('Works in rollup', t => rollup({
input: './test/files/index.js',
plugins: [alias({
fancyNumber: './aliasMe',
Expand All @@ -189,11 +188,19 @@ test(t => rollup({
})],
}).then(getModuleIdsFromBundle)
.then((moduleIds) => {
moduleIds.sort();
t.is(moduleIds.length, 5);
t.is(moduleIds[0].endsWith(path.normalize('/files/aliasMe.js')), true);
t.is(moduleIds[1].endsWith(path.normalize('/files/folder/anotherNumber.js')), true);
t.is(moduleIds[2].endsWith(path.normalize('/files/index.js')), true);
t.is(moduleIds[3].endsWith(path.normalize('/files/localAliasMe.js')), true);
t.is(moduleIds[4].endsWith(path.normalize('/files/nonAliased.js')), true);
const normalizedIds = moduleIds.map(id => path.resolve(id)).sort();
t.is(normalizedIds.length, 5);
[
'/files/aliasMe.js',
'/files/folder/anotherNumber.js',
'/files/index.js',
'/files/localAliasMe.js',
'/files/nonAliased.js',
].map(id => path.normalize(id)).forEach(
(expectedId, index) => t.is(
normalizedIds[index].endsWith(expectedId),
true,
`expected ${normalizedIds[index]} to end with ${expectedId}`,
),
);
}));