1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Setting global UTC timezone for tests

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-05-31 10:38:05 +03:00
parent 194370e020
commit 1a3f7ddd02
3 changed files with 25 additions and 1 deletions

View File

@ -76,7 +76,8 @@
"ts-jest": { "ts-jest": {
"isolatedModules": true "isolatedModules": true
} }
} },
"globalSetup": "<rootDir>/src/jest.timezone.ts"
}, },
"build": { "build": {
"generateUpdatesFilesForAllChannels": true, "generateUpdatesFilesForAllChannels": true,

View File

@ -0,0 +1,12 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
describe("Timezones", () => {
it("should always be UTC", () => {
expect(new Date().getTimezoneOffset()).toBe(0);
});
});
export {};

11
src/jest.timezone.ts Normal file
View File

@ -0,0 +1,11 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
// Setting the timezone to UTC to ensure same timezone for CI and local environments
module.exports = async () => {
process.env.TZ = "UTC";
};
export {};