shadowed_core.js
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var test = require('tape');
var resolve = require('../');
var path = require('path');
test('shadowed core modules still return core module', function (t) {
t.plan(2);
resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) {
t.ifError(err);
t.equal(res, 'util');
});
});
test('shadowed core modules still return core module [sync]', function (t) {
t.plan(1);
var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') });
t.equal(res, 'util');
});
test('shadowed core modules return shadow when appending `/`', function (t) {
t.plan(2);
resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) {
t.ifError(err);
t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
});
});
test('shadowed core modules return shadow when appending `/` [sync]', function (t) {
t.plan(1);
var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') });
t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
});