Skip to content

Commit 35c114f

Browse files
alejandronanezTrott
authored andcommitted
test: use assert.throws() in test-require-json.js
Use assert.throws() instead of try/catch.
1 parent 863402e commit 35c114f

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

test/parallel/test-require-json.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ require('../common');
2424
const assert = require('assert');
2525
const fixtures = require('../common/fixtures');
2626

27-
try {
27+
assert.throws(function() {
2828
require(fixtures.path('invalid.json'));
29-
} catch (err) {
30-
assert.ok(
31-
/test[/\\]fixtures[/\\]invalid\.json: /.test(err.message),
32-
`require() json error should include path: ${err.message}`);
33-
}
29+
}, SyntaxError);

0 commit comments

Comments
 (0)