bundle_external.js 654 B

1234567891011121314151617181920212223242526
  1. var test = require('tap').test;
  2. var browserify = require('../');
  3. var vm = require('vm');
  4. test('bundle external', function (t) {
  5. t.plan(3);
  6. var expected = [
  7. { name: 'beep', value: 111 },
  8. { name: 't-rex', value: 5 }
  9. ];
  10. var b = browserify({ bundleExternal: false });
  11. b.add(__dirname + '/bundle_external/main.js');
  12. b.bundle(function (err, src) {
  13. var c = {
  14. t: t,
  15. require: function (name) {
  16. var r = expected.shift();
  17. t.equal(name, r.name);
  18. return r.value;
  19. }
  20. };
  21. vm.runInNewContext(src, c);
  22. });
  23. });