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

test: verify dynamic import call with absolute path strings #49275

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

legendecas
Copy link
Member

Add a test case that verifies that the dynamic import call can resolve absolute path strings without a scheme as the specifier.

Refs: #48655

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Aug 21, 2023
@aduh95
Copy link
Contributor

aduh95 commented Aug 21, 2023

This will never pass on Windows, this test can only pass if absolutePath happens to match the corresponding origin relative URL (so a Unix path that does not involve any %, ?, nor #).

@aduh95
Copy link
Contributor

aduh95 commented Aug 21, 2023

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

I missed the fact that the test is in a conditional that exclude Windows. Still I'm -1 to the added test, paths are not and never will be supported a referrer, it has to be a URL.

@legendecas
Copy link
Member Author

legendecas commented Aug 24, 2023

This adds a test to verify a specifier can be a string with a leading slash. The referrer is still the URL of the current module.

The volume root may be referenced via /, //, or file:///.
https://nodejs.org/api/esm.html#file-urls

The document mentioned that the volume root may be referenced as / but I didn't find a test case to cover this usage (please correct me if I missed anything). I believe if this use case is legit, it should be tested even if it is not the recommended way to import an absolute path.

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Aug 30, 2023
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 31, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 31, 2023
@nodejs-github-bot nodejs-github-bot merged commit 04a3567 into nodejs:main Aug 31, 2023
37 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 04a3567

@UlisesGascon UlisesGascon mentioned this pull request Sep 10, 2023
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#49275
Refs: nodejs#48655
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants