Jest là JavaScript testing framework từ Meta, phổ biến nhất trong ecosystem.
- Zero-config với Create React App và Next.js; TypeScript support qua ts-jest hoặc babel-jest.
- Test isolation: mỗi test file chạy trong separate Node.js environment (jsdom hoặc node), global state không leak giữa files.
- Parallel execution: Jest chạy test files song song qua worker pool, isolate failures tốt.
- Snapshot testing: serialize output và so sánh với .snap files — detect unexpected UI changes.
- Mocking system: jest.fn(), jest.mock(), jest.spyOn() — mock modules, timers (jest.useFakeTimers), và globals.
- Code coverage: --coverage flag generate Istanbul reports (statements, branches, functions, lines).
- Watch mode: --watchAll hoặc --watch chỉ re-run tests affected by changes.
- Matchers: toBe (===), toEqual (deep), toMatchObject (partial match), toThrow, toHaveBeenCalledWith, resolves/rejects cho async.
- Setup files: jest.config.js với setupFilesAfterEach để configure Testing Library, mock global APIs.
- Tích hợp với React Testing Library: render, screen, fireEvent, userEvent — test behavior không implementation details.