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:
- changing test script from
react-scripts test
toTZ=UTC && react-scripts test
- Adding the following snippet to setupTests.js:
module.exports = async () => {
process.env.TZ = 'UTC';
};