# 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.

## 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&

## 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 Blog](<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>), [Databases](<https://devfeed.tech/topics/databases.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>), [ci](<https://devfeed.tech/topics/ci.md>), [Playwright](<https://devfeed.tech/topics/playwright.md>), [Puppeteer](<https://devfeed.tech/topics/puppeteer.md>), [Headless Browser](<https://devfeed.tech/topics/headless-browser.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [web applications](<https://devfeed.tech/topics/web-applications.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.

## 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>), [Testing](<https://devfeed.tech/topics/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...

## 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: [Jest](<https://devfeed.tech/topics/jest.md>), [Cypress](<https://devfeed.tech/topics/cypress.md>), [ci](<https://devfeed.tech/topics/ci.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>), [developer-experience](<https://devfeed.tech/tags/developer-experience.md>), [jest](<https://devfeed.tech/tags/jest.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

This tutorial explains how to parallelize CI test workloads using Jest sharding and CircleCI's split command for Cypress.io integration tests. It describes dividing Jest tests into buckets so separate processes can run subsets concurrently, reducing overall test execution time and developer wait time.

### 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>), [React Hooks](<https://devfeed.tech/topics/react-hooks.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>), [Testing](<https://devfeed.tech/topics/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>), [Testing](<https://devfeed.tech/topics/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>), [Databases](<https://devfeed.tech/topics/databases.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...

## Starting a TypeScript Project in 2021

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

