Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: invalid package.json causes error when require()ing in directory #10044

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/fixtures/packages/invalid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports.ok = 'ok';
1 change: 1 addition & 0 deletions test/fixtures/packages/invalid/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{,}
7 changes: 7 additions & 0 deletions test/sequential/test-module-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ assert.strictEqual(threeFolder, threeIndex);
assert.notStrictEqual(threeFolder, three);

console.error('test package.json require() loading');
assert.throws(
function() {
require('../fixtures/packages/invalid');
},
/^SyntaxError: Error parsing \S+: Unexpected token , in JSON at position 1$/
);

assert.strictEqual(require('../fixtures/packages/index').ok, 'ok',
'Failed loading package');
assert.strictEqual(require('../fixtures/packages/main').ok, 'ok',
Expand Down