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

Increase coverage for dynamic import and top-level await #4421

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicolo-ribaudo
Copy link
Member

This PR includes two failing cases we found in JSC while running the import defer tests, for which we didn't have previous coverage. Given that dynamic import and top level await are features on their own, it's better to also have tests for it that do not use import defer.

What these tests are testing is that dynamic import of a module that is already rejected/pending returns a promise that is rejected/pending.

@nicolo-ribaudo nicolo-ribaudo requested a review from a team as a code owner March 12, 2025 18:03
Comment on lines +50 to +56
// We only continuye execution of the first fixture file after importing a second,
// empty, fixture file. This is so that if the implementation uses a separate
// queue to resolve dynamic import promises, if dynamic-import-of-waiting-module_FIXTURE
// wasn't waiting on top-level await its top-level promise would already be resolved.
import("./dynamic-import-of-waiting-module-2_FIXTURE.js").then(() => {
continueExecution();
}, $DONE);
Copy link
Member Author

@nicolo-ribaudo nicolo-ribaudo Mar 12, 2025

Choose a reason for hiding this comment

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

This is not super nice but I don't know how else to give promiseForNamespace2 a chance to resolve before calling continueExecution. The expected behavior is that promiseForNamespace2 will not resolve before that call, so I cannot simply move continueExecution() into a .then handler on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants