pipeline_deps.js 607 B

12345678910111213141516171819202122
  1. var browserify = require('../');
  2. var vm = require('vm');
  3. var test = require('tap').test;
  4. var through = require('through2');
  5. test('deps pipeline', function (t) {
  6. t.plan(1);
  7. var b = browserify(__dirname + '/pipeline_deps/main.js');
  8. b.pipeline.get('deps').push(through.obj(function (row, enc, next) {
  9. row.source = row.source.replace(/111/g, '11111');
  10. this.push(row);
  11. next();
  12. }));
  13. b.bundle(function (err, src) {
  14. Function([ 'console' ], src)({ log: log });
  15. function log (msg) {
  16. t.equal(msg, 'main: 56055');
  17. }
  18. });
  19. });