bundle.js 797 B

1234567891011121314151617181920212223242526272829
  1. var test = require('tape');
  2. var splicer = require('../');
  3. var through = require('through2');
  4. var deps = require('module-deps');
  5. var pack = require('browser-pack');
  6. var concat = require('concat-stream');
  7. test('bundle', function (t) {
  8. t.plan(1);
  9. var pipeline = splicer.obj([
  10. 'deps', [ deps() ],
  11. 'pack', [ pack({ raw: true }) ]
  12. ]);
  13. pipeline.pipe(concat(function (body) {
  14. Function([ 'console' ], body.toString('utf8'))({ log: log });
  15. function log (msg) {
  16. t.equal(msg, 'main: 56055');
  17. }
  18. }));
  19. pipeline.get('deps').push(through.obj(function (row, enc, next) {
  20. row.source = row.source.replace(/111/g, '11111');
  21. this.push(row);
  22. next();
  23. }));
  24. pipeline.end(__dirname + '/bundle/main.js');
  25. });