Jest
ELI5 — The Vibe Check
Jest is the most popular JavaScript testing framework. It does everything: runs your tests, provides expect() for assertions, mocks functions, generates coverage reports, and even has a watch mode. If you've done JS testing, you've probably used Jest.
Real Talk
Jest is a JavaScript testing framework developed by Meta. It provides a zero-config setup, built-in mocking, code coverage, snapshot testing, and parallel test execution. It works with Node.js, React, Vue, and most JS projects out of the box.
Show Me The Code
// jest.config.js
module.exports = { testEnvironment: 'node', coverageThreshold: { global: { lines: 80 } } };
// user.test.js
test('greets user by name', () => {
expect(greet('Alice')).toBe('Hello, Alice!');
});
When You'll Hear This
"We use Jest for all our unit and integration tests." / "Jest's --watch mode is great for TDD."
Related Terms
Assertion
An assertion is your test saying 'I DEMAND this is true!'. It's you checking that the result is what you expected.
Mocha
Mocha is an older, flexible JavaScript test runner that lets you pick your own assertion library and mocking tools.
Mock
A mock is a fake version of something your code talks to.
Test Runner
A test runner is the thing that actually runs your tests and tells you which ones passed and which ones failed.
Vitest
Vitest is a blazing-fast test runner built on Vite. If Jest is the reliable sedan, Vitest is the electric sports car — same driving experience, 10x faster.