Skip to content

Commit 799abf0

Browse files
authored
fix: test ci error (#291)
1 parent c57b8a5 commit 799abf0

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

jest.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Modules installed by tnpm or cnpm will use underscore as prefix.
2+
// In this case _{module} is also necessary.
3+
const esm = ['d3-*'].map((d) => `_${d}|${d}`).join('|');
4+
5+
module.exports = {
6+
runner: 'jest-electron/runner',
7+
testEnvironment: 'jest-electron/environment',
8+
testTimeout: 30000,
9+
preset: 'ts-jest/presets/js-with-ts',
10+
globals: {
11+
'ts-jest': {
12+
tsconfig: {
13+
allowJs: true,
14+
sourceMap: true,
15+
},
16+
},
17+
},
18+
collectCoverage: false,
19+
testRegex: '/tests/.*-spec\\.ts?$',
20+
// Transform esm to cjs.
21+
transformIgnorePatterns: [`<rootDir>/node_modules/(?!(${esm}))`],
22+
collectCoverageFrom: ['src/**/*.{ts,js}', '!**/node_modules/**', '!**/vendor/**'],
23+
moduleFileExtensions: ['ts', 'js', 'json'],
24+
};

package.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"lint-fix": "run-s lint-fix:*",
3030
"lint-fix:prettier": "prettier --write 'src/**/*.ts'",
3131
"lint-fix:tslint": "tslint -c tslint.json --fix 'src/**/*.ts' 'tests/**/*'",
32-
"coverage": "jest --coverage",
33-
"test": "jest",
32+
"coverage": "jest -w 16 --coverage",
33+
"test": "jest -w 16",
3434
"test-live": "DEBUG_MODE=1 jest --watch tests",
3535
"ci": "run-s build test coverage",
3636
"changelog": "generate-changelog",
@@ -47,13 +47,13 @@
4747
"conventional-changelog-cli": "^2.1.1",
4848
"generate-changelog": "^1.8.0",
4949
"husky": "^3.0.4",
50-
"jest": "^24.9.0",
51-
"jest-electron": "^0.1.6",
50+
"jest": "^26.0.1",
51+
"jest-electron": "^0.1.7",
5252
"lint-staged": "^9.2.3",
5353
"npm-run-all": "^4.1.5",
5454
"prettier": "^1.18.2",
5555
"rimraf": "^3.0.0",
56-
"ts-jest": "^24.1.0",
56+
"ts-jest": "^26.0.0",
5757
"tslint": "^5.18.0",
5858
"tslint-config-prettier": "^1.18.0",
5959
"typescript": "^3.5.3"
@@ -79,17 +79,5 @@
7979
"prettier --write",
8080
"git add"
8181
]
82-
},
83-
"jest": {
84-
"runner": "jest-electron/runner",
85-
"testEnvironment": "jest-electron/environment",
86-
"preset": "ts-jest",
87-
"collectCoverage": false,
88-
"collectCoverageFrom": [
89-
"src/**/*.{ts,js}",
90-
"!**/node_modules/**",
91-
"!**/vendor/**"
92-
],
93-
"testRegex": "/tests/.*spec\\.ts?$"
9482
}
9583
}

0 commit comments

Comments
 (0)