precedence.js 646 B

1234567891011121314151617181920212223
  1. var path = require('path');
  2. var test = require('tape');
  3. var resolve = require('../');
  4. test('precedence', function (t) {
  5. t.plan(3);
  6. var dir = path.join(__dirname, 'precedence/aaa');
  7. resolve('./', { basedir: dir }, function (err, res, pkg) {
  8. t.ifError(err);
  9. t.equal(res, path.join(dir, 'index.js'));
  10. t.equal(pkg.name, 'resolve');
  11. });
  12. });
  13. test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string
  14. t.plan(1);
  15. var dir = path.join(__dirname, 'precedence/bbb');
  16. resolve('./', { basedir: dir }, function (err, res, pkg) {
  17. t.ok(err);
  18. });
  19. });