Skip to content

Commit

Permalink
fix: Use regex to test for correct error
Browse files Browse the repository at this point in the history
In Node 6, the error output for JSON parse exceptions now includes a
nice backtrace. Unfortunately our test was comparing exact output, so it
now fails. This regex checks that the part we care about is there
without expecting a specific output.
  • Loading branch information
orangejulius committed Jun 13, 2016
1 parent b62caa0 commit 1ba8ec2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/components/loadJSONTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tape('loadJSON', function(test) {

test_stream(input, loadJSON.create('./'), function(err, actual) {
t.deepEqual(actual, expected, 'an empty object should have been returned');
t.equal(stderr, 'exception on this_is_not_json.json: [SyntaxError: Unexpected token h]\n');
t.ok(stderr.match(/SyntaxError: Unexpected token h/), 'error output present');
t.end();
unhook_intercept();
fs.unlinkSync(input[0].path);
Expand Down

0 comments on commit 1ba8ec2

Please sign in to comment.