tr_symlink.js 871 B

123456789101112131415161718192021222324252627
  1. // based on this scenario:
  2. // https://github.com/substack/node-browserify/pull/831#issuecomment-49546902
  3. var browserify = require('../');
  4. var vm = require('vm');
  5. var test = require('tap').test;
  6. var through = require('through2');
  7. test('transform symlink', { skip: process.platform === 'win32' }, function (t) {
  8. t.plan(4);
  9. var expected = [ 9, 555, 777 ];
  10. var b = browserify(__dirname + '/tr_symlink/app/main.js', {
  11. basedir: __dirname + '/tr_symlink/app'
  12. });
  13. b.transform(function (file) {
  14. return through(function (buf, enc, next) {
  15. this.push(String(buf).replace(/7/g, 9));
  16. next();
  17. })
  18. });
  19. b.bundle(function (err, src) {
  20. t.ifError(err);
  21. var c = { console: { log: log } };
  22. vm.runInNewContext(src, c);
  23. function log (msg) { t.equal(msg, expected.shift()) }
  24. });
  25. });