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

lib: add warning on dynamic import es modules #30720

Closed
wants to merge 3 commits into from

Conversation

juanarbol
Copy link
Member

@juanarbol juanarbol commented Nov 29, 2019

Fixes #30601.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the process Issues and PRs related to the process subsystem. label Nov 29, 2019
@juanarbol
Copy link
Member Author

Ref: #30601

@cjihrig
Copy link
Contributor

cjihrig commented Nov 30, 2019

Can you add a test please.

@juanarbol
Copy link
Member Author

Sure, should I use a child process and test std err, or is there another way?

@cjihrig
Copy link
Contributor

cjihrig commented Nov 30, 2019

We have common.expectWarning() in our tests. You should be able to look in the test/ directory for examples.

@juanarbol
Copy link
Member Author

As long as code is undefined, common.expectWarning throws me an exception. So I used assertions instead of expectWarning

const [ message, code ] = expected.shift();
                              ^

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

lib/internal/process/esm_loader.js Outdated Show resolved Hide resolved
@juanarbol
Copy link
Member Author

@guybedford Done! Thanks for reviewing! Tell me if something else is not correct.

@guybedford guybedford added the esm Issues and PRs related to the ECMAScript Modules implementation. label Dec 7, 2019
Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@nodejs-github-bot
Copy link
Collaborator

@guybedford guybedford added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 7, 2019
guybedford pushed a commit that referenced this pull request Dec 7, 2019
PR-URL: #30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@guybedford
Copy link
Contributor

Landed in 6669cd1.

@guybedford guybedford closed this Dec 7, 2019
targos pushed a commit that referenced this pull request Dec 9, 2019
PR-URL: #30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Dec 13, 2019
@targos
Copy link
Member

targos commented Jan 14, 2020

Depends on #29866 to land on v12.x-staging

targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
PR-URL: nodejs#30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
targos pushed a commit to targos/node that referenced this pull request May 7, 2020
PR-URL: nodejs#30720
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@targos targos added backported-to-v12.x and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-open-v12.x labels May 7, 2020
targos pushed a commit that referenced this pull request May 7, 2020
PR-URL: #30720
Backport-PR-URL: #33055
Reviewed-By: Guy Bedford <guybedford@gmail.com>
targos pushed a commit that referenced this pull request May 13, 2020
PR-URL: #30720
Backport-PR-URL: #33055
Reviewed-By: Guy Bedford <guybedford@gmail.com>
@juanarbol juanarbol deleted the warning-es-dynamic-import branch January 19, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Experimental modules warning does not show when using dynamic import
5 participants