Skip to content

Commit 8835663

Browse files
vivek958aduh95
andauthored
Update test/parallel/test-esm-loader-null-source.js
Co-authored-by: Antoine du Hamel <[email protected]>
1 parent 9f922f7 commit 8835663

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

test/parallel/test-esm-loader-null-source.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,7 @@ const fixtures = require('../common/fixtures');
3131
3232
register('data:text/javascript,' + encodeURIComponent(code));
3333
34-
try {
35-
await import('file:///test-null-source.js');
36-
console.log('ERROR: Should have thrown');
37-
process.exit(1);
38-
} catch (err) {
39-
// Should throw ERR_INVALID_RETURN_PROPERTY_VALUE, not ERR_INTERNAL_ASSERTION
40-
if (err.code === 'ERR_INTERNAL_ASSERTION') {
41-
console.log('FAIL: Got ERR_INTERNAL_ASSERTION');
42-
process.exit(1);
43-
}
44-
if (err.code === 'ERR_INVALID_RETURN_PROPERTY_VALUE') {
45-
console.log('PASS: Got expected error');
46-
process.exit(0);
47-
}
48-
console.log('ERROR: Got unexpected error:', err.code);
49-
process.exit(1);
50-
}
34+
await assert.rejects(import('file:///test-null-source.js'), { code: 'ERR_INVALID_RETURN_PROPERTY_VALUE' });
5135
`,
5236
],
5337
{ encoding: 'utf8' }

0 commit comments

Comments
 (0)