fix(e2e): pin typescript to prevent eslint-plugin-jest from crashing dev server - #149
Merged
Conversation
…dev server
eslint-plugin-jest transitively depends on @typescript-eslint/type-utils@5.62.0,
which reads ts.TypeFlags.Any. Nothing in that dependency chain constrains the
typescript version, so a fresh npm install resolves whatever is newest at
install time (currently a TypeScript 7.x prerelease/major that changed the
compiler API), which throws when eslint-plugin-jest's rules load. This crashes
react-scripts' ESLint webpack plugin ("Environment key \"jest/globals\" is
unknown"), which renders a full-viewport dev-server error overlay that
intercepts every click and fails e2e tests non-deterministically depending on
what was resolved at npm-install time.
Pin typescript to 5.2.2 (matching the version already used at the repo root)
via npm overrides so host-app/guest-app installs are deterministic.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
#webpack-dev-server-client-overlayiframe (CRA's compile-error overlay) was on top of the page.react-scripts' ESLint webpack plugin failed to compile withEnvironment key "jest/globals" is unknown. Tracing it down:eslint-plugin-jesttransitively depends on@typescript-eslint/type-utils@5.62.0, which readsts.TypeFlags.Anyfrom thetypescriptpackage. Nothing in that dependency chain constrains thetypescriptversion (it's an unconstrained/optional peer), so a freshnpm installine2e/host-appande2e/guest-appresolves whatevertypescriptis newest at install time — currently a7.xrelease with a changed compiler API — which throws wheneslint-plugin-jest's rules load, silently breaking the plugin and failing ESLint's environment resolution.npm installtime, since these e2e apps have no committed lockfile), so it can pass locally with a reusednode_modulesand fail in CI (or on any later fresh install) without any source change.typescriptto5.2.2(matching the version already used at the repo root) via npmoverridesine2e/host-app/package.json.distande2e/guest-app/package.json.dist.Test plan
require('eslint-plugin-jest')threwTypeError: Cannot read properties of undefined (reading 'Any')on a truly fresh install (confirmedtypescript@7.0.2was resolved).typescriptoverride, did a cleanrm -rf node_modules+ fresh install, confirmedtypescript@5.2.2is resolved andeslint-plugin-jestloads without throwing.npx eslint --print-confignow exits 0 with no "unknown environment" error.npm run build && npm run test:e2epasses 12/12 on the fresh install (this branch is offmain, before theundefined-guesttest in [SITES-35203] fix(host-react): prevent GuestUIFrame crash when guest is undefined #148 was added).🤖 Generated with Claude Code