✗ npx jest --version
24.5.0
有一套对时区敏感的jest测试.我们通常使用npm脚本运行它们:"jest": "TZ=utc jest"
TZ设置为utc时,我在快照中得到如下值:
modificationDate="2019-01-08T00:00:00.000Z"
没有它,我会:
modificationDate="2019-01-08T08:00:00.000Z"
Is there a way to set that in my jest config so I can run 101 at the command line without having to go through the NPM script?这件事毫无意义.
我试着把这两个加入我的jest中.配置.js.两人都没有成功:
TZ: 'utc',
globals: {
TZ: 'utc',
},
当然,解决这个问题似乎很简单,但我很惊讶Jest没有办法为测试配置它.