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

Use Vite for all tests #1840

Merged
merged 35 commits into from
Apr 2, 2024
Merged

Use Vite for all tests #1840

merged 35 commits into from
Apr 2, 2024

Conversation

mansona
Copy link
Member

@mansona mansona commented Mar 12, 2024

No description provided.

@ef4
Copy link
Contributor

ef4 commented Mar 26, 2024

The merge from main above fixed part of the failures in canary-static-app because

The above commit fixed the development mode canary-static-app. The next thing we debugged is the production mode canary-static-app. Before, that was doing EMBER_ENV=production ember test, which put ember into production mode while still including the tests in the build. Now the build happens separately from ember test so there's nothing telling the build to include tests, so they're not in dist.

Other issues identified while debugging (some of which only appear if you try to run one of the scenarios in vite dev, particularly with staticAddonsTrees===false):

  • when @ember/test-waiters gets upgraded to v2 we include types/index.js in the implicit modules. An empty JS file is produced for it, but the browser considers it an error to try to import * from an empty module. This is not a new bug, but webpack was sloppy enough to not care.
  • we saw some of the package rules in the static-app not applying and causing test failures in dev only. We suspect this is a query params matching issue that could be fixed by Prevent query-params added by vite to be passed to core logic #1846

We may want to consider not supporting staticAddonsTrees===false at all in the new major. It often introduces bugs that are otherwise not present. It's trying to give behavior closer to classic, but it can hurt more than it helps.

We also started debugging the macro-tests failure, which is again a staticAddonsTrees===false issue where the implicit-modules appears to have a module cycle involving @ember/modifier/index.

ef4 added 2 commits March 28, 2024 13:36
And refactor to use app.execute's built-in env support.
Presumably this will be getting deleted shortly, but while it still exists it needs the same test-aware change that we made in app-template
@ef4
Copy link
Contributor

ef4 commented Mar 28, 2024

Leading edge of work:

  • debugging in canary-macro-tests, there's still the presumed module cycle involving @ember/modifier/index
  • it would be nice to debug that cycle in vite dev rather than vite build, but vite dev is failing for its own reasons that need to be debugged
  • the macro-tests app was historically a dumping ground for testing weird app behaviors, and it includes several custom outputPaths using app.import. Those appear not to be working at least in vite dev. Unclear whether we care, but it's something you'll see immediately when you try to debug it.

ef4 added 4 commits March 28, 2024 14:36
It's not well-supported and it contains some broken code that appears if you try to adjust the embroider settings in static-app
@ef4
Copy link
Contributor

ef4 commented Mar 29, 2024

I figured out the @ember/test-waiters issue. It's not a bug in embroider -- the addon actually includes a javascript module containing only export {}. Vite's dep optimizer doesn't handle that correctly.

(Arguably the addon shouldn't include such a module. It seems to exist as a workaround for other code doing a poor job of distinguishing type-only imports.)

@ef4
Copy link
Contributor

ef4 commented Apr 2, 2024

Down to only the watch mode tests.

I started reimplementing them to use a direct fetch for a given module, but that is going to be problematic. Vite controls rebuilds by propagating query params downward through the module graph. To get a realistic result we want to follow those same imports. This is a good fit for the audit assertions, but we'll need to extend those to be able to follow URLs and not just files.

@ef4 ef4 merged commit 8e692cc into main Apr 2, 2024
90 checks passed
@ef4 ef4 deleted the vite-tests branch April 2, 2024 13:45
@github-actions github-actions bot mentioned this pull request Apr 4, 2024
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
mansona added a commit that referenced this pull request Apr 22, 2024
This is a new requirement for these types of tests since #1840
patricklx pushed a commit to patricklx/embroider that referenced this pull request May 6, 2024
This is a new requirement for these types of tests since embroider-build#1840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants