For those who are facing this issue in 2022. Please add this code in your
`jest-unit.json (or your jest config json file)`.
"moduleDirectories": ["<rootDir>/../", "node_modules"]
Result:
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": "..spec.ts$",
"transform": {
"^.+.(t|j)s$": "ts-jest"
},
"moduleDirectories": ["<rootDir>/../", "node_modules"]
}
@Primajin In my case, all works without any errors.
How I use this parameter in package.json:
"test": "react-scripts test --transformIgnorePatterns "node_modules/(?!ui-core)/" --env=jsdom"