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
[infra] Replace custom test module remapping with package exports #3132
Conversation
🦋 Changeset detectedLatest commit: 69d999e The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultslit-element-list
render
update
update-reflect
lit-html-kitchen-sink
render
update
nop-update
lit-html-repeat
render
update
lit-html-template-heavy
render
update
reactive-element-list
render
update
update-reflect
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
packages/lit-element/src/test/polyfill-support/lit-element-ce-sd-noPatch_test.html
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
I think the flakes we have been seeing from the starter kit test were just timeouts. Since things are running in parallel, it sometimes takes longer for browser tests to start. The starter kits now run separately, after the other tests, so that they have less resource contention. We could also bump the `browserStartTimeout`, but since it's a user template repo, that seems weird. Also: - Upgrades dependencies - Removes some unnecessary devDeps from virtualizer - Adds a changelog entry from #3132 that I forgot (unrelated, just throwing it in)
Switches from a custom web test runner plugin to the now built-in export conditions configuration, in order to switch between dev and prod builds in our browser tests.
Background
Some of our packages contain 2 separate builds: dev and prod. Dev is the raw output from TypeScript and includes extra debugging features. Prod is the minified build that users will get in production, and excludes those debugging features.
The two modes are described in our
package.json
files using export conditions. By default, users get the prod build. If they set thedevelopment
export condition in tools like rollup, webpack, node, they will get the dev build.We run all of our tests against both builds to get full coverage. Previously, we did this with a custom plugin for web test runner which rewrote
development/
paths to production paths when needed. We did this because web test runner did not, at the time, have support for export conditions.Now, web test runner does have support for export conditions.
Changes
Switches all tests to import their respective libraries using package self-references, instead of relative paths. This allows export conditions to take effect even from within the same package.
Switches to the
NodeNext
mode for themodule
andmoduleResolution
settings in ourtsconfig.json
files. This is needed for package self-references.Adds
types
entries to the export conditions in ourpackage.json
files. This is needed when usingNodeNext
, and is how TypeScript discovers the typings for each specific package export. (Side note, in the future, this feature will allow us to remove the.d.ts
files that we currently duplicate into the top-level of the package, but we can't do that until our users are also usingNodeNext
).Added a new web test runner middleware that enforces that we only import dev sources in dev mode, and prod sources in prod mode. It serves a 403 forbidden when this is violated, which fails the test. This should prevent us from accidentally using relative imports in tests in the future.
Deleted the old path-rewriting web test runner plugin, which is no longer needed.
Upgraded all
@web/test-runner
and@web/dev-server
packages, and consolidated them where possible into the top-levelpackage.json
for easier upgrades.Fixes #2844
Fixes #3091