mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
set Timezone Europe/Berlin
in unit tests (#3087)
needed for new formatTime unit tests. Avoiding ugly TZ setting in github workflows, see https://github.com/MichMich/MagicMirror/pull/3073
This commit is contained in:
parent
32192d1698
commit
09f117c3d9
6
.github/workflows/automated-tests.yaml
vendored
6
.github/workflows/automated-tests.yaml
vendored
@ -22,12 +22,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
uses: actions/checkout@v3
|
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 }}"
|
- name: "Use Node.js ${{ matrix.node-version }}"
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
6
.github/workflows/codecov-test-suites.yaml
vendored
6
.github/workflows/codecov-test-suites.yaml
vendored
@ -19,12 +19,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
uses: actions/checkout@v3
|
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"
|
- name: "Install dependencies and run coverage"
|
||||||
run: |
|
run: |
|
||||||
Xvfb :99 -screen 0 1024x768x16 &
|
Xvfb :99 -screen 0 1024x768x16 &
|
||||||
|
@ -12,6 +12,7 @@ _This release is scheduled to be released on 2023-07-01._
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added tests for severonly
|
- Added tests for severonly
|
||||||
|
- Set Timezone `Europe/Berlin` in unit tests (needed for new formatTime tests)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -6,23 +6,24 @@ module.exports = async () => {
|
|||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
displayName: "unit",
|
displayName: "unit",
|
||||||
|
globalSetup: "<rootDir>/tests/unit/helpers/global-setup.js",
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
logger: "<rootDir>/js/logger.js"
|
logger: "<rootDir>/js/logger.js"
|
||||||
},
|
},
|
||||||
testMatch: ["**/tests/unit/**/*.[jt]s?(x)"],
|
testMatch: ["**/tests/unit/**/*.[jt]s?(x)"],
|
||||||
testPathIgnorePatterns: ["<rootDir>/tests/unit/mocks"]
|
testPathIgnorePatterns: ["<rootDir>/tests/unit/mocks", "<rootDir>/tests/unit/helpers"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: "electron",
|
displayName: "electron",
|
||||||
testMatch: ["**/tests/electron/**/*.[jt]s?(x)"],
|
testMatch: ["**/tests/electron/**/*.[jt]s?(x)"],
|
||||||
testPathIgnorePatterns: ["<rootDir>/tests/electron/helpers/"]
|
testPathIgnorePatterns: ["<rootDir>/tests/electron/helpers"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: "e2e",
|
displayName: "e2e",
|
||||||
setupFilesAfterEnv: ["<rootDir>/tests/e2e/helpers/mock-console.js"],
|
setupFilesAfterEnv: ["<rootDir>/tests/e2e/helpers/mock-console.js"],
|
||||||
testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"],
|
testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"],
|
||||||
modulePaths: ["<rootDir>/js/"],
|
modulePaths: ["<rootDir>/js/"],
|
||||||
testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers/", "<rootDir>/tests/e2e/mocks"]
|
testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers", "<rootDir>/tests/e2e/mocks"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
collectCoverageFrom: ["./clientonly/**/*.js", "./js/**/*.js", "./modules/default/**/*.js", "./serveronly/**/*.js"],
|
collectCoverageFrom: ["./clientonly/**/*.js", "./js/**/*.js", "./modules/default/**/*.js", "./serveronly/**/*.js"],
|
||||||
|
3
tests/unit/helpers/global-setup.js
Normal file
3
tests/unit/helpers/global-setup.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = async () => {
|
||||||
|
process.env.TZ = "Europe/Berlin";
|
||||||
|
};
|
@ -116,7 +116,6 @@ describe("Default modules utils tests", () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
moment.tz.setDefault("Europe/Berlin");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user