# Jest

Jest is a JavaScript testing framework designed to ensure the correctness of JavaScript codebases.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Fix "Cannot use import statement outside a module" in JavaScript

DevFeed: [Fix "Cannot use import statement outside a module" in JavaScript](<https://devfeed.tech/articles/fix-cannot-use-import-statement-outside-a-module-in-javascript-84525.md>)

Original publisher: [Read original article](<https://markodenic.com/cannot-use-import-statement-outside-a-module/>)

Author: Marko

Published: 2026-10-10T09:00:00Z

Content type: tutorial

Language: en

Sources: [Marko Denic Blog](<https://devfeed.tech/sources/marko-denic-blog.md>)

Topics: [import](<https://devfeed.tech/topics/import.md>), [CommonJS](<https://devfeed.tech/topics/commonjs.md>), [export](<https://devfeed.tech/topics/export.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Webpack](<https://devfeed.tech/topics/webpack.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [bundlers](<https://devfeed.tech/tags/bundlers.md>), [commonjs](<https://devfeed.tech/tags/commonjs.md>), [esm](<https://devfeed.tech/tags/esm.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

This tutorial explains why JavaScript reports "Cannot use import statement outside a module" and how to resolve it across browsers, Node.js, TypeScript, and Jest. It covers configuring ES modules, using file extensions or `require()`, and handling module system settings in TypeScript and test runners.

### Source excerpt

Why you get "SyntaxError: Cannot use import statement outside a module" and how to fix it in the browser, Node.js, TypeScript and Jest, with the exact change for each case.

## How to use Jest mocks

DevFeed: [How to use Jest mocks](<https://devfeed.tech/articles/how-to-use-jest-mocks-38398.md>)

Original publisher: [Read original article](<https://blog.danlew.net/2026/05/28/how-to-use-jest-mocks/>)

Author: Dan Lew

Published: 2026-05-28T13:10:16Z

Content type: tutorial

Language: en

Sources: [Dan Lew Blog](<https://devfeed.tech/sources/dan-lew-blog.md>)

Topics: [Jest](<https://devfeed.tech/topics/jest.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>)

Tags: [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A practical introduction to Jest mocks covering module mocking, mock hoisting, automock behavior, and configuring mocked return values. It also notes limitations in the documentation and discusses considerations for TypeScript users.

### Source excerpt

For better or worse, my life has become infested by Jest mocks. I come from the land of dependency injection (I even gave a talk once!), but whenever I talk about dependency injection to JavaScript developers I get this reaction: Instead, mocking is king. Unfortunately, I've found Jests&

## React Native 0.85 - New Animation Backend, New Jest Preset Package

DevFeed: [React Native 0.85 - New Animation Backend, New Jest Preset Package](<https://devfeed.tech/articles/react-native-0-85-new-animation-backend-new-jest-preset-package-48134.md>)

Original publisher: [Read original article](<https://reactnative.dev/blog/2026/04/07/react-native-0.85>)

Author: Alan Lee; Calix Tang; Mathieu Acthernoene; Gabriel Donadel Dall'Agnol; Bartłomiej Błoniarz; Dawid Małecki; Zeya Peng; Samuel Susla

Published: 2026-04-07T00:00:00Z

Content type: release

Language: en

Sources: [React Native Blog](<https://devfeed.tech/sources/react-native-blog.md>)

Topics: [React Native](<https://devfeed.tech/topics/react-native.md>), [animations](<https://devfeed.tech/topics/animations.md>), [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [TLS (Transport Layer Security)](<https://devfeed.tech/topics/tls.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [animation](<https://devfeed.tech/tags/animation.md>), [announcement](<https://devfeed.tech/tags/announcement.md>), [announcement-release](<https://devfeed.tech/tags/announcement-release.md>), [devtools](<https://devfeed.tech/tags/devtools.md>), [jest](<https://devfeed.tech/tags/jest.md>), [macos](<https://devfeed.tech/tags/macos.md>), [react-native](<https://devfeed.tech/tags/react-native.md>), [release](<https://devfeed.tech/tags/release.md>)

### AI overview

React Native 0.85 introduces a shared animation backend, moves the Jest preset to a dedicated package, improves React Native DevTools, and adds TLS configuration support for the Metro development server.

### Source excerpt

Today we are excited to release React Native 0.85!

## Testing for Vibe Coders: From Zero to Production Confidence

DevFeed: [Testing for Vibe Coders: From Zero to Production Confidence](<https://devfeed.tech/articles/testing-for-vibe-coders-from-zero-to-production-confidence-692.md>)

Original publisher: [Read original article](<https://supabase.com/blog/testing-for-vibe-coders-from-zero-to-production-confidence>)

Author: Prashant Sridharan

Published: 2025-08-16T07:00:00Z

Content type: tutorial

Language: en

Sources: [Supabase](<https://devfeed.tech/sources/supabase-blog.md>)

Topics: [Supabase](<https://devfeed.tech/topics/supabase.md>), [Playwright](<https://devfeed.tech/topics/playwright.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [API](<https://devfeed.tech/topics/api.md>), [Database](<https://devfeed.tech/topics/database.md>), [Python](<https://devfeed.tech/topics/python.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Security](<https://devfeed.tech/topics/security.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [database](<https://devfeed.tech/tags/database.md>), [development](<https://devfeed.tech/tags/development.md>), [guide](<https://devfeed.tech/tags/guide.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [production](<https://devfeed.tech/tags/production.md>), [python](<https://devfeed.tech/tags/python.md>), [security](<https://devfeed.tech/tags/security.md>), [sql](<https://devfeed.tech/tags/sql.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tools](<https://devfeed.tech/tags/tools.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

A practical guide to building a testing strategy that catches production bugs without making development burdensome. It recommends starting with integration tests for core features, adding unit tests for complex logic, and using end-to-end tests for critical user flows. The article discusses Jest or Vitest, Playwright, Supabase local development, pytest, and pgTAP.

### Source excerpt

Build a testing strategy that prevents production disasters without turning development into a slog. Learn which tests matter, which tools to use, and how to catch bugs before your users do.

## Testing a React App in Chrome with Heroku CI

DevFeed: [Testing a React App in Chrome with Heroku CI](<https://devfeed.tech/articles/testing-a-react-app-in-chrome-with-heroku-ci-26500.md>)

Original publisher: [Read original article](<https://www.heroku.com/blog/testing-react-app-chrome-heroku-ci/>)

Author: Julián Duque

Published: 2024-09-24T20:11:00Z

Content type: tutorial

Language: en

Sources: [Heroku](<https://devfeed.tech/sources/heroku.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>), [Heroku](<https://devfeed.tech/topics/heroku.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [Playwright](<https://devfeed.tech/topics/playwright.md>), [Puppeteer](<https://devfeed.tech/topics/puppeteer.md>), [Headless Browser](<https://devfeed.tech/topics/headless-browser.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [browser](<https://devfeed.tech/tags/browser.md>), [ci](<https://devfeed.tech/tags/ci.md>), [continuous-integration](<https://devfeed.tech/tags/continuous-integration.md>), [developer-tools](<https://devfeed.tech/tags/developer-tools.md>), [download](<https://devfeed.tech/tags/download.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [github](<https://devfeed.tech/tags/github.md>), [google-chrome](<https://devfeed.tech/tags/google-chrome.md>), [guide](<https://devfeed.tech/tags/guide.md>), [heroku](<https://devfeed.tech/tags/heroku.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [react](<https://devfeed.tech/tags/react.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>), [web-applications](<https://devfeed.tech/tags/web-applications.md>)

### AI overview

This tutorial explains how to run end-to-end tests for a React application in Heroku CI using headless Chrome, Jest, and Puppeteer. It covers automating tests for a simple form-based application and configuring the application and test scripts for CI execution.

### Source excerpt

When building web applications, unit testing your individual components is certainly important. However, end-to-end testing provides assurance that the final user experience of your components chained together matches the expected behavior. Testing web application behavior locally in your browser can be helpful, but this approach isn't efficient or reliable, especially as your application grows more [...] The post Testing a React App in Chrome with Heroku CI appeared first on Heroku.

## Bun v0.6.8

DevFeed: [Bun v0.6.8](<https://devfeed.tech/articles/bun-v0-6-8-49338.md>)

Original publisher: [Read original article](<https://bun.com/blog/bun-v0.6.8>)

Author: Colin McDonnell

Published: 2023-06-09T12:00:00Z

Content type: release

Language: en

Sources: [Bun](<https://devfeed.tech/sources/bun-com.md>)

Topics: [Bun](<https://devfeed.tech/topics/bun.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [hashing](<https://devfeed.tech/topics/hashing.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>), [passwords](<https://devfeed.tech/topics/passwords.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [CommonJS](<https://devfeed.tech/topics/commonjs.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Discord.JS](<https://devfeed.tech/topics/discord-js.md>), [Prisma](<https://devfeed.tech/topics/prisma.md>), [Puppeteer](<https://devfeed.tech/topics/puppeteer.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [bun](<https://devfeed.tech/tags/bun.md>), [commonjs](<https://devfeed.tech/tags/commonjs.md>), [curl](<https://devfeed.tech/tags/curl.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [hashing](<https://devfeed.tech/tags/hashing.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [password](<https://devfeed.tech/tags/password.md>), [prisma](<https://devfeed.tech/tags/prisma.md>)

### AI overview

Bun v0.6.8 introduces a JavaScript bundler, performance improvements, native CommonJS support, secure password hashing, function mocking in the test runner, Jest-related compatibility, streaming file uploads, and broader Node.js compatibility. The release also includes debugging, stability, and bug-fix improvements.

### Source excerpt

Password hashing, function mocking, debugging, and bug squashing

## Bun v0.6.6

DevFeed: [Bun v0.6.6](<https://devfeed.tech/articles/bun-v0-6-6-49336.md>)

Original publisher: [Read original article](<https://bun.com/blog/bun-v0.6.6>)

Author: Ashcon Partovi

Published: 2023-05-31T17:56:51Z

Content type: release

Language: en

Sources: [Bun](<https://devfeed.tech/sources/bun-com.md>)

Topics: [Bun](<https://devfeed.tech/topics/bun.md>), [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [CommonJS](<https://devfeed.tech/topics/commonjs.md>), [fetch](<https://devfeed.tech/topics/fetch.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [cURL](<https://devfeed.tech/topics/curl.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [bug-fixes](<https://devfeed.tech/tags/bug-fixes.md>), [bun](<https://devfeed.tech/tags/bun.md>), [commonjs](<https://devfeed.tech/tags/commonjs.md>), [curl](<https://devfeed.tech/tags/curl.md>), [fetch](<https://devfeed.tech/tags/fetch.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [test](<https://devfeed.tech/tags/test.md>)

### AI overview

Bun v0.6.6 adds improvements to bun test, including GitHub Actions support, selective and conditional test execution, timeouts, and additional matchers. It also introduces streaming file uploads with fetch and includes bug fixes.

### Source excerpt

Lots of improvements to `bun test`, including Github Actions support, `bun test --only`, `test.if()`, `describe.skip()`, and more matchers

## Testing API Calls With React Testing Library and Jest

DevFeed: [Testing API Calls With React Testing Library and Jest](<https://devfeed.tech/articles/testing-api-calls-with-react-testing-library-and-jest-37594.md>)

Original publisher: [Read original article](<https://www.taniarascia.com/how-to-test-useeffect-api-call/>)

Author: hello@taniarascia.com

Published: 2022-12-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tania Rascia](<https://devfeed.tech/sources/tania-rascia.md>)

Topics: [testing-library](<https://devfeed.tech/topics/testing-library.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [React](<https://devfeed.tech/topics/react.md>), [API](<https://devfeed.tech/topics/api.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Webpack](<https://devfeed.tech/topics/webpack.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [jest](<https://devfeed.tech/tags/jest.md>), [react](<https://devfeed.tech/tags/react.md>), [testing](<https://devfeed.tech/tags/testing.md>), [testing-library](<https://devfeed.tech/tags/testing-library.md>), [webpack](<https://devfeed.tech/tags/webpack.md>)

### AI overview

A tutorial showing how to test React useEffect API calls with Jest and React Testing Library, including tests for successful and failed requests.

### Source excerpt

Ever since Hooks were released in React, we've been using the hook to fetch data, whether directly or abstracted away behind Redux Thunks...

## Bun v0.3.0

DevFeed: [Bun v0.3.0](<https://devfeed.tech/articles/bun-v0-3-0-49317.md>)

Original publisher: [Read original article](<https://bun.com/blog/bun-v0.3.0>)

Author: Ashcon Partovi

Published: 2022-12-07T06:00:00Z

Content type: release

Language: en

Sources: [Bun](<https://devfeed.tech/sources/bun-com.md>)

Topics: [Bun](<https://devfeed.tech/topics/bun.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [Filesystems](<https://devfeed.tech/topics/filesystems.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Encoding](<https://devfeed.tech/topics/encoding.md>), [npm](<https://devfeed.tech/topics/npm.md>), [Web APIs](<https://devfeed.tech/topics/web-apis.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [automatic](<https://devfeed.tech/tags/automatic.md>), [blog](<https://devfeed.tech/tags/blog.md>), [bun](<https://devfeed.tech/tags/bun.md>), [compatibility](<https://devfeed.tech/tags/compatibility.md>), [encoding](<https://devfeed.tech/tags/encoding.md>), [faster](<https://devfeed.tech/tags/faster.md>), [file-system](<https://devfeed.tech/tags/file-system.md>), [jest](<https://devfeed.tech/tags/jest.md>), [memory](<https://devfeed.tech/tags/memory.md>)

### AI overview

Bun v0.3.0 focuses on stability and compatibility with Node.js and Web APIs. The release reduces memory use under load, improves text encoding, expands Linux support, fixes bugs and crashes, adds Node.js and other APIs, and introduces automatic package installation from npm.

### Source excerpt

Massive reduction in memory usage, faster text encoding, improved Jest compatibility, file-system routing, automatic package installs, and a lot more

## Parallelizing Jest and Cypress.io Tests on CircleCI

DevFeed: [Parallelizing Jest and Cypress.io Tests on CircleCI](<https://devfeed.tech/articles/parallelizing-jest-and-cypress-io-tests-on-circleci-19162.md>)

Original publisher: [Read original article](<https://artsy.github.io/blog/2022/09/07/quick-tips-to-speed-up-ci/>)

Published: 2022-09-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [Artsy](<https://devfeed.tech/sources/artsy.md>)

Topics: [dynamic test splitting](<https://devfeed.tech/topics/dynamic-test-splitting.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [CircleCI](<https://devfeed.tech/topics/circleci.md>), [Test automation](<https://devfeed.tech/topics/test-automation.md>), [Smoke Tests](<https://devfeed.tech/topics/smoke-tests.md>), [Developer experience](<https://devfeed.tech/topics/developer-experience.md>)

Tags: [ci](<https://devfeed.tech/tags/ci.md>), [circleci](<https://devfeed.tech/tags/circleci.md>), [cypress](<https://devfeed.tech/tags/cypress.md>), [integration](<https://devfeed.tech/tags/integration.md>), [jest](<https://devfeed.tech/tags/jest.md>), [sharding](<https://devfeed.tech/tags/sharding.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

The excerpt presents test parallelization as a way to shorten CI feedback cycles. For Jest, sharding divides a test suite into numbered buckets so separate CI jobs can run different subsets; this avoids manually creating folder-specific jobs and conditions. The excerpt illustrates five buckets for 100 tests, with each bucket covering 20, but does not include the full setup. It also introduces CircleCI's split command as a free way to parallelize Cypress.io integration tests, without describing its steps or limitations in the supplied text.

### Source excerpt

At Artsy, exploring ways to improve the developer experience is part of our makeup. Whether it's implementing hot-swapping for Express.js or integrating the Rust-based SWC compiler into our front-end build pipeline, we're always trying to reduce the amount of time it takes for a code cycle to take place. CI is no exception. When a developer opens a PR, we want to ensure they get timely feedback. Do their unit tests pass? Does the app build correctly? And how about smoke tests? Each of these jobs are complex processes that take time, and the more one can parallelize said tasks the less devs will need to wait. Scaled out to a whole engineering org, minor improvements to CI can be radical. In this regard, two things came across our radar recently that we'd like to share: sharding via Jest, and a (free) way to parallelize Cypress.io integration tests via CircleCI's split command. Sharding in Jest "What is sharding?" Good question! In short, it means "a small part of a whole". The database community has employed sharding techniques for decades, where a large database is split up into smaller, more manageable chunks, usually to improve performance at scale. The same idea can be applied to any process or task involving a lot of data, including tests. Think about it like this. Imagine an app that has thousands of tests. One can open up their terminal and run yarn test and execute all of the tests at once in a single process, or one can open two terminal tabs and run yarn test src/utils and yarn test src/routes, and have both processes allocate a pool of memory to complete each (smaller) subset of tasks. Because each process has its own memory pool the performance characteristics are generally better, and thus the overall time required to run our tests is reduced / decreased. Running each of these commands scoped to a particular folder is easy enough, but in a CI environment this is somewhat cumbersome; we'd need to define two new jobs and then the conditions in which they r

## How to Structure and Organize a React Application

DevFeed: [How to Structure and Organize a React Application](<https://devfeed.tech/articles/how-to-structure-and-organize-a-react-application-37602.md>)

Original publisher: [Read original article](<https://www.taniarascia.com/react-architecture-directory-structure/>)

Author: hello@taniarascia.com

Published: 2021-06-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tania Rascia](<https://devfeed.tech/sources/tania-rascia.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>), [structure](<https://devfeed.tech/topics/structure.md>), [Redux](<https://devfeed.tech/topics/redux.md>), [React Router](<https://devfeed.tech/topics/react-router.md>), [styled-components](<https://devfeed.tech/topics/styled-components.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [testing-library](<https://devfeed.tech/topics/testing-library.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [css](<https://devfeed.tech/tags/css.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [react](<https://devfeed.tech/tags/react.md>), [react-hooks](<https://devfeed.tech/tags/react-hooks.md>), [react-router](<https://devfeed.tech/tags/react-router.md>), [redux](<https://devfeed.tech/tags/redux.md>), [state-management](<https://devfeed.tech/tags/state-management.md>), [structure](<https://devfeed.tech/tags/structure.md>)

### AI overview

This tutorial presents an opinionated, feature-focused directory structure for organizing large-scale production React applications. It explains how to separate global shared components from feature-specific code and discusses accompanying choices for Redux, React Router, styling, testing, and authentication.

### Source excerpt

There is no consensus on the right way to organize a React application. React gives you a lot of freedom, but with that freedom comes the...

## Starting a TypeScript Project in 2021

DevFeed: [Starting a TypeScript Project in 2021](<https://devfeed.tech/articles/starting-a-typescript-project-in-2021-31858.md>)

Original publisher: [Read original article](<https://www.metachris.dev/2021/04/starting-a-typescript-project-in-2021/>)

Author: Chris Hager

Published: 2021-04-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Chris Hager](<https://devfeed.tech/sources/chris-hager.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [npm](<https://devfeed.tech/topics/npm.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [GitLab](<https://devfeed.tech/topics/gitlab.md>)

Tags: [api-documentation](<https://devfeed.tech/tags/api-documentation.md>), [boilerplate](<https://devfeed.tech/tags/boilerplate.md>), [browser](<https://devfeed.tech/tags/browser.md>), [es6](<https://devfeed.tech/tags/es6.md>), [esbuild](<https://devfeed.tech/tags/esbuild.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [gitlab](<https://devfeed.tech/tags/gitlab.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [npm](<https://devfeed.tech/tags/npm.md>), [project](<https://devfeed.tech/tags/project.md>), [setup](<https://devfeed.tech/tags/setup.md>), [template](<https://devfeed.tech/tags/template.md>), [testing](<https://devfeed.tech/tags/testing.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

A practical guide to starting a TypeScript 4 project with modern tooling, covering project setup, esbuild bundling, linting, Jest testing, npm publishing, continuous integration, and automatic API documentation.

### Source excerpt

This is a guide for starting a TypeScript project in 2021 with modern tooling. TypeScript 4 Optionally esbuild to bundle for browsers (and Node.js) Linting with typescript-eslint (tslint is deprecated) Testing with Jest (and ts-jest) Publishing a package to npm Continuous integration (GitHub Actions / GitLab CI) Automatic API documentation with TypeDoc

## Integration Tests with Jest, Supertest, Knex, and Objection in TypeScript

DevFeed: [Integration Tests with Jest, Supertest, Knex, and Objection in TypeScript](<https://devfeed.tech/articles/integration-tests-with-jest-supertest-knex-and-objection-in-typescript-37595.md>)

Original publisher: [Read original article](<https://www.taniarascia.com/integration-testing-with-jest-typescript-objection/>)

Author: hello@taniarascia.com

Published: 2021-04-06T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tania Rascia](<https://devfeed.tech/sources/tania-rascia.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [API](<https://devfeed.tech/topics/api.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Express](<https://devfeed.tech/topics/express.md>), [Database](<https://devfeed.tech/topics/database.md>), [migration](<https://devfeed.tech/topics/migration.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [database-migration](<https://devfeed.tech/tags/database-migration.md>), [express](<https://devfeed.tech/tags/express.md>), [integration](<https://devfeed.tech/tags/integration.md>), [integration-test](<https://devfeed.tech/tags/integration-test.md>), [jest](<https://devfeed.tech/tags/jest.md>), [node](<https://devfeed.tech/tags/node.md>), [orm](<https://devfeed.tech/tags/orm.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

This article presents an approach to integration testing for a TypeScript Node/Express API using Jest, Supertest, Knex, and Objection.js. It covers test setup and teardown, database creation, migrations, seeding, real API calls, and successful and error responses.

### Source excerpt

Recently, I set up unit and integration tests for a Node API in TypeScript, and I couldn't find a lot of resources for setting up and...

## Testing React Query

DevFeed: [Testing React Query](<https://devfeed.tech/articles/testing-react-query-48237.md>)

Original publisher: [Read original article](<https://tkdodo.eu/blog/testing-react-query>)

Published: 2021-04-04T00:00:00Z

Content type: tutorial

Language: en

Sources: [TkDodo](<https://devfeed.tech/sources/tkdodo-s-blog.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [React](<https://devfeed.tech/topics/react.md>), [hooks](<https://devfeed.tech/topics/hooks.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>), [state-management](<https://devfeed.tech/topics/state-management.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Cypress](<https://devfeed.tech/topics/cypress.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [cypress](<https://devfeed.tech/tags/cypress.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jest](<https://devfeed.tech/tags/jest.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [react](<https://devfeed.tech/tags/react.md>), [state-management](<https://devfeed.tech/tags/state-management.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A practical guide to testing React Query hooks and components. It explains how to provide isolated QueryClientProvider instances, avoid dependence on a live backend, and use Mock Service Worker to mock REST and GraphQL requests across tests, Storybook, browser development, and Cypress.

### Source excerpt

Let's take a look at how to efficiently test custom useQuery hooks and components using them.

## Testing event listeners in JavaScript

DevFeed: [Testing event listeners in JavaScript](<https://devfeed.tech/articles/testing-event-listeners-in-javascript-52564.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/testing-event-listeners-javascript/>)

Published: 2020-07-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [event](<https://devfeed.tech/tags/event.md>), [event-listeners](<https://devfeed.tech/tags/event-listeners.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A test can pass without checking an event if its only assertion sits inside a listener callback that never runs. The excerpt recommends deliberately making each new test fail once, then offers two Jest fixes: `expect.assertions(1)` catches a missing assertion, while a `jest.fn()` spy lets the test assert that the handler ran once and received the expected data. The spy approach produces a more specific failure message. The final example follows arrange, act, assert: set up the page and spy, register the handler and make the request, then assert call count and arguments. SinonJS is suggested for spies when not using Jest.

### Source excerpt

Testing JavaScript code that's asynchronous can prevent its own set of challenges that you have to ensure you deal with when writing your tests. I recently came across a test that fell foul to the asynchronous code it was trying to test and in this post I'll show you how to look out for these tests and how to fix it. The problem Let's imagine we're working on an API that lets you make requests to load pages in a web browser. We have a Page class that provides the makeRequest method that will emit a request_started event: const EventEmitter = require('events') class Page extends EventEmitter { makeRequest(url) { this.emit('request_started', { url }) } } This means any other part of this codebase can listen out for these events: page.on('request_started', () => { /* do something here */ }) This is useful functionality, so let's write a test for it: describe('Page class', () => { it('emits an event when a request is started', () => { const page = new Page() page.on('request_started', (data) => { expect(data.url).toEqual('www.foo.com') }) page.makeRequest('www.foo.com') }) }) This test passes, but it's hiding a problem. What happens if we deliberately break it? If we remove the this.emit line, look what the test outputs: PASS src/site/code-for-posts/async-tests/async-tests.test.js Page class ✓ emits an event when a request is started (6 ms) This is less good 😒. But why does it pass? If we take a look at the test body, think about what happens when the request_started event never fires. Which of the lines below will end up being executed? it('emits an event when a request is started', () => { const page = new Page() page.on('request_started', (data) => { expect(data.url).toEqual('www.foo.com') }) page.makeRequest('www.foo.com') }) Because our expect call is within the event listener callback, it never runs if the event never fires! This is problematic because most test frameworks assume a test that doesn't explicitly fail is passing. Most test frameworks won't notify you

## Debug Jest with VSCode

DevFeed: [Debug Jest with VSCode](<https://devfeed.tech/articles/debug-jest-with-vscode-21367.md>)

Original publisher: [Read original article](<https://juri.dev/blog/2020/05/vscode-debug-jest/>)

Published: 2020-05-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [Jest](<https://devfeed.tech/topics/jest.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Angular](<https://devfeed.tech/topics/angular.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [jest](<https://devfeed.tech/tags/jest.md>), [nx](<https://devfeed.tech/tags/nx.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tooling](<https://devfeed.tech/tags/tooling.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>), [vscode](<https://devfeed.tech/tags/vscode.md>)

### AI overview

This tutorial explains how to debug Jest unit tests with Visual Studio Code. It contrasts Jest's Node and JSDOM-based execution with browser-based Karma debugging and describes using a VSCode launch configuration, including in Angular CLI projects.

### Source excerpt

Lorem ipsum dolor sit amet

## Fix the "not wrapped in act(...)" warning

DevFeed: [Fix the "not wrapped in act(...)" warning](<https://devfeed.tech/articles/fix-the-not-wrapped-in-act-warning-51764.md>)

Original publisher: [Read original article](<https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning>)

Published: 2020-02-03T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kent C. Dodds Blog](<https://devfeed.tech/sources/kent-c-dodds-blog.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [testing-library](<https://devfeed.tech/topics/testing-library.md>), [hooks](<https://devfeed.tech/topics/hooks.md>), [async](<https://devfeed.tech/topics/async.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Promise](<https://devfeed.tech/topics/promise.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [jest](<https://devfeed.tech/tags/jest.md>), [react](<https://devfeed.tech/tags/react.md>), [testing](<https://devfeed.tech/tags/testing.md>), [testing-library](<https://devfeed.tech/tags/testing-library.md>)

### AI overview

A tutorial explains React's "not wrapped in act(...)" warning in component tests. It shows how incomplete tests can miss asynchronous updates and how act wrappers and React Testing Library's async utilities help detect regressions.

### Source excerpt

There are a few reasons you're getting this warning. Here's how you fix it.

## Write fewer, longer tests

DevFeed: [Write fewer, longer tests](<https://devfeed.tech/articles/write-fewer-longer-tests-51927.md>)

Original publisher: [Read original article](<https://kentcdodds.com/blog/write-fewer-longer-tests>)

Published: 2019-08-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kent C. Dodds Blog](<https://devfeed.tech/sources/kent-c-dodds-blog.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [React](<https://devfeed.tech/topics/react.md>)

Tags: [isolation](<https://devfeed.tech/tags/isolation.md>), [one-assertion-per-test](<https://devfeed.tech/tags/one-assertion-per-test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

A testing article argues that combining related assertions into fewer, longer tests can improve isolation, avoid shared mutable state, reduce nesting, and make failures easier to diagnose in Jest and React tests.

### Source excerpt

Making tests too short often leads to poor testing practices and way more tests.

## Avoid Nesting when you're Testing

DevFeed: [Avoid Nesting when you're Testing](<https://devfeed.tech/articles/avoid-nesting-when-you-re-testing-51733.md>)

Original publisher: [Read original article](<https://kentcdodds.com/blog/avoid-nesting-when-youre-testing>)

Author: Kent C Dodds

Published: 2019-07-29T00:00:00Z

Content type: article

Language: en

Sources: [Kent C. Dodds Blog](<https://devfeed.tech/sources/kent-c-dodds-blog.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [React](<https://devfeed.tech/topics/react.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [hooks](<https://devfeed.tech/topics/hooks.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [nesting](<https://devfeed.tech/tags/nesting.md>), [react](<https://devfeed.tech/tags/react.md>), [react-component](<https://devfeed.tech/tags/react-component.md>), [reuse](<https://devfeed.tech/tags/reuse.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This article explains why nested tests and hooks such as beforeEach can make test suites harder to maintain. Using React component tests as an example, it recommends avoiding unnecessary abstractions and nesting so developers spend less effort tracing setup, variables, and reassignment.

### Source excerpt

Why using hooks like beforeEach as a mechanism for code reuse leads to unmaintainable tests and how to avoid it.

## Disguise Driven Testing: Jest Mocks In Depth -- Part 2

DevFeed: [Disguise Driven Testing: Jest Mocks In Depth -- Part 2](<https://devfeed.tech/articles/disguise-driven-testing-jest-mocks-in-depth-part-2-21876.md>)

Original publisher: [Read original article](<https://ponyfoo.com/articles/disguise-driven-testing-jest-mocks-in-depth-part-2>)

Author: jsmapr1@gmail.com (Joe Morgan)

Published: 2019-04-22T09:26:23Z

Content type: tutorial

Language: en

Sources: [Pony Foo](<https://devfeed.tech/sources/pony-foo.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>), [Code](<https://devfeed.tech/topics/code.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [function](<https://devfeed.tech/tags/function.md>), [jest](<https://devfeed.tech/tags/jest.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This tutorial explains how Jest mocks can isolate external data, side effects, impurities, and third-party dependencies so tests remain consistent and predictable. It demonstrates testing an employee-creation function whose default fields can be overridden while its generated key is treated as incidental.

### Source excerpt

Mocks are a great way of preventing AJAX calls in tests, but they can also help you isolate side effects and impurities that can create complicated tests. As you learned in Part 1, mocks are a great way to handle external data or any data that is likely to change. Mocking external data will likely be your most common use case and for a good reason. You want your tests to stick as closely to your code as possible this includes all dependencies. Still, there are times when a dependency creates a testing specific problem. In other words, the code works as you would want it to in production, but in a testing environment can make consistent, predictable tests hard or nearly impossible. Some of your third party code may have side effects or some form of impurity that will complicate your testing. Maybe the code has certain expectations of the DOM. Maybe it will change slightly depending on the order of operations. In all cases, the code is out of your control, but you need it to be predictable. Creating Predictable Outcomes with Mocks Suppose you have an application that manages employees or users. You need to make a simple function that will create a new employee, but you want to make sure that the employee always contains certain fields and will have a unique id. Your code will look something like this: import uniqueId from 'lodash/uniqueId' export function createEmployee(details) { return { name: '', position: '', ...details, key: uniqueId() } } In this case, you are using the Lodash method uniqueId to, well, create a unique ID. Specifically you are creating a key that you can use if you do any manipulations on an array of employees. The key, though, is a minor thing. For the most part, your tests should focus on other aspects of your code such as ensuring default fields while allowing those fields to override. Here are two simple tests. import { createEmployee, } from './utils' describe('createEmployee', () => { it('should create a blank employee', () => { const blank

## Testing React with Kent C. Dodds

DevFeed: [Testing React with Kent C. Dodds](<https://devfeed.tech/articles/testing-react-with-kent-c-dodds-52566.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/testing-react-with-kent-c-dodds/>)

Published: 2018-09-17T00:00:00Z

Content type: comparison

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>)

Tags: [jest](<https://devfeed.tech/tags/jest.md>), [react](<https://devfeed.tech/tags/react.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

The hour-long conversation compares the hosts' approaches to testing React applications, including areas of agreement and differing opinions. It mentions approaches, libraries, and resources that shaped their testing philosophies, but the supplied text does not specify which ones or describe practical testing steps.

### Source excerpt

I'm sure that Kent needs no introduction, he's a prolific contributor to the React community and ecosystem. One of the things he talks a lot about is testing, which just so happens to be one of my favourite topics, too! In this hour long hangout, Kent and I compared our approaches, both where they align and where we have slightly different opinions. If you're interested in hearing a deep dive on how to test React applications, this should really help. We mention different approaches, libraries and resources that have helped us get started with and improve our respective testing philosophies. Don't forget, if you are after some more testing resources, that my Testing React with Enzyme and Jest course is available now!

## Unit testing for Node.js Serverless projects with Jest

DevFeed: [Unit testing for Node.js Serverless projects with Jest](<https://devfeed.tech/articles/unit-testing-for-node-js-serverless-projects-with-jest-14456.md>)

Original publisher: [Read original article](<https://www.serverless.com/blog/unit-testing-nodejs-serverless-jest>)

Author: Eslam Hefnawy

Published: 2018-07-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Serverless](<https://devfeed.tech/sources/serverless-blog.md>)

Topics: [Jest](<https://devfeed.tech/topics/jest.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [serverless framework](<https://devfeed.tech/topics/serverless-framework.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>)

Tags: [aws](<https://devfeed.tech/tags/aws.md>), [aws-lambda](<https://devfeed.tech/tags/aws-lambda.md>), [ci](<https://devfeed.tech/tags/ci.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [faas](<https://devfeed.tech/tags/faas.md>), [function-as-a-service](<https://devfeed.tech/tags/function-as-a-service.md>), [infrastructure-as-code](<https://devfeed.tech/tags/infrastructure-as-code.md>), [jest](<https://devfeed.tech/tags/jest.md>), [js](<https://devfeed.tech/tags/js.md>), [node](<https://devfeed.tech/tags/node.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [serverless](<https://devfeed.tech/tags/serverless.md>), [serverless-architecture](<https://devfeed.tech/tags/serverless-architecture.md>), [serverless-framework](<https://devfeed.tech/tags/serverless-framework.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

A tutorial on creating unit tests for Node.js serverless projects with Jest and the Serverless Framework, including running tests in CI and following serverless testing best practices.

### Source excerpt

Create unit tests for Node.js using the Serverless Framework, run tests on CI, and check off our list of serverless testing best practices.

## Test Isolation with React

DevFeed: [Test Isolation with React](<https://devfeed.tech/articles/test-isolation-with-react-51886.md>)

Original publisher: [Read original article](<https://kentcdodds.com/blog/test-isolation-with-react>)

Published: 2018-07-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kent C. Dodds Blog](<https://devfeed.tech/sources/kent-c-dodds-blog.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [React Native](<https://devfeed.tech/topics/react-native.md>), [Maintainability](<https://devfeed.tech/topics/maintainability.md>), [reliability-engineering](<https://devfeed.tech/topics/reliability-engineering.md>), [testing-library](<https://devfeed.tech/topics/testing-library.md>), [Jest](<https://devfeed.tech/topics/jest.md>)

Tags: [coverage](<https://devfeed.tech/tags/coverage.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [isolation](<https://devfeed.tech/tags/isolation.md>), [jest](<https://devfeed.tech/tags/jest.md>), [maintainability](<https://devfeed.tech/tags/maintainability.md>), [react](<https://devfeed.tech/tags/react.md>), [reliability](<https://devfeed.tech/tags/reliability.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

A tutorial on isolating React tests so they do not share mutable component state. It explains how independent test instances improve reliability, simplify refactoring and debugging, and increase confidence, using React Testing Library and Jest practices.

### Source excerpt

Why your tests should be completely isolated from one another and how to do that.

## Testing Apollo's Query Component

DevFeed: [Testing Apollo's Query Component](<https://devfeed.tech/articles/testing-apollo-s-query-component-23530.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/testing-apollos-query-component-d575dc642e04>)

Author: Jake Dawkins

Published: 2018-06-14T22:48:16Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [apollo-client](<https://devfeed.tech/topics/apollo-client.md>), [React](<https://devfeed.tech/topics/react.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>)

Tags: [apollo-client](<https://devfeed.tech/tags/apollo-client.md>), [frontend](<https://devfeed.tech/tags/frontend.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [jest](<https://devfeed.tech/tags/jest.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [react](<https://devfeed.tech/tags/react.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A practical guide to testing React components that use Apollo Client. It explains why direct backend requests make tests unpredictable and introduces testing utilities, including MockedProvider, to provide controlled test conditions.

### Source excerpt

We've been working on a new guides and best practices site for Apollo and GraphQL that covers some of the most important topics we've heard from our users. This post reproduces part of the Testing React Components article, and if you'd like to read more about testing (including mutation components), and other best practices, check out the full article on the site! As always, we're grateful to the community help that makes Apollo possible.

[Next page](<https://devfeed.tech/topics/jest.md?cursor=WyIyMDE4LTA2LTE0VDIyOjQ4OjE2KzAwOjAwIiwgImYyOGM3M2E1LTg0YmQtNDAwNS1hMGEwLTkzMWJjMmY2Y2FmYSJd>)