tr_order.js 675 B

1234567891011121314151617181920212223
  1. var browserify = require('../');
  2. var vm = require('vm');
  3. var test = require('tap').test;
  4. var through = require('through2');
  5. test('function transform', function (t) {
  6. debugger;
  7. t.plan(8);
  8. var b = browserify(__dirname + '/tr/main.js');
  9. b.transform({ global: true }, function (file) {
  10. return through(function (buf, enc, next) {
  11. this.push(String(buf).replace(/ZZZ/g, '1'));
  12. next();
  13. });
  14. });
  15. b.transform(__dirname + '/tr_order/replace_aaa');
  16. b.transform(__dirname + '/tr_order/replace_bbb.js');
  17. b.bundle(function (err, src) {
  18. t.ifError(err);
  19. vm.runInNewContext(src, { t: t });
  20. });
  21. });