---
title: "Testing in Angular: Replace Karma to Web Test Runner"
date: "2024-04-23"
slug: "testing-in-angular-replace-karma-to-web-test-runner"
author: "Dany Paredes"
canonical: "https://danywalls.com/testing-in-angular-replace-karma-to-web-test-runner"
description: "I was writing an article for Kendo about testing in Angular, but with the deprecation of Karma, I had some questions about the future of testing in Angular. I'm using Jest for my personal and professional projects, along with the Angular testing libr..."
---

I was writing an article for [Kendo](https://www.telerik.com/blogs/author/dany-paredes) about testing in Angular, but with the deprecation of Karma, I had some questions about the future of testing in Angular.

I'm using Jest for my personal and professional projects, along with the Angular testing library. However, Jest doesn't have official support from Angular. I'm using community schematics [jest schematics](https://github.com/briebug/jest-schematic) to configure Jest in my projects or using Nx. In v16, Angular teams began to add ["EXPERIMENTAL"](https://www.danywalls.com/play-with-jest-builder-for-angular-17-experimental) support for Jest, but we haven't received any news or updates.

After talking with [Rainer Hahnekamp](https://hashnode.com/@rainerhahnekamp) and [Brandon Roberts](https://hashnode.com/@brandonroberts), both of them recommended starting to use [web test runner](https://modern-web.dev/docs/test-runner/overview/). In v17, the Angular team added the web-test runner builder in **EXPERIMENTAL**, and it works great. Also, the Angular teams have plans to add [web test runner](https://blog.angular.io/moving-angular-cli-to-jest-and-web-test-runner-ef85ef69ceca) in future versions.

> Read more about [https://modern-web.dev/docs/test-runner/overview/](https://modern-web.dev/docs/test-runner/overview/)

So, I decided to start to play with the web test runner. Let's do it!

## Configure Web Test Runner

First, install the `@web/test-runner` package from the terminal.

```bash
npm i -D @web/test-runner
```

Next, open the `angular.json` file to change the builder to `web-test-runner` in the `test` section.

```json
  "test": {
          "builder": "@angular-devkit/build-angular:web-test-runner",
```

Save changes, and run your tests with `npm run test`, and you will see your tests running using `Jasmine` and `web-test-runner`. 🎉!

![](/images/posts/testing-in-angular-replace-karma-to-web-test-runner/ae54c758-a524-4_76881.png)

It's important to remmeber, [web test runner](https://modern-web.dev/docs/test-runner/overview/) is in **experimental**, but looks highly promising about its future as part of Angular working combined with Jasmine, so we don't need to update or change our tests.

![](/images/posts/testing-in-angular-replace-karma-to-web-test-runner/a2b69462-040f-4_76882.png)

## Future of Angular Testing 👀

I highly recommend take a time to know about the future of testing in Angular watching amazing great videos from @[Rainer Hahnekamp](@rainerhahnekamp) .

### Angular Testing in 2024

<YouTube id="MQd9yRBZSKY" title="Angular Testing in 2024" />

### Angular Testing in 2023: Past, Present, and Future

<YouTube id="4z5IhNdonv8" title="Angular Testing in 2023: Past, Present, and Future" />

