bin_tr_error.js 1.0 KB

123456789101112131415161718192021222324252627
  1. var browserify = require('../');
  2. var spawn = require('child_process').spawn;
  3. var test = require('tap').test;
  4. var path = require('path')
  5. var semver = require('semver');
  6. // TODO this should be fixable I guess
  7. var flaky = process.platform === 'win32' && semver.satisfies(process.version, 'v0.10.x');
  8. test('function transform', { skip: flaky }, function (t) {
  9. t.plan(3);
  10. var ps = spawn(process.execPath, [
  11. path.resolve(__dirname, '../bin/cmd.js'),
  12. '-t', './tr.js', './main.js'
  13. ], {cwd: path.resolve(__dirname, 'bin_tr_error')});
  14. var src = '';
  15. var err = '';
  16. ps.stdout.on('data', function (buf) { src += buf });
  17. ps.stderr.on('data', function (buf) { err += buf });
  18. ps.on('exit', function (code) {
  19. t.notEqual(code, 0);
  20. var errorFile = path.resolve(__dirname, 'bin_tr_error', 'tr.js');
  21. t.notEqual(err.indexOf('there was error'), -1, 'Error should contain error message')
  22. t.notEqual(err.indexOf(errorFile), -1, 'Error should contain stack trace')
  23. });
  24. });