-1

I recently upgraded my project from Angular 13 to Angular 16 Standalone App. Earlier I was using karma for unit testing and now since Angular 16 supports JEST, I have configured the same in my application.

  1. Updated "angular.json" file as below: "test": { "builder": "@angular-devkit/build-angular:jest", "options": { "polyfills": ["zone.js", "zone.js/testing"], "tsConfig": "tsconfig.spec.json" }

  2. Updated "tsconfig.spec.json" as below: "compilerOptions": { "outDir": "./out-tsc/spec", "types": [ "jest", "node" ] },

  3. Uninstalled all karma packages, test.ts and karma.config file.

  4. Installed "jest, jest-environment-jsdom, @types/jest".

  5. Finally, ran "ng test" command.

Now again running getting below error:

Error in terminal

Below is my Environment File image:

Environment File

Below is the "auth.service.spec" file code in which it is showing error: Auth Service Spec

I want to run my Angular 16 standalone project with JEST for unit testing, so I can start working on other test cases.

  • [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551). You can [edit] your question and include the errors and file contents as code blocks. – He3lixxx Sep 02 '23 at 00:51

0 Answers0