https://www.notion.so/Jest-For-Angular-9c4819ab017847e7b1b8b62376707644
1
npm i --dev jest jest-preset-angular @types/jest
You need to add this entry to package.json
1
2
3
4
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": ["<rootDir>/src/setupJest.ts"]
}
You’re now ready to add this to your npm scripts:
1
2
"test": "jest",
"test:watch": "jest --watch",
Oh, one more thing. Forget about installing PhantomJS on your CI:
1
"test:ci": "jest --runInBand",