-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Open
Labels
Description
Page(s)
https://jestjs.io/docs/upgrading-to-jest30
Description
Hi,
I am upgrading from v29 to v30, and this took me a while to figure out:
jest.mock("./path/to/module")
is case-sensitive now.
jest.mock("../src/THEANSWER"); // <- works in v29 but fails in v30
// jest.mock("../src/theAnswer"); // <- works in v30
import { getTheAnswer } from "../src/theAnswer";
describe("getTheAnswer", () => {
it("is called", () => {
expect(getTheAnswer).not.toHaveBeenCalled(); // <- fails in v30: `Matcher error: received value must be a mock or spy function`
getTheAnswer();
expect(getTheAnswer).toHaveBeenCalled();
});
});
I can imagine that this happens because of the update to glob v10 but when I read the documentation I did not expect jest.mock()
to be affected.
Maybe we should add this information to the upgrade document?
hainenber