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.

26 lines
858 B

2 years ago
  1. var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
  2. var b;
  3. var c;
  4. var test = function test() {
  5. console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
  6. console.log(b, ': preserveSymlinks true');
  7. console.log(c, ': preserveSymlinks false');
  8. if (a !== b && a !== c) {
  9. throw 'async: no match';
  10. }
  11. console.log('async: success! a matched either b or c\n');
  12. };
  13. require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) {
  14. if (err) { throw err; }
  15. b = result.replace(process.cwd(), '$CWD');
  16. if (b && c) { test(); }
  17. });
  18. require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) {
  19. if (err) { throw err; }
  20. c = result.replace(process.cwd(), '$CWD');
  21. if (b && c) { test(); }
  22. });