Jest - Mock a constant property from a module for a specific test
问题 So, I'm attempting to do something which on the surface should be very simple... I have some constants defined in: ` //constants.js module.exports = { MY_CONSTANT: "TEST" } ` I have a file which I'm trying to test which has a branching statement like this: ` //file to test //... if(CONSTANTS.MY_CONSTANT === "TEST") {...} ... ` And I have a test like this: ` //test it("Should do something when MY_CONSTANT === "TEST, () => { //This is fine as it is exported as TEST }) it("Should do something