Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80665 views
1
var test = require('tap').test;
2
var resolve = require('../');
3
4
test('$NODE_PATH', function (t) {
5
t.plan(3);
6
7
resolve('aaa', {
8
paths: [
9
__dirname + '/node_path/x',
10
__dirname + '/node_path/y'
11
],
12
basedir: __dirname,
13
}, function (err, res) {
14
t.equal(res, __dirname + '/node_path/x/aaa/index.js');
15
});
16
17
resolve('bbb', {
18
paths: [
19
__dirname + '/node_path/x',
20
__dirname + '/node_path/y'
21
],
22
basedir: __dirname,
23
}, function (err, res) {
24
t.equal(res, __dirname + '/node_path/y/bbb/index.js');
25
});
26
27
resolve('ccc', {
28
paths: [
29
__dirname + '/node_path/x',
30
__dirname + '/node_path/y'
31
],
32
basedir: __dirname,
33
}, function (err, res) {
34
t.equal(res, __dirname + '/node_path/x/ccc/index.js');
35
});
36
});
37
38