Skip to content

Commit 2f82449

Browse files
committed
Add failing syntax error + transform test
Ref 9fe46d5#commitcomment-28273437
1 parent e0742be commit 2f82449

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

test/files/syntax_error.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const a = require('a');
2+
const a = 0;

test/syntax.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
8+
test('syntax error', function (t) {
9+
t.plan(1);
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('error', function (err) {
16+
t.ok(err);
17+
});
18+
p.end(path.join(__dirname, '/files/syntax_error.js'));
19+
});

0 commit comments

Comments
 (0)