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

Module resolver: virtualize test-support.js #1807

Merged
merged 6 commits into from
Apr 4, 2024
Merged

Module resolver: virtualize test-support.js #1807

merged 6 commits into from
Apr 4, 2024

Conversation

BlueCutOfficial
Copy link
Collaborator

@BlueCutOfficial BlueCutOfficial commented Feb 20, 2024

Virtualization of the test-support entry point.

This PR replaces the script tag src="assets/test-support.js" with the virtual entry point src="@embroider/core/test-support" in the index.html of the rewritten app. The content that was previously written in assets/test-support.js is now generated by the virtual-test-support's functions.

How to test

@BlueCutOfficial BlueCutOfficial changed the base branch from main to virtual-entry-point February 20, 2024 09:30
@mansona mansona force-pushed the virtual-entry-point branch 7 times, most recently from 425215f to 0c31ba0 Compare February 29, 2024 17:43
@mansona mansona force-pushed the virtual-entry-point branch 6 times, most recently from 44981c2 to 00e95a1 Compare March 12, 2024 14:38
@mansona mansona force-pushed the virtual-entry-point branch from 00e95a1 to f61220a Compare April 2, 2024 13:56
@BlueCutOfficial BlueCutOfficial changed the base branch from virtual-entry-point to main April 3, 2024 10:32
@BlueCutOfficial BlueCutOfficial marked this pull request as ready for review April 3, 2024 10:33
@BlueCutOfficial BlueCutOfficial marked this pull request as draft April 3, 2024 10:34

function impliedAddonTestSupport(engine: Engine): string[] {
let result: Array<string> = [];
for (let addon of sortBy(Array.from(engine.addons.keys()), pkg => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can delete the sortBy. It was only being used by implicit-scripts not implicit-test-scripts, and now that this function only handles implicit-test-scripts this part should never have an effect.


if (!pkg?.isV2Ember()) {
throw new Error(`bug: an import of ${request.specifier} in non-ember package at ${request.fromFile}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this check, the check up above for being the first engine is sufficient.

@BlueCutOfficial BlueCutOfficial marked this pull request as ready for review April 4, 2024 11:59
@ef4 ef4 merged commit 2afc470 into embroider-build:main Apr 4, 2024
90 checks passed
@ef4
Copy link
Contributor

ef4 commented Apr 4, 2024

Thanks, nice work!

@mansona mansona added the enhancement New feature or request label Apr 10, 2024
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants