five_bundle.js 771 B

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