mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
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:
@@ -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'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/* global expect */
|
||||
describe('Timezones', () => {
|
||||
it('should always be UTC', () => {
|
||||
expect(new Date().getTimezoneOffset()).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user