Jest
Jest is a JavaScript testing framework for defining, running, and asserting automated tests.
The Art of Unit Testing 3e
Jest is a JavaScript testing framework that provides facilities for writing, running, and reporting tests.
- How it is used
- Provides one JavaScript framework for writing assertions, running tests, and reporting their results.
- How deep it goes
- Works through setup, execution, test structure, reporting, and module fakes, while deferring detailed isolation facilities beyond the initial tests.
- Examples
- Uses a passing and failing greeting test and a password verifier with stubbed configuration and a mocked logger.
- What you can do after
- Apply it via Jest to run and organize tests, inspect failures, watch changes, and fake imported dependencies.
Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform
Jest is a JavaScript testing framework for running automated tests.
- How it is used
- Tests JavaScript libraries and individual microservices as part of an automated testing workflow.
- How deep it goes
- Walks through installation, configuration, test discovery, execution, watch mode, and mocked dependencies, while leaving other Jest features unexplored.
- Examples
- Uses a JavaScript math library and a metadata microservice whose startup and video route are tested with mocked dependencies.
- What you can do after
- Apply it via Jest to run and watch JavaScript tests and test microservice behavior with mocked dependencies.
Modern Angular
Jest is a JavaScript testing framework and test runner for executing automated tests, typically in a Node.js environment.
- How it is used
- Executes Angular unit tests and reports their results within a Node.js-based testing environment.
- How deep it goes
- Provides setup files, project configuration, lifecycle structure, and component examples, but defers comprehensive service and browser-API testing.
- Examples
- Uses AppComponent specs, TestBed fixtures, ng test, configuration files, HttpClient failures, and Karma-to-Jest migration exercises.
- What you can do after
- Operate Jest through Angular configuration, run specs with ng test, and migrate existing Karma-based tests while diagnosing setup failures.
Contract Testing in Action
Jest is a JavaScript testing framework that provides test structure, assertions, and test execution utilities.
- How it is used
- Uses Jest to structure and execute consumer-driven contract tests for web APIs and event-message consumers.
- How deep it goes
- Explains describe, test, asynchronous execution, and assertions through a complete Pact example, without detailing Jest internals.
- Examples
- Uses nested Movies API scenarios, a GET /movies interaction, a movie response body, generated pact JSON, and an npm test script.
- What you can do after
- Apply it via Jest to write, run, and assert consumer contract tests against Pact mock providers.
Essential TypeScript 5, Third Edition
Jest is a JavaScript testing framework that provides APIs for defining tests, making assertions, and reporting results.
- How it is used
- Supports unit testing for TypeScript application functions and reports whether their runtime behavior matches expectations.
- How deep it goes
- Explains installation, configuration, test construction, matchers, watch mode, failure output, and test-versus-code correction.
- Examples
- Uses a calc.test.ts test for sum(10, 20, 30), Jest matcher examples, watch-mode output, and an intentionally incorrect calculation.
- What you can do after
- Apply it via Jest, ts-jest, and watch mode to create, run, inspect, and repair TypeScript unit tests.
Read how Essential TypeScript 5, Third Edition explains Jest →
Also covered in
- Build Financial Software with Generative AI (From Scratch)
- AI-Powered Developer: Build software with ChatGPT and Copilot
What to know first
- JavaScriptJavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
- mockingMocking is a testing technique that replaces a dependency or collaborator with a controlled substitute to simulate behavior, isolate code, or inspect interactions.
- software testingSoftware testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
Related concepts
- testing frameworkkind of · A testing framework is software infrastructure that provides conventions and facilities for defining, organizing, executing, and evaluating tests.
- test runnerkind of · A test runner is software that discovers or receives automated tests, executes them, and reports their results.
- Karmaalternative to · Karma is a JavaScript test runner that executes tests in browsers or browser-like environments and reports their results.
- software testinguses · Software testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
- JavaScriptuses · JavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
- npm testused by · npm test is the npm command that runs a package’s configured test script, conventionally used to execute automated tests.
Questions about Jest
What is Jest?
Jest is a JavaScript testing framework for defining, running, and asserting automated tests.
Which Manning books explain Jest?
The Art of Unit Testing 3e, Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform, Modern Angular, Contract Testing in Action and Essential TypeScript 5, Third Edition.
What should I know before learning Jest?
Manning books that teach Jest usually introduce JavaScript, mocking and software testing first.
What is the difference between Jest and Karma?
Jest is a JavaScript testing framework for defining, running, and asserting automated tests. Karma is a JavaScript test runner that executes tests in browsers or browser-like environments and reports their results.
What is Jest a kind of?
Jest is a kind of testing framework. A testing framework is software infrastructure that provides conventions and facilities for defining, organizing, executing, and evaluating tests.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




