This opening episode makes sure you have the basic JavaScript skills, an understanding of testing concepts, and the software you need, such as Node.js, a package manager, and an editor. You will also set up a project directory and verify your first Jest installation.

Welcome to the Learn Jest series! This series will take you from the foundations of unit testing to production-grade strategies, helping you master Jest — the most widely used JavaScript testing framework in the modern ecosystem. There are 23 episodes in total, organized into six phases.
But before writing your first test, you need a few foundational skills and pieces of software. Why do these pre-requisites matter? Because Jest is just a tool; its real power shows up once you understand how to think about testing, mocking, and asynchronous code. Without that foundation, writing tests feels like memorizing syntax without meaning.
Episode 0 is your roadmap: we'll confirm your foundational skills, set up Node.js and a package manager, install Jest, and run a first verification. Once this episode is done, you can follow the rest of the series comfortably.
Jest executes tests written in JavaScript or TypeScript, so you need to be comfortable with modern syntax such as arrow functions, destructuring, async/await, and classes. Just as important is the module system: understand the difference between import and require, because Jest supports both, and your choice affects the transform configuration in episode 9.
Before using Jest, master three core concepts:
You also need to be comfortable with the command line and Git. Almost all interaction with Jest happens through the terminal, and snapshot testing relies heavily on reviewing diffs in Git.
Jest runs on top of Node.js. Make sure your Node.js version is supported — for the latest Jest version, Node.js 18 or newer is recommended:
node --version
npm --versionThe output of node --version should show version 18 or newer. You're free to use npm, yarn, or pnpm — this entire series uses npm for consistency.
Create a project directory and initialize package.json:
mkdir belajar-jest
cd belajar-jest
npm init -y
npm install --save-dev jestnpm init -y creates a default package.json, and npm install --save-dev jest installs Jest as a development dependency. Verify the installation:
npx jest --versionThe output of npx jest --version shows the installed Jest version — as of this series, version 30 is the latest stable release.
Info
Always install Jest as a development dependency (save-dev). Jest is only needed during development, not when the application runs in production.
Set up VS Code (or your favorite editor) with the official Jest extension so tests can be run directly from the editor. Also set up Git for version control:
git --versionOptional but very useful: a React or Next.js project to support episode 8 on UI component testing. Don't worry if you don't have one yet — all the examples in this series run in a plain JavaScript project.
Jest doesn't demand heavy hardware, but large test suites can consume resources. The recommended minimum specifications:
node_modules, caches, and coverage artifacts.If your machine is smaller, don't worry. Episode 15 will cover how to tune --maxWorkers so Jest still runs well on limited hardware.
Before moving on to episode 1, run a quick verification. Add a test script to package.json:
{
"scripts": {
"test": "jest"
}
}Then create your first test file:
test("environment is ready", () => {
expect(2 + 2).toBe(4);
});Save the file as test.js at the project root, then run:
npm testIf the output shows Tests: 1 passed, your environment is ready. Note expect(2 + 2).toBe(4) — the expect function receives the actual value, and the toBe matcher compares it with the expected value. We'll dig into this in detail in episode 4.
In this episode you've laid the foundation for the entire series: understanding the core JavaScript skills and testing concepts, setting up Node.js and npm, installing Jest version 30, and verifying that your first test runs.
Key takeaways:
npm test script maps to the jest command in package.json.In the next episode, episode 1, we'll cover history, background, and why to choose Jest — from Jest's birth at Facebook, its advantages of zero config and snapshot testing, to its comparison with Mocha, Jasmine, and Vitest. Make sure your environment is ready, because the Learn Jest journey is just beginning!