jest-console: Fix TypeScript types being available in published package - #71215
Closed
aduth wants to merge 4 commits into
Closed
jest-console: Fix TypeScript types being available in published package#71215aduth wants to merge 4 commits into
aduth wants to merge 4 commits into
Conversation
Older versions seem to have an effect of allowing any unmatched Jest matcher to resolve as "any" instead of error'ing, concealing real issues
| "@types/eslint": "8.56.9", | ||
| "@types/estree": "1.0.5", | ||
| "@types/istanbul-lib-report": "3.0.0", | ||
| "@types/jest": "30.0.0", |
Member
There was a problem hiding this comment.
Why do we need to add this to the root of the monorepo?
Member
Author
There was a problem hiding this comment.
It was a dependency we previously inherited through the older version of @testing-library/jest-dom, but is no longer a dependency of the latest version. We rely on it so that we can have typed Jest globals without importing from the @jest/globals package. This changes it from an implicit dependency to an explicit dependency.
Member
Author
|
Superseded by #74310 |
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.
What?
Tries to fix the issue flagged at #70538 (comment)
In doing so, it also updates existing tests in
packages/componentswhich should be failing due to missing types for Jest matchers, shifting globally-available test types to be imported as part of the existinggutenberg-test-envtypings.Draft: I've had some intermittent issues with this locally, and I'm hoping to test this via CI to see if the issues are specific to my development environment, or actual problems with the implementation.
Why?
@wordpress/jest-consolepackage registers TypeScript types for matcherstoHaveWarned, etc. inpackages/componentsshould be failing due to missing typesHow?
@testing-library/jest-dom, where it appears that older versions override Jest matchers in such a way that non-existent matchers resolve toanyrather than errorgutenberg-test-envtypings@wordpress/jest-consoletypings to ensure they're imported in root entrypoint and available in built typings outputTesting Instructions
npm run build:package-typesshould pass.