Encountering an error while trying to execute tests in a repository that has a dual client / server setup. The error seems persistent and I'm unable to move past it.
> jest --debug
{
"configs": [
{
"automock": false,
"cache": true,
"cacheDirectory": "/private/var/folders/ff/6qxxwcg50zq0mr4xzbfbyqyh0000gp/T/jest_dy",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"cwd": "/Users/jsavino/Development/mercury-mail-admin",
"detectLeaks": false,
"detectOpenHandles": false,
"errorOnDeprecated": false,
"extraGlobals": [],
"forceCoverageMatch": [],
"globals": {},
"haste": {
"throwOnModuleCollision": true
},
"injectGlobals": true,
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"js",
"json",
"jsx",
"ts",
"tsx",
"node"
],
"moduleNameMapper": [],
"modulePathIgnorePatterns": [],
"name": "d373cb7a79c783e70b01f44f2dfaf64c",
"prettierPath": "prettier",
"resetMocks": false,
"resetModules": false,
"restoreMocks": false,
"rootDir": "/Users/jsavino/Development/mercury-mail-admin",
"roots": [
"/Users/jsavino/Development/mercury-mail-admin/se...
Repository structure:
package.json
jest.config.js
tsconfig.json
server/ <- Tests files run here (basic express app in typescript)
client/ <- CRA output in typescript, Jest tests work fine here
jest.config.js
module.exports = {
roots: ["<rootDir>/server"],
testMatch: null,
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
testRegex: [],
preset: "ts-jest",
};
tsconfig.json
:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"outDir": "./build",
"rootDir": "./server",
"strict": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": [
"./server"
],
"exclude": [
"client"
]
}
The app works as expected when directly compiled / run.
Dependencies:
"dependencies": {
"@kubernetes/client-node": "^0.14.3",
"body-parser": "^1.18.3",
"connect": "^3.7.0",
"cors": "^2.8.5",
"cronstrue": "^1.112.0",
"express": "^4.17.1",
...
},
"devDependencies": {
"@babel/core": "^7.13.16",
"@types/yamljs": "^0.2.31",
...
}
Struggling with this issue for some time now, any guidance is greatly appreciated. Thank you!