From 6994d59b99fd17ddc0b4abb5cf8d3c09efde4d74 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 10 Dec 2018 06:55:18 +0100 Subject: [PATCH] Make assertions windows compatible --- test/index.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/index.js b/test/index.js index e30bcc3..a6150a7 100644 --- a/test/index.js +++ b/test/index.js @@ -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', @@ -191,9 +190,18 @@ test(t => rollup({ .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); + console.log(moduleIds); + [ + '/files/aliasMe.js', + '/files/folder/anotherNumber.js', + '/files/index.js', + '/files/localAliasMe.js', + '/files/nonAliased.js', + ].forEach( + (expectedId, index) => t.is( + moduleIds[index].endsWith(expectedId), + true, + `expected ${moduleIds[index]} to end with ${expectedId}`, + ), + ); }));