Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bonejon/angular-jest-wallabyjs
An example repository with all the configuration to use Angular 7 with Jest and WallabyJs. The readme.md contains the steps taken to convert the project from a standard angular-cli project.
https://github.com/bonejon/angular-jest-wallabyjs
angular-cli angular7 angular8 jest sample-project unit-testing wallaby wallabyjs
Last synced: 8 days ago
JSON representation
An example repository with all the configuration to use Angular 7 with Jest and WallabyJs. The readme.md contains the steps taken to convert the project from a standard angular-cli project.
- Host: GitHub
- URL: https://github.com/bonejon/angular-jest-wallabyjs
- Owner: bonejon
- Created: 2019-05-07T10:00:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T05:17:06.000Z (about 2 years ago)
- Last Synced: 2024-12-06T22:12:19.865Z (about 2 months ago)
- Topics: angular-cli, angular7, angular8, jest, sample-project, unit-testing, wallaby, wallabyjs
- Language: TypeScript
- Size: 3.28 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# An Example Project to Incorporate Jest and WallabyJS with Angular CLI
[![Build Status](https://travis-ci.com/bonejon/angular-jest-wallabyjs.svg?branch=master)](https://travis-ci.com/bonejon/angular-jest-wallabyjs)
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.8.
## Steps to get it working
1 - Remove the following entries from devDependencies in package.json
```json
"@types/jasmine": "???",
"@types/jasminewd2": "???",
"jasmine-core": "~???",
"jasmine-spec-reporter": "???",
"karma": "???",
"karma-chrome-launcher": "???",
"karma-coverage-istanbul-reporter": "???",
"karma-jasmine": "???",
"karma-jasmine-html-reporter": "???",
"protractor": "???",
```2 - Add the following entries to devDependencies in package.json
```json
"@angular-builders/jest": "^8.0.3",
"@types/jest": "^24.0.11",
"jest": "^24.8.0",
"jest-html-reporter": "2.5.0",
"jest-preset-angular": "^7.1.1",
"wallaby-webpack": "^3.9.15"
```3 - Optionally, add the following to devDependencies in package.json if the project uses ngrx
```json
"jest-marbles": "^2.3.1",
```4 - Add the following section to package.json
```json
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": [
"/setupJest.ts"
]
},
```5 - Add the following files from the repo and amend as required
```json
setupJest.ts
wallaby.js
jest.config.js
```6 - Edit /src/tsconfig.spec.json and make the following amendments
```json
Add compilerOptions -> "module": "commonjs",
Remove compilerOptions -> types -> jasmine
Remove compilerOptions -> types -> node
Add compilerOptions -> types -> jest
```7 - Modify the package.json to add the following scripts, replacing the standard "test" script
```json
"test": "ng test {project-name} --coverage --watch=false",
"test:update": "ng test {project-name} --coverage --watch=false -u",
"test:watch": "ng test {project-name} --watch --coverage",
"test:coverage": "ng test {project-name} --coverage",
```8 - In angular.json replace the "test" section with the following
```json
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"no-cache": true
}
},
```9 - Delete src/test.ts
10 - modify "filesWithNoCoverageCalculated" in wallaby.js and "collectCoverageFrom" in src/jest.config.js to defined files requiring no coverage