tr_whole_package.js 591 B

12345678910111213141516171819202122
  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(1);
  8. var p = mdeps({
  9. transformKey: [ 'browserify', 'transform' ]
  10. });
  11. p.end(path.join(__dirname, '/files/tr_whole_package/main.js'));
  12. var pack = packer();
  13. p.pipe(JSONStream.stringify()).pipe(pack);
  14. var src = '';
  15. pack.on('data', function (buf) { src += buf });
  16. pack.on('end', function () {
  17. Function('t', src)(t);
  18. });
  19. });