mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

PR-URL: https://github.com/nodejs/node/pull/56491 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
21 lines
517 B
JavaScript
21 lines
517 B
JavaScript
// This tests synchronous errors in ESM from require(esm) can be caught.
|
|
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
// Runtime errors from throw should be caught.
|
|
assert.throws(() => {
|
|
require('../fixtures/es-modules/runtime-error-esm.js');
|
|
}, {
|
|
message: 'hello'
|
|
});
|
|
|
|
// References errors should be caught too.
|
|
assert.throws(() => {
|
|
require('../fixtures/es-modules/reference-error-esm.js');
|
|
}, {
|
|
name: 'ReferenceError',
|
|
message: 'exports is not defined in ES module scope'
|
|
});
|