refactor: simplify jest config (#3844)

- changed export from async to sync function - this removes unnecessary
complexity
- reformatted `collectCoverageFrom` to use `<rootDir>` for each pattern
and switch to multi-line style - this is just harmonization
This commit is contained in:
Kristjan ESPERANTO 2025-07-13 21:32:58 +02:00 committed by GitHub
parent 931fe55022
commit 7f8935a34c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 30 deletions

View File

@ -18,6 +18,7 @@ Thanks to: @dathbe.
- [clock] Add CSS to prevent line breaking of sunset/sunrise time display (#3816) - [clock] Add CSS to prevent line breaking of sunset/sunrise time display (#3816)
- [core] Enhance system information logging format and include additional env and RAM details (#3839, #3843) - [core] Enhance system information logging format and include additional env and RAM details (#3839, #3843)
- [refactor] Add new file `js/module_functions.js` to move code used in several modules to one place (#3837) - [refactor] Add new file `js/module_functions.js` to move code used in several modules to one place (#3837)
- [tests] refactor: simplify jest config file (#3844)
### Updated ### Updated

View File

@ -1,32 +1,37 @@
module.exports = async () => { const config = {
return { verbose: true,
verbose: true, testTimeout: 20000,
testTimeout: 20000, testSequencer: "<rootDir>/tests/utils/test_sequencer.js",
testSequencer: "<rootDir>/tests/utils/test_sequencer.js", projects: [
projects: [ {
{ displayName: "unit",
displayName: "unit", globalSetup: "<rootDir>/tests/unit/helpers/global-setup.js",
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)"],
testPathIgnorePatterns: ["<rootDir>/tests/unit/mocks", "<rootDir>/tests/unit/helpers"]
}, },
{ testMatch: ["**/tests/unit/**/*.[jt]s?(x)"],
displayName: "electron", testPathIgnorePatterns: ["<rootDir>/tests/unit/mocks", "<rootDir>/tests/unit/helpers"]
testMatch: ["**/tests/electron/**/*.[jt]s?(x)"], },
testPathIgnorePatterns: ["<rootDir>/tests/electron/helpers"] {
}, displayName: "electron",
{ testMatch: ["**/tests/electron/**/*.[jt]s?(x)"],
displayName: "e2e", testPathIgnorePatterns: ["<rootDir>/tests/electron/helpers"]
testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"], },
modulePaths: ["<rootDir>/js/"], {
testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers", "<rootDir>/tests/e2e/mocks"] displayName: "e2e",
} testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"],
], modulePaths: ["<rootDir>/js/"],
collectCoverageFrom: ["./clientonly/**/*.js", "./js/**/*.js", "./modules/default/**/*.js", "./serveronly/**/*.js"], testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers", "<rootDir>/tests/e2e/mocks"]
coverageReporters: ["lcov", "text"], }
coverageProvider: "v8" ],
}; collectCoverageFrom: [
"<rootDir>/clientonly/**/*.js",
"<rootDir>/js/**/*.js",
"<rootDir>/modules/default/**/*.js",
"<rootDir>/serveronly/**/*.js"
],
coverageReporters: ["lcov", "text"],
coverageProvider: "v8"
}; };
module.exports = config;