double_bundle.js 616 B

123456789101112131415161718192021222324
  1. var browserify = require('../');
  2. var vm = require('vm');
  3. var test = require('tap').test;
  4. test('double bundle', function (t) {
  5. t.plan(5);
  6. var b = browserify(__dirname + '/entry/main.js');
  7. b.bundle(function (err, src0) {
  8. t.ifError(err);
  9. var c = {
  10. done : function (one, two) {
  11. t.equal(one, 1);
  12. t.equal(two, 2);
  13. }
  14. };
  15. vm.runInNewContext(src0, c);
  16. b.bundle(function (err, src1) {
  17. t.ifError(err);
  18. t.equal(src1.toString('utf8'), src0.toString('utf8'));
  19. });
  20. });
  21. });