---
title: "Testing Next.js apps with Jest"
url: https://daily.dev/posts/testing-next-js-apps-with-jest-ldoy2nta9
source_url: https://blog.logrocket.com/testing-next-js-apps-jest/
type: article
source: "LogRocket"
published: 2022-03-29T16:07:40.780Z
updated: 2022-03-29T16:07:40.781Z
tags: ["testing", "nextjs"]
reading_time: 10
upvotes: 20
comments: 3
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing Next.js apps with Jest

**[LogRocket](https://daily.dev/sources/logrocket)** · 10 min read · 20 upvotes · 3 comments

## Summary

Jest is an inbuilt tool to test React apps. Next.js has Jest configuration inbuilt as well, powered by the Rust compiler. In this tutorial, we will learn how to set up Jest with Next by writing a simple test for a calculator app. We will also see what happens when we simulate a test failure.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.logrocket.com/testing-next-js-apps-jest/>

## Community discussion

Top comments from developers on daily.dev.

**@upieez** · 2 upvotes

> in this example, they use data-testid attribute to test if a component has rendered. However, I've read around and see numerous articles stating how we should test our software like how users test and NOT use data-testid as it is an anti-pattern. Does anyone have any thoughts on this?

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#nextjs](https://daily.dev/tags/nextjs)

[View this post on daily.dev](https://daily.dev/posts/testing-next-js-apps-with-jest-ldoy2nta9)
