npm i --dev jest jest-preset-angular @types/jest

You need to add this entry to package.json

"jest": {
  "preset": "jest-preset-angular",
  "setupFilesAfterEnv": ["<rootDir>/src/setupJest.ts"]
}

You’re now ready to add this to your npm scripts:

"test": "jest",
"test:watch": "jest --watch",

Oh, one more thing. Forget about installing PhantomJS on your CI:

"test:ci": "jest --runInBand",