Upgrade to Jest 28

MSAL

Upgrades a Jest 27 project to Jest 28: migrates the Jest config off the options Jest 28 removed or renamed, such as timers and testURL, the tests off jest.useFakeTimers('modern') and 'legacy', the default exports of expect and the test environments, and Jest 27's type arguments of jest.fn(), makes custom transformers return {code}, adds jest-environment-jsdom and jest-jasmine2 where the project uses them, and upgrades Jest's packages along with @types/jest, ts-jest and the Vue transformers. Marks what it cannot migrate: dependencies with no Jest 28 support, custom test environment constructors, toHaveProperty(path, undefined) and removed command line options.

org.openrewrite.javascript.testing.jest.UpgradeToJest28
mod run . --recipe=org.openrewrite.javascript.testing.jest.UpgradeToJest28

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.