diff --git a/.github/workflows/automated-tests.yaml b/.github/workflows/automated-tests.yaml index 35bbd2b6..c9eb45b8 100644 --- a/.github/workflows/automated-tests.yaml +++ b/.github/workflows/automated-tests.yaml @@ -22,12 +22,6 @@ jobs: steps: - name: "Checkout code" uses: actions/checkout@v3 - - name: "Set timezone" - uses: szenius/set-timezone@v1.2 - with: - timezoneLinux: "Europe/Berlin" - timezoneMacos: "Europe/Berlin" - timezoneWindows: "Europe/Berlin" - name: "Use Node.js ${{ matrix.node-version }}" uses: actions/setup-node@v3 with: diff --git a/.github/workflows/codecov-test-suites.yaml b/.github/workflows/codecov-test-suites.yaml index adde5b33..8cdcccbb 100644 --- a/.github/workflows/codecov-test-suites.yaml +++ b/.github/workflows/codecov-test-suites.yaml @@ -19,12 +19,6 @@ jobs: steps: - name: "Checkout code" uses: actions/checkout@v3 - - name: "Set timezone" - uses: szenius/set-timezone@v1.2 - with: - timezoneLinux: "Europe/Berlin" - timezoneMacos: "Europe/Berlin" - timezoneWindows: "Europe/Berlin" - name: "Install dependencies and run coverage" run: | Xvfb :99 -screen 0 1024x768x16 & diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c8e6b45..ebbaf01e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ _This release is scheduled to be released on 2023-07-01._ ### Added - Added tests for severonly +- Set Timezone `Europe/Berlin` in unit tests (needed for new formatTime tests) ### Removed diff --git a/jest.config.js b/jest.config.js index 8a2403c2..fde44c96 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,23 +6,24 @@ module.exports = async () => { projects: [ { displayName: "unit", + globalSetup: "/tests/unit/helpers/global-setup.js", moduleNameMapper: { logger: "/js/logger.js" }, testMatch: ["**/tests/unit/**/*.[jt]s?(x)"], - testPathIgnorePatterns: ["/tests/unit/mocks"] + testPathIgnorePatterns: ["/tests/unit/mocks", "/tests/unit/helpers"] }, { displayName: "electron", testMatch: ["**/tests/electron/**/*.[jt]s?(x)"], - testPathIgnorePatterns: ["/tests/electron/helpers/"] + testPathIgnorePatterns: ["/tests/electron/helpers"] }, { displayName: "e2e", setupFilesAfterEnv: ["/tests/e2e/helpers/mock-console.js"], testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"], modulePaths: ["/js/"], - testPathIgnorePatterns: ["/tests/e2e/helpers/", "/tests/e2e/mocks"] + testPathIgnorePatterns: ["/tests/e2e/helpers", "/tests/e2e/mocks"] } ], collectCoverageFrom: ["./clientonly/**/*.js", "./js/**/*.js", "./modules/default/**/*.js", "./serveronly/**/*.js"], diff --git a/tests/unit/helpers/global-setup.js b/tests/unit/helpers/global-setup.js new file mode 100644 index 00000000..fc064b46 --- /dev/null +++ b/tests/unit/helpers/global-setup.js @@ -0,0 +1,3 @@ +module.exports = async () => { + process.env.TZ = "Europe/Berlin"; +}; diff --git a/tests/unit/modules/default/utils_spec.js b/tests/unit/modules/default/utils_spec.js index ff51ec3d..768c4771 100644 --- a/tests/unit/modules/default/utils_spec.js +++ b/tests/unit/modules/default/utils_spec.js @@ -116,7 +116,6 @@ describe("Default modules utils tests", () => { beforeAll(() => { jest.useFakeTimers(); - moment.tz.setDefault("Europe/Berlin"); }); beforeEach(async () => {