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
Initial tests for Dynamic Imports #1588
Conversation
80ab186
to
7ce4958
Compare
e68c51d
to
269908b
Compare
hey guys, sorry for hijacking this PR. we're trying to make we also started running against this branch/PR to get some test coverage for there are a couple of tests involving for example: module-code/dynamic-import/syntax-nested-arrow-assignment-expression-empty-str-arg.js any hints or pointers are much appreciated. thank you in advance! |
Since it’s a URL, there’s no reason that an empty string necessarily won’t resolve to a module. |
Rick is out until September and I didn't have the chance to review this PR yet. I'm not sure at what point this PR is still a WIP with parts not done yet and I'm afraid I could be over reviewing things Rick already has plans to change. My current work efforts are based on class fields related stuff but I hope we can be back to this PR anytime. |
@ljharb thank you, good point. I 'm not sure about the intricacies of @leobalter makes sense, no worries! it can wait, there's no rush. thank you for getting back though! Meanwhile I might just blacklist those tests for the time being, or find another temporary workaround, e.g. parsing for |
Module loading is engine-specific and it’d be very hard to cover this fully with test262. |
Presently we use engine-specific machinery, provided via eshost runtime definitions, to ensure that module loading operations occur within the scope of each host's capabilities. This is how both module code and dynamic import test material is executed. |
269908b
to
0a9a037
Compare
I just rebased the branch to verify the CI again. No other changes introduced here so far. |
@dnalborczyk I think your question is more appropriate for the proposal/authors.
"parsing for import('')", and evaluating what it returns are two very distinct aspects of the feature, which occur during different phases of a JS program's lifetime. |
0a9a037
to
4b90333
Compare
I finally fixed the duplicate tests, they should pass on the CI process now.
|
@leobalter The file module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js is trying to import a missing file (maybe a path mixup) |
Thanks for catching this up. This is still WIP but you definitely caught some commit mixup. I’ll restore this file tomorrow. Please, Let me know if you find anything else from the tests. Looking forward to complete this coverage. |
Np. There's a couple more to investigate for missing files:
|
@jdalton this should be fixed for now |
ok, with the latest commits I'm able to run all the tests just OK w/ JSC and V8.
|
I'm also migrating the checklist to #1164 |
Just a note to |
await import('./eval-self-once-script.js'); | ||
|
||
assert.sameValue(global.evaluated, 2, 'global property was defined and incremented only once'); | ||
}).then($DONE, $DONE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ The global.evaluated
value should be 1
and not 2
.
Update:
Is this a dup of test/language/module-code/dynamic-import/eval-self-once-module.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intended to be this way. It's a very similar test but it is evaluated as a script and it loads itself again following this:
Success path
The completion value of any subsequent call to HostResolveImportedModule after
FinishDynamicImport has completed, given the arguments referencingScriptOrModule
and specifier, must be a module which has already been evaluated, i.e. whose
Evaluate concrete method has already been called and returned a normal completion.
you can find this normative text here: https://tc39.github.io/proposal-dynamic-import/#sec-hostimportmoduledynamically
a script file loading it self ends up being evaluated twice. The first time it was not evaluated as a Module Record or using HostResolveImportedModule. This is tricky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the info
in the metadata says the file is meant to run as a script code (strict or non strict) and not as a module code, which has a different evaluation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of the assert should probably be changed
'global property was defined and incremented only once'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdalton thanks for providing such quick feedback!
includes: [fnGlobalObject.js] | ||
flags: [async] | ||
flags: [async, module] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this test was renamed the resource it's loading wasn't (in source of eval-self-once-module
).
Update:
Fixed in another commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that, I left the changes in the editor without saving to the file and pushed the other commit.
|
||
---*/ | ||
|
||
if (true) import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ Based on INTERPRETING async flagged tests should print 'Test262:AsyncTestComplete'
or 'Test262:AsyncTestFailure: ' + reason
by way of doneprintHandle
. Without printing a complete or fail the interpretation can hit a test timeout and mark it as a test failure.
Tests affected:
test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js
test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js
test/language/module-code/dynamic-import/usage/nested-if-braceless-returns-promise.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I think these are all from my original batch of generated tests, which definitely need work. Please keep the feedback and review coming <3
This is not ready for in depth review yetRef #1164