faulty_basedir.js 807 B

1234567891011121314151617181920212223242526272829
  1. var test = require('tape');
  2. var path = require('path');
  3. var resolve = require('../');
  4. test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
  5. t.plan(1);
  6. var resolverDir = 'C:\\a\\b\\c\\d';
  7. resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
  8. t.equal(!!err, true);
  9. });
  10. });
  11. test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
  12. t.plan(2);
  13. var opts = {
  14. basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
  15. preserveSymlinks: false
  16. };
  17. var module = './dotdot/abc';
  18. resolve(module, opts, function (err, res) {
  19. t.equal(err.code, 'MODULE_NOT_FOUND');
  20. t.equal(res, undefined);
  21. });
  22. });