I wrote some tests in my Create React App application that passed locally but failed in CI due to differences in timezone. So I need a way to set the timezone to UTC for all tests in my application. I tried the suggestions on this question, but they didn't work, likely due to Create React App:
Things that I have tried:
react-scripts test
to TZ=UTC && react-scripts test
module.exports = async () => {
process.env.TZ = 'UTC';
};
It should be "test": "TZ=UTC react-scripts test",
(without &&).
Note that it's working only when you run it from the terminal (because I'm running sometimes tests from IDE and then you have to change it separate in IDE tests config).