tr_rel.js 659 B

123456789101112131415161718192021222324
  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_rel/subdir/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('console', src)({ log: function (msg) {
  18. t.equal(msg, 333);
  19. } });
  20. });
  21. });