Jest Preset Angular
A preset of Jest configuration for Angular projects.
This is a part of the article: Testing Angular faster with Jest.
Getting Started
These instructions will get you setup to use jest-preset-angular
in your project. For more detailed documentation,
please check online documentation.
Install using yarn
:
yarn add -D jest jest-preset-angular
Or npm
:
npm install -D jest jest-preset-angular
Configuration
In your project root, create setup-jest.ts
file with following contents:
import 'jest-preset-angular/setup-jest';
Add the following section:
- to your root
jest.config.js
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
};
- or to your root
package.json
{
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": ["<rootDir>/setup-jest.ts"]
}
}
Built With
Authors/maintainers
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details