Skip to content

Commit 7f8935a

Browse files
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
1 parent 931fe55 commit 7f8935a

2 files changed

Lines changed: 36 additions & 30 deletions

File tree

CHANGELOG.md

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

2223
### Updated
2324

jest.config.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
1-
module.exports = async () => {
2-
return {
3-
verbose: true,
4-
testTimeout: 20000,
5-
testSequencer: "<rootDir>/tests/utils/test_sequencer.js",
6-
projects: [
7-
{
8-
displayName: "unit",
9-
globalSetup: "<rootDir>/tests/unit/helpers/global-setup.js",
10-
moduleNameMapper: {
11-
logger: "<rootDir>/js/logger.js"
12-
},
13-
testMatch: ["**/tests/unit/**/*.[jt]s?(x)"],
14-
testPathIgnorePatterns: ["<rootDir>/tests/unit/mocks", "<rootDir>/tests/unit/helpers"]
1+
const config = {
2+
verbose: true,
3+
testTimeout: 20000,
4+
testSequencer: "<rootDir>/tests/utils/test_sequencer.js",
5+
projects: [
6+
{
7+
displayName: "unit",
8+
globalSetup: "<rootDir>/tests/unit/helpers/global-setup.js",
9+
moduleNameMapper: {
10+
logger: "<rootDir>/js/logger.js"
1511
},
16-
{
17-
displayName: "electron",
18-
testMatch: ["**/tests/electron/**/*.[jt]s?(x)"],
19-
testPathIgnorePatterns: ["<rootDir>/tests/electron/helpers"]
20-
},
21-
{
22-
displayName: "e2e",
23-
testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"],
24-
modulePaths: ["<rootDir>/js/"],
25-
testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers", "<rootDir>/tests/e2e/mocks"]
26-
}
27-
],
28-
collectCoverageFrom: ["./clientonly/**/*.js", "./js/**/*.js", "./modules/default/**/*.js", "./serveronly/**/*.js"],
29-
coverageReporters: ["lcov", "text"],
30-
coverageProvider: "v8"
31-
};
12+
testMatch: ["**/tests/unit/**/*.[jt]s?(x)"],
13+
testPathIgnorePatterns: ["<rootDir>/tests/unit/mocks", "<rootDir>/tests/unit/helpers"]
14+
},
15+
{
16+
displayName: "electron",
17+
testMatch: ["**/tests/electron/**/*.[jt]s?(x)"],
18+
testPathIgnorePatterns: ["<rootDir>/tests/electron/helpers"]
19+
},
20+
{
21+
displayName: "e2e",
22+
testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"],
23+
modulePaths: ["<rootDir>/js/"],
24+
testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers", "<rootDir>/tests/e2e/mocks"]
25+
}
26+
],
27+
collectCoverageFrom: [
28+
"<rootDir>/clientonly/**/*.js",
29+
"<rootDir>/js/**/*.js",
30+
"<rootDir>/modules/default/**/*.js",
31+
"<rootDir>/serveronly/**/*.js"
32+
],
33+
coverageReporters: ["lcov", "text"],
34+
coverageProvider: "v8"
3235
};
36+
37+
module.exports = config;

0 commit comments

Comments
 (0)