1 var path = require('path');
2 var test = require('tape');
3 var resolve = require('../');
5 test('$NODE_PATH', function (t) {
10 path.join(__dirname, '/node_path/x'),
11 path.join(__dirname, '/node_path/y')
14 }, function (err, res) {
15 t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'));
20 path.join(__dirname, '/node_path/x'),
21 path.join(__dirname, '/node_path/y')
24 }, function (err, res) {
25 t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'));
30 path.join(__dirname, '/node_path/x'),
31 path.join(__dirname, '/node_path/y')
34 }, function (err, res) {
35 t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'));
38 // ensure that relative paths still resolve against the
39 // regular `node_modules` correctly
44 basedir: 'node_path/x'
45 }, function (err, res) {
46 var root = require('tap/package.json').main;
47 t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root));