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

This aligns the behavior of synchronous hooks with asynchronous hooks by allowing omission of the context parameter in the invocation of next hooks. The contexts are merged along the chain. PR-URL: https://github.com/nodejs/node/pull/57056 Fixes: https://github.com/nodejs/node/issues/57030 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
14 lines
396 B
JavaScript
14 lines
396 B
JavaScript
// Test that the context parameter can be omitted in the nextResolve invocation.
|
|
|
|
import * as common from '../common/index.mjs';
|
|
import { registerHooks } from 'node:module';
|
|
|
|
const hook = registerHooks({
|
|
resolve: common.mustCall(function(specifier, context, nextResolve) {
|
|
return nextResolve(specifier);
|
|
}, 1),
|
|
});
|
|
|
|
await import('../fixtures/es-modules/message.mjs');
|
|
|
|
hook.deregister();
|