[deferred-reexports] Add load-and-evaluation tests#5034
Open
[deferred-reexports] Add load-and-evaluation tests#5034
Conversation
Covers the "Load and Evaluation" section of tc39#5010 for the deferred re-exports proposal (https://tc39.es/proposal-deferred-reexports/). Seven scenarios under test/language/export/export-defer/load-and-evaluation/: 1. no-consumer-no-load: `export defer { x } from dep` does not load dep when nothing consumes x. 2. consumer-imports-loads: an import of the deferred binding loads and evaluates its source. 3. chained-defer: a chain of deferred re-exports evaluates every link on the chain when the binding is consumed. 4. reexport-non-defer-consumed: a plain (non-defer) re-export of a deferred binding forces its source to load when the entrypoint consumes it. 5. reexport-non-defer-unconsumed: a plain (non-defer) re-export of a deferred binding forces its source to load even when the entrypoint does not consume it. 6. star-reexport-non-default: `export *` over a module with a deferred non-default re-export pulls the deferred source. 7. star-reexport-default: `export *` (ALL-BUT-DEFAULT) skips a deferred default re-export, leaving its source unlinked. Tests that observe evaluation order populate a shared globalThis.evaluations array from each fixture and assert via assert.compareArray (following previous tests from import-defer). Tests that prove a module is not loaded point at a dep containing `invalid syntax!` paired with a positive signal (a `marker` binding, or evaluations tracking) to assert that the module was properly executed, but unused optional re-exports were skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers the "Load and Evaluation" section of #5010 for the deferred re-exports proposal (https://tc39.es/proposal-deferred-reexports/).
This adds 7 scenarios under test/language/export/export-defer/load-and-evaluation:
no-consumer-no-load:export defer { x } from depdoes not load dep when nothing consumes x.consumer-imports-loads: an import of the deferred binding loads and evaluates its source.chained-defer: a chain of deferred re-exports evaluates every link on the chain when the binding is consumed.reexport-non-defer-consumed: a plain (non-defer) re-export of a deferred binding forces its source to load when the entrypoint consumes it.reexport-non-defer-unconsumed: a plain (non-defer) re-export of a deferred binding forces its source to load even when the entrypoint does not consume it.star-reexport-non-default:export *over a module with a deferred non-default re-export pulls the deferred source.star-reexport-default:export *(ALL-BUT-DEFAULT) skips a deferred default re-export, leaving its source unlinked.Tests that observe evaluation order populate a shared
globalThis.evaluationsarray from each fixture and assert via assert.compareArray (following previous tests fromimport-defer). Tests that prove a module is not loaded point at a dependency containinginvalid syntax!paired with a positive signal (amarkerbinding, or evaluation order tracking) to assert that the module was properly executed, but unused optional re-exports were skipped.