Jest mock not working when any transformer is configuration

Viewed 188

When add any transformer or empty property transform to Jest config, mocks are not working. Simple code below.

Jest config:

"transform": {
any regex: any transformer
}

Module say:

module.exports = (m) => {
    console.log(m);
};

Module test-module:

const say = require("./say");

module.exports = () => {
    say("Hello world!");
};

Test:

jest.mock("./say", () => () => console.log("Mock!!!!"));

test("any test", () => {
});

If delete transform config, mock works, will get message: Mock!!!!.

1 Answers
Related