test(es2016): dynamic import()#1051
Conversation
> `import()` is proposed to work in both scripts and modules. > This gives script code an easy asynchronous entry point into > the module world, allowing it to start running module code. > This proposal would be a small expansion of the existing > JavaScript and HTML capabilities, using the same framework of > specifying syntactic forms in the JavaScript specification, > which delegate to the host environment for their heavy lifting. > HTML's infrastructure for fetching and resolving modules would be > leveraged to define its side of the story. Similarly, Node.js would > supply its own definitions for HostPrepareImportedModule and > HostResolveImportedModule to make this proposal work there. Cite: https://github.com/tc39/proposal-dynamic-import See also: - https://tc39.github.io/proposal-dynamic-import/ - #1034 - #316
| { | ||
| name: 'import', | ||
| exec: function () {/* | ||
| try { |
There was a problem hiding this comment.
this is false; import() is strictly not a function, it's a keyword followed by parens.
| { | ||
| name: 'throw', | ||
| exec: function () {/* | ||
| try { |
There was a problem hiding this comment.
wouldn't import('') potentially reject anyways, since that's not a valid path?
There was a problem hiding this comment.
That's up to the host environment. Testing import() is equivalent to testing import declarations...
|
@domenic i'd love your input here on what things this should be testing |
| { | ||
| name: 'throws without params', | ||
| exec: function () {/* | ||
| try { |
There was a problem hiding this comment.
This is grammatically disallowed, not runtime disallowed, so it needs an eval wrapper.
| }, | ||
| { | ||
| name: 'rejects without params', | ||
| exec: function () {/* |
|
I'm pretty sure this feature should not be tested at all except in a Modules tab (that does not yet exist), along with import/export itself. |
|
Closing per #316 (comment) |
|
@ljharb is modules tab planed? |
|
Loosely yes. |
|
@yukulele it's an unnecessary complexity barrier throwing off the validity of the Node charts—very few people are aware of this EDIT: Opinions my own.™ |
Citing: https://github.com/tc39/proposal-dynamic-import
Spec: https://tc39.github.io/proposal-dynamic-import/
See also: #1034, #316, nodejs/node-eps#39