This project was generated with Angular CLI version 13.2.5.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
- Remove any reference to Jasmine / Karma in the package.json
npm remove <karma karma-chrome-launcher...>
- Install Jest
npm install --save-dev jest jest-preset-angular @types/jest
- Create the
setup-jest.ts
file in the root folder of the project with the following content
import 'jest-preset-angular/setup-jest';
- In the package.json add the following configuration
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": [
"<rootDir>/setup-jest.ts"
],
"globalSetup": "jest-preset-angular/global-setup"
}
- Configurate JEST in tsconfig.json and tsconfig.spec.json
"types": [
"jest"
]
- Configure the commands to run the tests in the package.json
"test": "jest",
"test:watch": "jest --watchAll",
- Remove karma.config.js and the test.ts file