Skip to content

Upgrade dependency @types/jest from ^29.0.0 to ^30.0.0 | Hypermod.io#258

Open
github-actions[bot] wants to merge 1 commit intomainfrom
hypermod-transform/cmnzriqu9000ll204nutic090
Open

Upgrade dependency @types/jest from ^29.0.0 to ^30.0.0 | Hypermod.io#258
github-actions[bot] wants to merge 1 commit intomainfrom
hypermod-transform/cmnzriqu9000ll204nutic090

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Automated update for @types/jest to version 30.0.0.

This guide outlines the key changes and steps necessary to upgrade @types/jest from version 29.0.0 to 30.0.0, focusing on breaking changes and improvements.

Description

Jest 30 introduces significant changes, particularly in matchers, TypeScript typings, and CLI configurations. The removal of alias matcher functions and improvements in type inference for CalledWith family matchers are key highlights. The upgrade requires attention to TypeScript errors and changes in configuration flags.

Workflow

Step 1

Update alias matcher names to canonical matchers.


// Before
expect(fn).toBeCalled();
// After
expect(fn).toHaveBeenCalled();

Step 2

Ensure Node.js version is compatible (>=18.x) and update TypeScript to >=5.4.


// Update your Node.js and TypeScript versions:
node -v
# Ensure >= 18.x
npm install typescript@^5.4.0 --save-dev

Step 3

Update your Jest configuration to reflect file extension and pattern changes.


// jest.config.js
module.exports = {
  testMatch: ['**/?(*.)(spec|test).[jt]s?(x)', '**/?(*.)(spec|test).{mts,cts}'],
  moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'mts', 'cts', 'json', 'node']
};

Step 4

Rename CLI flag --testPathPattern to --testPathPatterns.


// Update your CLI commands:
// Before
jest --testPathPattern='unit/.*'
// After
jest --testPathPatterns 'unit/.*'

Step 5

Replace removed jest.genMockFromModule with jest.createMockFromModule.


// Before
const mockFs = jest.genMockFromModule('fs');
// After
const mockFs = jest.createMockFromModule('fs');

Potential Issues

  • Node.js versions below 18.x are not supported.
  • Old matcher alias names will cause errors.
  • TypeScript may block calls due to tighter type checks.

Other Dependencies

Dependencies potentially affected by the upgrade:

  • typescript@^5.4.0
  • jest@^30.0.0

References

Workflow:

PR created automatically by the Hypermod Dependency Bot configured by: Daniel Del Core.


Deployment created using Hypermod.io 💫

documentation | support

Hypermod Logo

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 15, 2026

⚠️ No Changeset found

Latest commit: 09bff19

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants