multi_require.js 452 B

123456789101112131415161718
  1. var browserify = require('../');
  2. var test = require('tap').test;
  3. var vm = require('vm');
  4. test('require same file locally and globally', function (t) {
  5. t.plan(2);
  6. var b = browserify(__dirname + '/multi_require/main.js', {
  7. basedir: __dirname
  8. });
  9. b.require('./multi_require/a.js', {expose: 'a'});
  10. b.bundle(function (err, src) {
  11. t.ifError(err);
  12. var c = {t: t};
  13. vm.runInNewContext(src, c);
  14. });
  15. });