2016-10-10 03:43:44 +02:00
|
|
|
var path = require('path');
|
|
|
|
var test = require('tape');
|
|
|
|
var resolve = require('../');
|
|
|
|
|
|
|
|
test('precedence', function (t) {
|
|
|
|
t.plan(3);
|
|
|
|
var dir = path.join(__dirname, 'precedence/aaa');
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
resolve('./', { basedir: dir }, function (err, res, pkg) {
|
2016-10-10 03:43:44 +02:00
|
|
|
t.ifError(err);
|
|
|
|
t.equal(res, path.join(dir, 'index.js'));
|
|
|
|
t.equal(pkg.name, 'resolve');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-28 00:38:50 +02:00
|
|
|
test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string
|
2016-10-10 03:43:44 +02:00
|
|
|
t.plan(1);
|
|
|
|
var dir = path.join(__dirname, 'precedence/bbb');
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
resolve('./', { basedir: dir }, function (err, res, pkg) {
|
2016-10-10 03:43:44 +02:00
|
|
|
t.ok(err);
|
|
|
|
});
|
|
|
|
});
|