bundle_external_global.js 589 B

123456789101112131415161718192021222324
  1. var test = require('tap').test;
  2. var browserify = require('../');
  3. var through = require('through2');
  4. var vm = require('vm');
  5. test('bundle external global', function (t) {
  6. t.plan(1);
  7. var stream = through();
  8. stream.push('console.log(process)');
  9. stream.push(null);
  10. var b = browserify({ bundleExternal: false });
  11. b.add(stream);
  12. b.bundle(function (err, src) {
  13. vm.runInNewContext(src, {
  14. console: { log: log },
  15. process: process
  16. });
  17. function log (msg) {
  18. t.equal(msg, process);
  19. }
  20. });
  21. });