mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 14:41:29 +00:00

PR-URL: https://github.com/nodejs/node/pull/35474 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
30 lines
807 B
JavaScript
30 lines
807 B
JavaScript
var test = require('tape');
|
|
var path = require('path');
|
|
var resolve = require('../');
|
|
|
|
test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
|
|
t.plan(1);
|
|
|
|
var resolverDir = 'C:\\a\\b\\c\\d';
|
|
|
|
resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
|
|
t.equal(!!err, true);
|
|
});
|
|
});
|
|
|
|
test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
|
|
t.plan(2);
|
|
|
|
var opts = {
|
|
basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
|
|
preserveSymlinks: false
|
|
};
|
|
|
|
var module = './dotdot/abc';
|
|
|
|
resolve(module, opts, function (err, res) {
|
|
t.equal(err.code, 'MODULE_NOT_FOUND');
|
|
t.equal(res, undefined);
|
|
});
|
|
});
|