Skip to content

Commit 1f86ce1

Browse files
committed
[Tests] improve symlink tests
1 parent 3ed370f commit 1f86ce1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/symlinks.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ try {
1010
try {
1111
fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir');
1212
} catch (err) {
13-
// if fails then it is probably on Windows and lets try to create a junction
14-
fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction');
13+
if (err.code !== 'EEXIST') {
14+
// if fails then it is probably on Windows and lets try to create a junction
15+
fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction');
16+
}
1517
}
1618

1719
test('symlink', function (t) {
18-
t.plan(1);
20+
t.plan(2);
1921

2022
resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) {
21-
if (err) t.fail(err);
23+
t.error(err);
2224
t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js'));
2325
});
2426
});

0 commit comments

Comments
 (0)