Skip to content

Upgrading babel-jest 21 to 22

Breaking21.2.0 → 22.4.4Breaking6Platform1Deprecated1New39Changed13Fixed64Other26

BreakingUpgrade verdict

6 breaking changes and a platform requirement change.

  • The toBe matcher now uses Object.is, so some edge cases like NaN and -0 compare differently.
  • The simulated browser used by tests is now a newer version, so some DOM behavior may differ.
  • Custom test environments must use the new teardown method instead of dispose.
  • Snapshot file keys now combine the test name and snapshot name, so existing snapshots may need updating.
Top 5 of 8 that need code or config changes
Breaking6
Replaces identity equality with Object.is in the toBe matcher in expect.
toBeObject.is
Upgrades jest-environment-jsdom to JSDOM 11, which changes the DOM implementation behavior.
jest-environment-jsdom
Adds Async Test Environment APIs and renames dispose to teardown in test environments.
disposeteardown
Concatenates the test name and snapshot name in jest-snapshot, changing snapshot keys.
jest-snapshot
jest-cli now fails when no tests are found.
jest-cli
Adds a serializer for jest.fn so jest mocks can be snapshotted, changing snapshot output.
jest.fn
Platform1
Drops support for Node.js version 4.
Deprecated1
Deprecates the mapCoverage option.
jest-runtimemapCoverage