Angular with Jest Testing

Nagendra Reddy
1 min readFeb 9, 2022

--

Jest is a painless JavaScript testing platform.

  • Jest is a testing platform, widely adapted by many large companies and swiftly adopted by the React community.
  • Sits on top of Jasmine, so the API is nearly identical.
  • Focuses on Developer Experience (speed and ease of use is the first priority.)
  • Provides meaningful error messages.
  • Runs on Continuous Integration servers without extra tooling (abstracting the DOM with jsdom library.)
  • Provides code coverage out of the box.
  • Integrates with Babel and TypeScript seamlessly.

And what’s most important is that it provides a smart, immersive watch mode. The watch mode runs only tests affected by git file changes — it also runs failed tests first and is able to bail on first error so the feedback loop is ~10x faster than with Karma, depending on test suite size.

Add to application

yarn add --dev jest jest-preset-angular @types/jest

where:

  • jest — Jest testing platform
  • jest-preset-angular — configuration preset with common settings setup for you
  • @types/jest — Jest typings

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet