tr_module.js 635 B

1234567891011121314151617181920212223
  1. var mdeps = require('../');
  2. var test = require('tap').test;
  3. var JSONStream = require('JSONStream');
  4. var packer = require('browser-pack');
  5. var path = require('path');
  6. test('transform', function (t) {
  7. t.plan(4);
  8. var p = mdeps({
  9. transform: [ 'insert-aaa', 'insert-bbb' ],
  10. transformKey: [ 'browserify', 'transform' ]
  11. });
  12. p.end(path.join(__dirname, '/files/tr_module/main.js'));
  13. var pack = packer();
  14. p.pipe(JSONStream.stringify()).pipe(pack);
  15. var src = '';
  16. pack.on('data', function (buf) { src += buf });
  17. pack.on('end', function () {
  18. Function('t', src)(t);
  19. });
  20. });