Skip to content

Commit 36f15fb

Browse files
committed
[Test] add test case from #183
1 parent e132d55 commit 36f15fb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/faulty_basedir.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var test = require('tape');
2+
var path = require('path');
23
var resolve = require('../');
34

45
test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
@@ -7,7 +8,22 @@ test('faulty basedir must produce error in windows', { skip: process.platform !=
78
var resolverDir = 'C:\\a\\b\\c\\d';
89

910
resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
10-
t.equal(true, !!err);
11+
t.equal(!!err, true);
1112
});
13+
});
14+
15+
test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
16+
t.plan(2);
17+
18+
var opts = {
19+
basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
20+
preserveSymlinks: false
21+
};
1222

23+
var module = './dotdot/abc';
24+
25+
resolve(module, opts, function (err, res) {
26+
t.equal(err.code, 'INVALID_BASEDIR');
27+
t.equal(res, undefined);
28+
});
1329
});

0 commit comments

Comments
 (0)