fix: force timezone to be UTC for tests (#38215)
react-calendar-heatmap's output depends on the timezone, which means that snapshots can fail if the timezone changes. This sets the timezone as UTC during client tests to avoid that problem.
This commit is contained in:
parent
701bbc2ae9
commit
cc79999a31
3
client/jest-timezone-setup.js
Normal file
3
client/jest-timezone-setup.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = async () => {
|
||||
process.env.TZ = 'UTC';
|
||||
};
|
@ -12,6 +12,7 @@ module.exports = {
|
||||
globals: {
|
||||
__PATH_PREFIX__: ''
|
||||
},
|
||||
globalSetup: './jest-timezone-setup.js',
|
||||
verbose: true,
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/jest.transform.js'
|
||||
|
6
client/jest.test.js
Normal file
6
client/jest.test.js
Normal file
@ -0,0 +1,6 @@
|
||||
/* global expect */
|
||||
describe('Timezones', () => {
|
||||
it('should always be UTC', () => {
|
||||
expect(new Date().getTimezoneOffset()).toBe(0);
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user