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.

38 lines
1.1 KiB

4 years ago
  1. var test = require('tape');
  2. var resolve = require('../');
  3. var path = require('path');
  4. test('shadowed core modules still return core module', function (t) {
  5. t.plan(2);
  6. resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) {
  7. t.ifError(err);
  8. t.equal(res, 'util');
  9. });
  10. });
  11. test('shadowed core modules still return core module [sync]', function (t) {
  12. t.plan(1);
  13. var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') });
  14. t.equal(res, 'util');
  15. });
  16. test('shadowed core modules return shadow when appending `/`', function (t) {
  17. t.plan(2);
  18. resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) {
  19. t.ifError(err);
  20. t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
  21. });
  22. });
  23. test('shadowed core modules return shadow when appending `/` [sync]', function (t) {
  24. t.plan(1);
  25. var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') });
  26. t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js'));
  27. });