syntax.js 783 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 through = require('through2');
  6. var path = require('path');
  7. test('syntax error', function (t) {
  8. t.plan(2);
  9. var input = path.join(__dirname, '/files/syntax_error.js');
  10. // ensure transformDeps functionality does not break when parse errors happen
  11. // see https://github.com/browserify/module-deps/commit/9fe46d5#commitcomment-28273437
  12. var p = mdeps({
  13. transform: function () { return through(); }
  14. });
  15. p.on('file', function (file) {
  16. t.equal(file, input, 'should emit a file event even if there was an error');
  17. });
  18. p.on('error', function (err) {
  19. t.ok(err);
  20. });
  21. p.end(input);
  22. });