[heft-jest-plugin] Migrate from @types/heft-jest to @types/jest#5772
Merged
iclanton merged 5 commits intomicrosoft:mainfrom Apr 15, 2026
Merged
[heft-jest-plugin] Migrate from @types/heft-jest to @types/jest#5772iclanton merged 5 commits intomicrosoft:mainfrom
iclanton merged 5 commits intomicrosoft:mainfrom
Conversation
Replace the custom @types/heft-jest type shim with the official @types/jest package across all projects. Also removes the jest-global-setup.ts workaround that injected mocked() as a global — Jest 30 ships jest.mocked() as the standard API, so the global shim is no longer appropriate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
octogonz
approved these changes
Apr 15, 2026
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
Projects in this repo previously used a custom
@types/heft-jesttype shim for Jest typings, andheft-jest-plugininjected amocked()global via ajest-global-setupsetupFilesentry. Now that@types/jestcorrectly includes the mocking typings and Jest 30 shipsjest.mocked()as the standard API, the shim and workaround are no longer needed.Changes:
@types/heft-jestwith@types/jestin all rigs, build tests, samples, andtsconfig.jsonfilesjest-global-setup.tsfromheft-jest-pluginand itssetupFilesconfig entry@types/jestas an optional peer dependency ofheft-jest-pluginDetails
The
jest-global-setupscript was registered as a JestsetupFilesentry and injectedmocked()as a global function, because the old@types/heft-jestshim declared it that way. With Jest 30,jest.mocked()is the idiomatic API, so the global injection is nonstandard and the shim is no longer needed. The official@types/jestpackage (from DefinitelyTyped) provides the correct typings.This change does not break backwards compatibility for tests that already use
jest.mocked(). Tests using a baremocked()global will need to update tojest.mocked().How it was tested
Ran
rush buildandrush testlocally across affected packages.Impacted documentation
None — the
@types/heft-jestshim was an implementation detail not covered in public docs.