Original publisher: [Read original article](<https://www.metachris.dev/2021/03/bootstrapping-a-typescript-node.js-project/>)

Author: Chris Hager

Published: 2021-03-24T00: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>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [npm](<https://devfeed.tech/topics/npm.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [boilerplate](<https://devfeed.tech/tags/boilerplate.md>), [browser](<https://devfeed.tech/tags/browser.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [es6](<https://devfeed.tech/tags/es6.md>), [esbuild](<https://devfeed.tech/tags/esbuild.md>), [eslint](<https://devfeed.tech/tags/eslint.md>), [github](<https://devfeed.tech/tags/github.md>), [gitlab-ci](<https://devfeed.tech/tags/gitlab-ci.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>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

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

### Source excerpt

Moved to /2021/04/starting-a-typescript-project-in-2021/

## 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>), [Testing](<https://devfeed.tech/topics/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

## 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: [Testing](<https://devfeed.tech/topics/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

## Disguise-Driven Testing: Jest Mocks in Depth

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

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

Author: jsmapr1@gmail.com (Joe Morgan)

Published: 2019-03-28T03:18:25Z

Content type: tutorial

Language: en

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

Topics: [Jest](<https://devfeed.tech/topics/jest.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Code](<https://devfeed.tech/topics/code.md>), [API](<https://devfeed.tech/topics/api.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [external](<https://devfeed.tech/tags/external.md>), [fetch](<https://devfeed.tech/tags/fetch.md>), [jest](<https://devfeed.tech/tags/jest.md>), [json](<https://devfeed.tech/tags/json.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tool](<https://devfeed.tech/tags/tool.md>)

### AI overview

This tutorial explains why impure functions and external dependencies make testing difficult, using date calculations and API data fetching as examples. It presents Jest mocks as a way to replace function results and simplify tests.

### Source excerpt

Testing can be simple. In fact, it is simple. Well, it is simple until impurities slip in. Code that would be easy to test becomes a nightmare as soon as you get impure data (like date checks) or complex external dependencies (such as DOM manipulations or large 3rd party libraries). The part that tends to frustrate developers most is when they have code that's easy to read, easy to write, but difficult to test. No one wants to spend more time on their tests than they do on their code. Consider an example. Let's say you needed to write some code that checks to see if a given date is two weeks from today. If they date is far enough away, you get an empty string. If the date is less than two weeks away, you get an error message: import moment from 'moment'; export const message = 'Date must be two weeks from now' export function isAtLeastTwoWeeks(date) { const isLater = moment(date).isAfter(moment().add(2, 'weeks')); return isLater ? '' : message; } That's pretty simple code. But how do you write a test for it? Things can get tricky fast. Here's an even more basic example. You want to fetch some data from an API and display the first couple items: export function getRecent() { return fetch('/albums') .then(response => response.json()) .then(albums => { return albums .reverse() .slice(0, 2) .map(({title}) => title); }) } Simple to read. Simple to understand. But how would you test it without hitting the live API? There's an unfortunate belief that testing is hard. Early in my career, I heard one developer estimate that it doubled development time. And he was arguing for testing, that it was worth the extra time. The problem is that most testing is easy. But testing impure functions can be very, very difficult. Fortunately, the Jest testing framework has simplified a lot of the complexities behind testing. The secret is a tool called a mock. A mock is effectively a shortened version of a function. Instead of running the function you stub out the result you want. Your cod

## 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 Blog](<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>), [Testing](<https://devfeed.tech/topics/testing.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [ci](<https://devfeed.tech/topics/ci.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.

## 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: [Testing](<https://devfeed.tech/topics/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.

## How to test Vue.js plugins and extensions

DevFeed: [How to test Vue.js plugins and extensions](<https://devfeed.tech/articles/how-to-test-vue-js-plugins-and-extensions-31847.md>)

Original publisher: [Read original article](<https://www.metachris.dev/2017/05/how-to-test-vue.js-plugins-and-extensions/>)

Author: Chris Hager

Published: 2017-05-31T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [Vue.js](<https://devfeed.tech/topics/vue.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Extension](<https://devfeed.tech/topics/extension.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Babel](<https://devfeed.tech/topics/babel.md>)

Tags: [babel](<https://devfeed.tech/tags/babel.md>), [boilerplate](<https://devfeed.tech/tags/boilerplate.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [plugins](<https://devfeed.tech/tags/plugins.md>), [python](<https://devfeed.tech/tags/python.md>), [syntax-highlighting](<https://devfeed.tech/tags/syntax-highlighting.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

A tutorial on testing Vue.js plugins and extensions with real Vue.js instances, state changes, transformation checks, and expected-error validation. It uses Jest examples and discusses linting and transpiling ES6 code to ES5 for compatibility.

### Source excerpt

This post shows how to write tests for Vue.js plugins and extensions by creating Vue.js instances, changing state and validating transformation and expected errors, to continuously verify that everything still works after updates, refactorings and merging contributions. While building python-boilerplate.com, I recently created a Vue.js plugin for syntax highlighting (vue-highlightjs), and wanted to add tests. For this I spent some time researching and testing how to properly test Vue.js plugins and extensions, and I wanted to summarize and share what I've learnt.

## Work&Co Tech Meetup Vol 6

DevFeed: [Work&Co Tech Meetup Vol 6](<https://devfeed.tech/articles/work-co-tech-meetup-vol-6-37376.md>)

Original publisher: [Read original article](<https://muffinman.io/blog/work-co-tech-meetup-vol-6/>)

Author: Stanko

Published: 2017-05-09T00:00:00Z

Content type: news

Language: en

Sources: [Stanko Tadić](<https://devfeed.tech/sources/stanko-tadic.md>)

Topics: [Development](<https://devfeed.tech/topics/development.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [React](<https://devfeed.tech/topics/react.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [React Native](<https://devfeed.tech/topics/react-native.md>)

Tags: [docker](<https://devfeed.tech/tags/docker.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jest](<https://devfeed.tech/tags/jest.md>), [meetup](<https://devfeed.tech/tags/meetup.md>), [react](<https://devfeed.tech/tags/react.md>), [react-native](<https://devfeed.tech/tags/react-native.md>), [tech](<https://devfeed.tech/tags/tech.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

An announcement for Work&Co Tech Meetup Vol 6 in Belgrade, featuring talks on Docker deployment and delivery, JavaScript unit testing with React, Jest, and Enzyme, and an introduction to React Native. The IT Girls team will also discuss the professional development of women in technology in Serbia.

### Source excerpt

Another tech meetup coming up. This time we have three great talks about engineering and project planning. We also have a special guest - IT girls team. The IT Girls team will share their advances in promoting the professional development of women in technology in Serbia. This one will be held on Tuesday, May 16th at Impact Hub Belgrade. See you there! Talks # Docker IRL, Miloš Pavlićević Find out how to incorporate Docker into your deployment/delivery process, with images! (pun intended) Slides Javascript Unit Testing, Sarah Mogin Learn the value of testing your Javascript applications and the tools and techniques for effective testing. We'll focus on how to test React components, selectors, reducers, and sagas using the Jest and Enzyme libraries. Slides Introduction to React Native, Zeh Fernando We had last minute change, and replaced Nemanja's talk (Plan Smart) with Zeh's great introduction to React Native. Slides Photos #