blob: 5400564b3182c6ae9d8b6567d1abf231365994da [file] [log] [blame] [edit]
// 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'
});