I am trying to integrate jest for my angular project for unit testing.
I followed the instructions from this link.
I am facing a weird error as ENOENT: no such file or directory, open 'E:\source-code\packages\core\src\view\ng_module.ts'
when i run.
My folder structure doesnt have a folder named package.After a lot of digging i found that packages\core\src\view\ng_module.ts'
is used by a npm package(angular :P)
i dont know how this error is being thrown which doesnt happen when i run through karma
This is my config for jest
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts",
"globals": {
"ts-jest": {
"tsConfigFile": "src/tsconfig.spec.json",
"useBabelrc": true
},
"__TRANSFORM_HTML__": true
},
"transform": {
"^.+\\.(ts|html)$": "<rootDir>/node_modules/jest-preset-angular/preprocessor.js",
"^.+\\.js$": "babel-jest"
},
"transformIgnorePatterns": [
"<rootDir>/node_modules/(?!(@ngrx|ngx-dialog|ng-infinity))"
]
}