Skip to content

Commit

Permalink
[Tests] fix symlink tests for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 25, 2019
1 parent d930f86 commit 1aedb83
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/symlinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ test('async symlink from node_modules to other dir when preserveSymlinks = false
});

test('packageFilter', function (t) {
function relative(x) {
return path.relative(__dirname, x);
}

function testPackageFilter(preserveSymlinks) {
return function (st) {
st.plan(5);
Expand All @@ -118,13 +122,13 @@ test('packageFilter', function (t) {
}
});
st.equal(
actualPath.replace(__dirname + '/', ''),
preserveSymlinks ? destMain : sourceMain,
relative(actualPath),
path.normalize(preserveSymlinks ? destMain : sourceMain),
'sync: actual path is correct'
);
st.deepEqual(
map(packageFilterPath, function (x) { return x.replace(__dirname + '/', ''); }),
preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg],
map(packageFilterPath, relative),
map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize),
'sync: packageFilter pkgfile arg is correct'
);

Expand All @@ -141,13 +145,13 @@ test('packageFilter', function (t) {
function (err, actualPath) {
st.error(err, 'no error');
st.equal(
actualPath.replace(__dirname + '/', ''),
preserveSymlinks ? destMain : sourceMain,
relative(actualPath),
path.normalize(preserveSymlinks ? destMain : sourceMain),
'async: actual path is correct'
);
st.deepEqual(
map(asyncPackageFilterPath, function (x) { return x.replace(__dirname + '/', ''); }),
preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg],
map(packageFilterPath, relative),
map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize),
'async: packageFilter pkgfile arg is correct'
);
}
Expand Down

0 comments on commit 1aedb83

Please sign in to comment.