Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonanv/test-jest-angularjs
Test with Jest into Angular v17
https://github.com/jonanv/test-jest-angularjs
angular angular-cli angular17 angular2 javascript jest jest-tests no-standalone typescript
Last synced: 3 months ago
JSON representation
Test with Jest into Angular v17
- Host: GitHub
- URL: https://github.com/jonanv/test-jest-angularjs
- Owner: jonanv
- Created: 2024-08-22T17:33:27.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-03T20:52:08.000Z (4 months ago)
- Last Synced: 2024-10-01T07:22:58.474Z (3 months ago)
- Topics: angular, angular-cli, angular17, angular2, javascript, jest, jest-tests, no-standalone, typescript
- Language: TypeScript
- Homepage:
- Size: 335 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TestJestAngularjs
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.8.
## Steps for configuration Jest
1. Remover cualquier referencia de Jasmine / Karma en el package.json
```js
npm remove @types/jasmine jasmine-core karma karma-chrome-launcher karma-coverage karma-jasmine karma-jasmine-html-reporter
```2. Instalar Jest
```js
npm install --save-dev jest jest-preset-angular @types/jest
```3. Crear el ```setup-jest.ts``` en la carpeta root del proyecto y el contenido es el siguiente
```setup-jest.ts
import 'jest-preset-angular/setup-jest';
```4. Agregar en el package.json, la configuración de Jest
```package.json
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": [
"/setup-jest.ts"
],
"globalSetup": "jest-preset-angular/global-setup"
}
```4. Configurar JEST en tsconfig.json y tsconfig.spec.json
```tsconfig.json
"types": [
"jest"
]
```5. Configurar los comandos para ejecutar las pruebas en el package.json
```package.json
"test": "jest",
"test:watch": "jest --watchAll",
```6. Remover karma.config.js y el archivo test.ts