How do I set a timezone in my Jest config?

后端 未结 3 454
无人及你
无人及你 2020-12-05 17:51
✗ npx jest --version
24.5.0

Got a set of jest tests that are timezone sensitive. We typically run them with an npm script: \"jest\": \"TZ=utc

3条回答
  •  不知归路
    2020-12-05 18:34

    I just run into the same issue and I was able to resolve it by adding process.env.TZ = 'your/timezone'; to my jest.config.js.

    Maybe this helps in your case as well :)

    process.env.TZ = 'UTC';
    
    module.exports = {
      ...
    };
    

提交回复
热议问题