Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14.x backport] loader: make require.resolve throw for unknown builtin modules #45263

Conversation

danielleadams
Copy link
Member

Backports #43336

Fixes: nodejs#43274

PR-URL: nodejs#43336
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. v14.x labels Nov 1, 2022
@nodejs-github-bot
Copy link
Collaborator

Comment on lines +85 to +89
assert.strictEqual(require.resolve('https'), 'https');
assert.strictEqual(require.resolve('fs'), 'fs');

assert.throws(
() => require.resolve('unknown'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be passing when using the prefix, otherwise the original issue has not been fixed.

Suggested change
assert.strictEqual(require.resolve('https'), 'https');
assert.strictEqual(require.resolve('fs'), 'fs');
assert.throws(
() => require.resolve('unknown'),
assert.strictEqual(require.resolve('node:https'), 'node:https');
assert.strictEqual(require.resolve('node:fs'), 'node:fs');
assert.throws(
() => require.resolve('node:unknown'),

@danielleadams
Copy link
Member Author

Closing for now until I have a chance to revisit (or someone else picks up).

@danielleadams danielleadams deleted the backport-43336-to-v14.x branch November 8, 2022 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants