source: imaps-frontend/node_modules/resolve/test/shadowed_core.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.8 KB
Line 
1var test = require('tape');
2var resolve = require('../');
3var path = require('path');
4
5test('shadowed core modules still return core module', function (t) {
6 t.plan(2);
7
8 resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) {
9 t.ifError(err);
10 t.equal(res, 'util');
11 });
12});
13
14test('shadowed core modules still return core module [sync]', function (t) {
15 t.plan(1);
16
17 var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') });
18
19 t.equal(res, 'util');
20});
21
22test('shadowed core modules return shadow when appending `/`', function (t) {
23 t.plan(2);
24
25 resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) {
26 t.ifError(err);
27 t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
28 });
29});
30
31test('shadowed core modules return shadow when appending `/` [sync]', function (t) {
32 t.plan(1);
33
34 var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') });
35
36 t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
37});
38
39test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) {
40 t.plan(2);
41
42 resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) {
43 t.ifError(err);
44 t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
45 });
46});
47
48test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) {
49 t.plan(1);
50
51 var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false });
52
53 t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
54});
Note: See TracBrowser for help on using the repository browser.