node/test/es-module/test-esm-loader-search.js
Jacob Smith bac9b1758f
esm: move hook execution to separate thread
PR-URL: https://github.com/nodejs/node/pull/44710
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
Co-authored-by: Michaël Zasso <targos@protonmail.com>
2023-11-23 10:19:07 +01:00

20 lines
393 B
JavaScript

'use strict';
// Flags: --expose-internals
// This test ensures that search throws errors appropriately
require('../common');
const assert = require('assert');
const {
defaultResolve: resolve
} = require('internal/modules/esm/resolve');
assert.throws(
() => resolve('target'),
{
code: 'ERR_MODULE_NOT_FOUND',
name: 'Error',
message: /Cannot find package 'target'/
}
);