You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
646 B

2 years ago
  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. });