mirror of https://github.com/nodejs/node.git
22 lines
498 B
JavaScript
22 lines
498 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'
|
|
});
|