Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup: switch back to regular value arg to error
  • Loading branch information
JakobJingleheimer committed Jul 1, 2022
commit cb738d69e7c463dd603eaa73e3e23af19d888d48
6 changes: 2 additions & 4 deletions lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ const { getOptionValue } = require('internal/options');

let emittedSpecifierResolutionWarning = false;

const nullTypeForErr = { constructor: { name: 'null' } };

/**
* A utility function to iterate through a hook chain, track advancement in the
* chain, and generate and supply the `next<HookName>` argument to the custom
Expand Down Expand Up @@ -608,7 +606,7 @@ class ESMLoader {
throw new ERR_INVALID_RETURN_VALUE(
'an object',
hookErrIdentifier,
output === null ? nullTypeForErr : output,
output,
);
}
};
Expand Down Expand Up @@ -844,7 +842,7 @@ class ESMLoader {
throw new ERR_INVALID_RETURN_VALUE(
'an object',
hookErrIdentifier,
output === null ? nullTypeForErr : output,
output,
);
}
};
Expand Down
4 changes: 2 additions & 2 deletions test/es-module/test-esm-loader-chaining.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const commonArgs = [
assert.match(stderr, /loader-resolve-null-return\.mjs/);
assert.match(stderr, /'resolve' hook's nextResolve\(\)/);
assert.match(stderr, /an object/);
assert.match(stderr, /instance of null/);
assert.match(stderr, /got null/);
}

{ // Verify error thrown when invalid `context` argument passed to `nextResolve`
Expand Down Expand Up @@ -372,7 +372,7 @@ const commonArgs = [
assert.match(stderr, /loader-load-null-return\.mjs/);
assert.match(stderr, /'load' hook's nextLoad\(\)/);
assert.match(stderr, /an object/);
assert.match(stderr, /instance of null/);
assert.match(stderr, /got null/);
}

{ // Verify error thrown when invalid `url` argument passed to `nextLoad`
Expand Down