Skip to content

Commit 86781c0

Browse files
committed
test(jest): apply workaround resolver
1 parent ff9d8e2 commit 86781c0

File tree

2 files changed

+30
-35
lines changed

2 files changed

+30
-35
lines changed

jest.config.js

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,26 @@
11
const isWallaby = !!process.env.WALLABY_ENV;
22

33
module.exports = {
4-
"preset": "ts-jest",
5-
"testMatch": [
6-
"**/spec/**/*-spec.ts"
7-
],
8-
"globals": {
9-
"ts-jest": {
10-
"diagnostics": false
11-
}
4+
preset: 'ts-jest',
5+
testMatch: ['**/spec/**/*-spec.ts'],
6+
globals: {
7+
'ts-jest': {
8+
diagnostics: false,
9+
},
1210
},
13-
"bail": true,
14-
"testEnvironment": "node",
15-
"moduleFileExtensions": [
16-
"js",
17-
"jsx",
18-
"json",
19-
"ts",
20-
"tsx"
21-
],
22-
"testPathIgnorePatterns": [
23-
"/.tmp/"
24-
],
25-
"coverageReporters": [
26-
"lcov"
27-
],
28-
reporters: !isWallaby ? [ "jest-spin-reporter" ] : undefined,
29-
"collectCoverageFrom": [
30-
"src/**/*.{ts, tsx}",
31-
"!**/*.d.ts"
11+
resolver: '<rootDir>/spec/exportMapResolver.js',
12+
bail: true,
13+
testEnvironment: 'node',
14+
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
15+
testPathIgnorePatterns: ['/.tmp/'],
16+
coverageReporters: ['lcov'],
17+
reporters: !isWallaby ? ['jest-spin-reporter'] : undefined,
18+
collectCoverageFrom: ['src/**/*.{ts, tsx}', '!**/*.d.ts'],
19+
coveragePathIgnorePatterns: [
20+
'<rootDir>/node_modules/',
21+
'<rootDir>/spec/.*\\.(ts|js)$',
22+
'<rootDir>/build/.*\\.(ts|js)$',
23+
'<rootDir>/src/RxSandbox.ts',
24+
'<rootDir>/src/RxSandboxInstance.ts',
3225
],
33-
"coveragePathIgnorePatterns": [
34-
"<rootDir>/node_modules/",
35-
"<rootDir>/spec/.*\\.(ts|js)$",
36-
"<rootDir>/build/.*\\.(ts|js)$",
37-
"<rootDir>/src/RxSandbox.ts",
38-
"<rootDir>/src/RxSandboxInstance.ts"
39-
]
40-
}
26+
};

spec/exportMapResolver.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// temporary workaround while we wait for https://github.com/facebook/jest/issues/9771
2+
const resolver = require('enhanced-resolve').create.sync({
3+
conditionNames: ['require', 'node', 'default', 'import'],
4+
extensions: ['.js', '.json', '.node', '.ts'],
5+
});
6+
7+
module.exports = function (request, options) {
8+
return resolver(options.basedir, request);
9+
};

0 commit comments

Comments
 (0)