Member-only story

Angular & Jest — Here’s how to write your first Angular test

The underwhelming guide to writing your first test for an Angular service using Jest

Daniel Kreider
3 min readOct 4, 2020

Introduction

I remember as an Angular novice the mind-boggling thought of writing tests for my Angular apps.

And then later the guilty feeling of deploying an Angular app multiple times a day without any kind of tests.

Man oh man! Convincing me to write tests for an Angular application would’ve been like trying to force a toddler to eat their peas.

Now, I know I’m not the only guy on the block that used to think like this. Test syndrome is common.

But nail this and you’ll become a honking-powerful, test-cranking Angular wizard.

Installing & Configuring Jest

Installing and configuring Jest can be a thorny job.

It involves changing various config files. And an overlooked comma could make your Angular application sputter like a dying cow.

But fortunate for us a band of developers teamed up and bundled all the needed changes and stuff into a simple Angular package. It does all the magic for you and made me feel like a million bucks when I first took it…

--

--

No responses yet