import defer x from "mod";
import defer { x } from "mod";
import defer y, * as ns from "mod";
import defer as ns from "mod";
export defer * as ns from "mod";
All the existing dynamic import syntax tests should be duplicated to import.defer (both valid and invalid).
Deferred namespace object
[x] It is an object
[x] It is not the same object as the non-deferred one
[ ] We should duplicate all the normal namespace object tests
[x] Importing twice gives the same object
[x] static/static
[x] static/dynamic
[x] dynamic/dynamic
[x] static from different files
[x] import and import defer + exec only execute the module once
Evaluation
Sync
[x] import defer does not trigger evaluation
[ ] import.defer does not trigger evaluation
[x] [[Get]] triggers evaluation
[x] with a known export name
[x] with a non-exported name
[x] does not trigger evaluation with a symbol
[ ] All other object operations (Reflect.*) do not trigger evaluation
Errors
[x] Property access re-throws the evaluation error
[x] On first access for not evaluated modules
[x] On second access for not evaluated modules
[x] On first access for already evaluated modules
[x] Import defer of an errored module doesn't throw
[x] ReadyForSyncExecution
[x] Cannot evaluate a module in its evaluating state
[x] Cannot evaluate itself
[x] Cannot evaluate a module with a dependency in an evaluating state
[x] The error when evaluating a module with two dependencies, where the first one is linked and the second one is evaluating, happens before evaluating the first one
[x] A deferred module evaluates itself while being deferred-evaluated
[x] Cannot evaluate a module in its evaluating-async state
[x] Cannot evaluate itself after a TLA
[x] Cannot evaluate a module with a dependency in an evaluating-async state.
[x] Syntax error are not deferred
[x] Linking errors are not deferred
Async
[x] Async modules are not deferred
[x] Sync modules with async dep are deferred, but their async deps are not
[x] Sync deps of async modules are not deferred
[x] Async transitive deps are flattened and exexuted in the right order
[ ] All these tests also for dynamic import.defer()
https://github.com/tc39/proposal-defer-import-eval/
Syntax
Valid cases
Invalid cases (one per file)
All the existing dynamic import syntax tests should be duplicated to
import.defer
(both valid and invalid).Deferred namespace object
Evaluation
Sync
import defer
does not trigger evaluationimport.defer
does not trigger evaluation[[Get]]
triggers evaluationReflect.*
) do not trigger evaluationErrors
ReadyForSyncExecution
Async
import.defer()