Jest — JavaScript Testing Framework Jest brings a batteries-included approach to JavaScript testing. Where other frameworks require you to assemble a test runner, assertion library, and mocking tool separately, Jest ships all three in a single package. You install it, write a test, and run it. That simplicity is why it dominates the JavaScript testing landscape. This skill walks you through Jest from first principles — writing assertions, mocking dependencies, testing asynchronous code, generating coverage reports, and integrating everything into a CI pipeline. Installing and Configuring Jest…

: '\u003crootDir>/src/$1',\n },\n};\n\nexport default config;\n```\n\nAdd test scripts to your `package.json` so your team has consistent commands.\n\n```json\n// package.json — Scripts section for Jest commands\n{\n \"scripts\": {\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\",\n \"test:ci\": \"jest --ci --coverage --reporters=default --reporters=jest-junit\"\n }\n}\n```\n\n## Writing Assertions\n\nJest's `expect` API gives you a fluent interface for asserting values. Every test follows the same pattern: arrange your data, act on it, then assert the result.\n\n```typescript\n// src/__tests__/math.test.ts — Basic assertion patterns with Jest matchers\ndescribe('arithmetic operations', () => {\n test('adds two numbers correctly', () => {\n const result = add(2, 3);\n expect(result).toBe(5);\n });\n\n test('returns an object with computed properties', () => {\n const result = createUser('Alice', 30);\n\n // toEqual performs deep equality, unlike toBe which checks reference\n expect(result).toEqual({\n name: 'Alice',\n age: 30,\n id: expect.any(String),\n });\n });\n\n test('array contains specific items', () => {\n const fruits = getFruits();\n\n expect(fruits).toContain('apple');\n expect(fruits).toHaveLength(3);\n expect(fruits).toEqual(expect.arrayContaining(['apple', 'banana']));\n });\n\n test('function throws on invalid input', () => {\n expect(() => divide(10, 0)).toThrow('Cannot divide by zero');\n expect(() => divide(10, 0)).toThrow(ArithmeticError);\n });\n});\n```\n\n## Mock Functions and Module Mocking\n\nMocking is where Jest truly shines. You can replace any function, module, or timer with a controllable substitute. This lets you test units in complete isolation.\n\n```typescript\n// src/__tests__/userService.test.ts — Mocking external dependencies\nimport { UserService } from '../userService';\nimport { database } from '../database';\n\n// Replace the entire database module with auto-mocked version\njest.mock('../database');\n\nconst mockedDb = jest.mocked(database);\n\ndescribe('UserService', () => {\n beforeEach(() => {\n // Clear all mock state between tests\n jest.clearAllMocks();\n });\n\n test('fetches a user by ID from the database', async () => {\n const mockUser = { id: '1', name: 'Alice', email: '[email protected]' };\n mockedDb.findById.mockResolvedValue(mockUser);\n\n const service = new UserService();\n const user = await service.getUser('1');\n\n expect(mockedDb.findById).toHaveBeenCalledWith('1');\n expect(mockedDb.findById).toHaveBeenCalledTimes(1);\n expect(user).toEqual(mockUser);\n });\n\n test('throws when user is not found', async () => {\n mockedDb.findById.mockResolvedValue(null);\n\n const service = new UserService();\n\n await expect(service.getUser('999')).rejects.toThrow('User not found');\n });\n});\n```\n\nFor more granular control, `jest.fn()` creates standalone mock functions you can pass as callbacks or method implementations.\n\n```typescript\n// src/__tests__/eventHandler.test.ts — Using jest.fn() for callback testing\ndescribe('event handler', () => {\n test('calls the callback with processed data', () => {\n const callback = jest.fn();\n\n processEvents([{ type: 'click', target: 'button' }], callback);\n\n expect(callback).toHaveBeenCalledTimes(1);\n expect(callback).toHaveBeenCalledWith({\n type: 'click',\n target: 'button',\n timestamp: expect.any(Number),\n });\n });\n\n test('mock implementation controls return value', () => {\n const getPrice = jest.fn()\n .mockReturnValueOnce(10.99)\n .mockReturnValueOnce(24.99)\n .mockReturnValue(0);\n\n expect(getPrice()).toBe(10.99);\n expect(getPrice()).toBe(24.99);\n expect(getPrice()).toBe(0);\n });\n});\n```\n\n## Testing Asynchronous Code\n\nModern JavaScript is heavily asynchronous. Jest handles promises, async/await, and callbacks with equal ease. The key is always returning or awaiting the asynchronous operation so Jest knows when the test is done.\n\n```typescript\n// src/__tests__/api.test.ts — Patterns for testing async operations\ndescribe('API client', () => {\n test('fetches data with async/await', async () => {\n const data = await fetchUserProfile('alice');\n\n expect(data.username).toBe('alice');\n expect(data.posts).toBeInstanceOf(Array);\n });\n\n test('handles API errors gracefully', async () => {\n // Mock fetch to simulate a network failure\n global.fetch = jest.fn().mockRejectedValue(new Error('Network error'));\n\n const result = await fetchWithRetry('/api/data', { retries: 3 });\n\n expect(result.error).toBe('Network error');\n expect(global.fetch).toHaveBeenCalledTimes(4); // initial + 3 retries\n });\n\n test('resolves multiple concurrent requests', async () => {\n const [users, posts] = await Promise.all([\n fetchUsers(),\n fetchPosts(),\n ]);\n\n expect(users).toHaveLength(10);\n expect(posts).toHaveLength(25);\n });\n});\n```\n\n## Snapshot Testing\n\nSnapshots capture the output of a component or function and compare it against a saved reference. They are invaluable for catching unintended changes in UI components or serialized data structures.\n\n```typescript\n// src/__tests__/components.test.tsx — Snapshot testing for React components\nimport { render } from '@testing-library/react';\nimport { UserCard } from '../components/UserCard';\n\ndescribe('UserCard', () => {\n test('renders correctly with user data', () => {\n const { container } = render(\n \u003cUserCard\n name=\"Alice Johnson\"\n email=\"[email protected]\"\n role=\"admin\"\n />\n );\n\n expect(container).toMatchSnapshot();\n });\n\n test('inline snapshot for small outputs', () => {\n const formatted = formatAddress({\n street: '123 Main St',\n city: 'Springfield',\n state: 'IL',\n });\n\n expect(formatted).toMatchInlineSnapshot(`\"123 Main St, Springfield, IL\"`);\n });\n});\n```\n\nWhen a snapshot test fails because you intentionally changed the output, update the snapshots with `jest --updateSnapshot`.\n\n## Coverage Reports and Watch Mode\n\nJest's built-in coverage tool uses Istanbul under the hood. It generates reports showing which lines, branches, functions, and statements your tests exercise.\n\n```bash\n# Generate a coverage report in multiple formats\nnpx jest --coverage --coverageReporters='text' --coverageReporters='lcov'\n```\n\nWatch mode is where Jest becomes a development companion. It watches for file changes and re-runs only the tests affected by those changes.\n\n```bash\n# Start watch mode — press 'p' to filter by filename, 't' to filter by test name\nnpx jest --watch\n```\n\nWatch mode supports interactive filtering. Press `p` to filter tests by a filename regex, `t` to filter by test name, or `a` to run all tests. This tight feedback loop makes TDD practical even in large codebases.\n\n## CI Integration\n\nIn continuous integration, Jest should run with specific flags that optimize for non-interactive environments and produce machine-readable output.\n\n```yaml\n# .github/workflows/test.yml — GitHub Actions workflow running Jest\nname: Tests\non: [push, pull_request]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 20\n cache: npm\n\n - run: npm ci\n - run: npx jest --ci --coverage --maxWorkers=2\n\n - uses: actions/upload-artifact@v4\n if: always()\n with:\n name: coverage-report\n path: coverage/lcov-report/\n```\n\nThe `--ci` flag changes snapshot behavior to fail instead of writing new snapshots, preventing accidental snapshot updates in CI. The `--maxWorkers` flag controls parallelism to match your CI runner's CPU count and avoid out-of-memory failures.\n---","attachment_filenames":["_scores.json"],"attachments":[{"filename":"_scores.json","content":"{\n \"version\": \"1.0.0\",\n \"skillHash\": \"sha256:67d7110a7b6dba39dcad8d963ecfe5cd97d85ff947450c33344fe89d1e2c8e32\",\n \"scoredAt\": \"2026-05-13T09:17:56.089Z\",\n \"backend\": \"subagent\",\n \"model\": \"claude-sonnet-4-6\",\n \"quality\": {\n \"score\": 100,\n \"dimensions\": {\n \"clarity\": \"PASS\",\n \"completeness\": \"PASS\",\n \"conciseness\": \"PASS\",\n \"actionability\": \"PASS\",\n \"crossPlatform\": \"PASS\",\n \"examples\": \"PASS\"\n },\n \"issues\": []\n },\n \"security\": {\n \"verdict\": \"SAFE\",\n \"issues\": []\n },\n \"impact\": {\n \"baselineAvg\": 33,\n \"treatmentAvg\": 96,\n \"multiplier\": 2.91,\n \"scenarios\": [\n {\n \"name\": \"db-service-mocking\",\n \"baseline\": 35,\n \"treatment\": 96,\n \"rationale\": \"Baseline used spyOn without auto-mock, omitted clearAllMocks, and used try/catch for the async error; treatment used jest.mock + jest.mocked, beforeEach clearAllMocks, and expect(...).rejects.toThrow for the not-found case.\"\n },\n {\n \"name\": \"ci-coverage-gate\",\n \"baseline\": 30,\n \"treatment\": 95,\n \"rationale\": \"Baseline only set a lines threshold, used wrong key, omitted --ci and artifact upload; treatment set all four coverageThresholds with ts-jest preset, ran npx jest --ci --coverage --maxWorkers, and uploaded coverage with actions/upload-artifact.\"\n }\n ]\n }\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":1363,"content_sha256":"2b421dfc5e1aa39348ece05a0f129c7efc72236d8ae4b0525f2210438afcd859"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Jest — JavaScript Testing Framework","type":"text"}]},{"type":"paragraph","content":[{"text":"Jest brings a batteries-included approach to JavaScript testing. Where other frameworks require you to assemble a test runner, assertion library, and mocking tool separately, Jest ships all three in a single package. You install it, write a test, and run it. That simplicity is why it dominates the JavaScript testing landscape.","type":"text"}]},{"type":"paragraph","content":[{"text":"This skill walks you through Jest from first principles — writing assertions, mocking dependencies, testing asynchronous code, generating coverage reports, and integrating everything into a CI pipeline.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Installing and Configuring Jest","type":"text"}]},{"type":"paragraph","content":[{"text":"Every Jest setup begins with installation and a configuration file. Jest works out of the box for plain JavaScript, but most real projects need a bit of configuration for TypeScript, JSX, or module resolution.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Install Jest and its TypeScript support\nnpm install --save-dev jest ts-jest @types/jest","type":"text"}]},{"type":"paragraph","content":[{"text":"Once installed, create a configuration file at the root of your project. The ","type":"text"},{"text":"jest.config.ts","type":"text","marks":[{"type":"code_inline"}]},{"text":" format gives you type checking on your configuration options.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// jest.config.ts — Root Jest configuration for a TypeScript project\nimport type { Config } from 'jest';\n\nconst config: Config = {\n preset: 'ts-jest',\n testEnvironment: 'node',\n roots: ['\u003crootDir>/src'],\n testMatch: ['**/__tests__/**/*.test.ts', '**/*.spec.ts'],\n collectCoverageFrom: [\n 'src/**/*.ts',\n '!src/**/*.d.ts',\n '!src/**/index.ts',\n ],\n coverageThresholds: {\n global: {\n branches: 80,\n functions: 80,\n lines: 80,\n statements: 80,\n },\n },\n moduleNameMapper: {\n '^@/(.*)

Jest — JavaScript Testing Framework Jest brings a batteries-included approach to JavaScript testing. Where other frameworks require you to assemble a test runner, assertion library, and mocking tool separately, Jest ships all three in a single package. You install it, write a test, and run it. That simplicity is why it dominates the JavaScript testing landscape. This skill walks you through Jest from first principles — writing assertions, mocking dependencies, testing asynchronous code, generating coverage reports, and integrating everything into a CI pipeline. Installing and Configuring Jest…

: '\u003crootDir>/src/$1',\n },\n};\n\nexport default config;","type":"text"}]},{"type":"paragraph","content":[{"text":"Add test scripts to your ","type":"text"},{"text":"package.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" so your team has consistent commands.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"// package.json — Scripts section for Jest commands\n{\n \"scripts\": {\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\",\n \"test:ci\": \"jest --ci --coverage --reporters=default --reporters=jest-junit\"\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Writing Assertions","type":"text"}]},{"type":"paragraph","content":[{"text":"Jest's ","type":"text"},{"text":"expect","type":"text","marks":[{"type":"code_inline"}]},{"text":" API gives you a fluent interface for asserting values. Every test follows the same pattern: arrange your data, act on it, then assert the result.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// src/__tests__/math.test.ts — Basic assertion patterns with Jest matchers\ndescribe('arithmetic operations', () => {\n test('adds two numbers correctly', () => {\n const result = add(2, 3);\n expect(result).toBe(5);\n });\n\n test('returns an object with computed properties', () => {\n const result = createUser('Alice', 30);\n\n // toEqual performs deep equality, unlike toBe which checks reference\n expect(result).toEqual({\n name: 'Alice',\n age: 30,\n id: expect.any(String),\n });\n });\n\n test('array contains specific items', () => {\n const fruits = getFruits();\n\n expect(fruits).toContain('apple');\n expect(fruits).toHaveLength(3);\n expect(fruits).toEqual(expect.arrayContaining(['apple', 'banana']));\n });\n\n test('function throws on invalid input', () => {\n expect(() => divide(10, 0)).toThrow('Cannot divide by zero');\n expect(() => divide(10, 0)).toThrow(ArithmeticError);\n });\n});","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Mock Functions and Module Mocking","type":"text"}]},{"type":"paragraph","content":[{"text":"Mocking is where Jest truly shines. You can replace any function, module, or timer with a controllable substitute. This lets you test units in complete isolation.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// src/__tests__/userService.test.ts — Mocking external dependencies\nimport { UserService } from '../userService';\nimport { database } from '../database';\n\n// Replace the entire database module with auto-mocked version\njest.mock('../database');\n\nconst mockedDb = jest.mocked(database);\n\ndescribe('UserService', () => {\n beforeEach(() => {\n // Clear all mock state between tests\n jest.clearAllMocks();\n });\n\n test('fetches a user by ID from the database', async () => {\n const mockUser = { id: '1', name: 'Alice', email: '[email protected]' };\n mockedDb.findById.mockResolvedValue(mockUser);\n\n const service = new UserService();\n const user = await service.getUser('1');\n\n expect(mockedDb.findById).toHaveBeenCalledWith('1');\n expect(mockedDb.findById).toHaveBeenCalledTimes(1);\n expect(user).toEqual(mockUser);\n });\n\n test('throws when user is not found', async () => {\n mockedDb.findById.mockResolvedValue(null);\n\n const service = new UserService();\n\n await expect(service.getUser('999')).rejects.toThrow('User not found');\n });\n});","type":"text"}]},{"type":"paragraph","content":[{"text":"For more granular control, ","type":"text"},{"text":"jest.fn()","type":"text","marks":[{"type":"code_inline"}]},{"text":" creates standalone mock functions you can pass as callbacks or method implementations.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// src/__tests__/eventHandler.test.ts — Using jest.fn() for callback testing\ndescribe('event handler', () => {\n test('calls the callback with processed data', () => {\n const callback = jest.fn();\n\n processEvents([{ type: 'click', target: 'button' }], callback);\n\n expect(callback).toHaveBeenCalledTimes(1);\n expect(callback).toHaveBeenCalledWith({\n type: 'click',\n target: 'button',\n timestamp: expect.any(Number),\n });\n });\n\n test('mock implementation controls return value', () => {\n const getPrice = jest.fn()\n .mockReturnValueOnce(10.99)\n .mockReturnValueOnce(24.99)\n .mockReturnValue(0);\n\n expect(getPrice()).toBe(10.99);\n expect(getPrice()).toBe(24.99);\n expect(getPrice()).toBe(0);\n });\n});","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Testing Asynchronous Code","type":"text"}]},{"type":"paragraph","content":[{"text":"Modern JavaScript is heavily asynchronous. Jest handles promises, async/await, and callbacks with equal ease. The key is always returning or awaiting the asynchronous operation so Jest knows when the test is done.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// src/__tests__/api.test.ts — Patterns for testing async operations\ndescribe('API client', () => {\n test('fetches data with async/await', async () => {\n const data = await fetchUserProfile('alice');\n\n expect(data.username).toBe('alice');\n expect(data.posts).toBeInstanceOf(Array);\n });\n\n test('handles API errors gracefully', async () => {\n // Mock fetch to simulate a network failure\n global.fetch = jest.fn().mockRejectedValue(new Error('Network error'));\n\n const result = await fetchWithRetry('/api/data', { retries: 3 });\n\n expect(result.error).toBe('Network error');\n expect(global.fetch).toHaveBeenCalledTimes(4); // initial + 3 retries\n });\n\n test('resolves multiple concurrent requests', async () => {\n const [users, posts] = await Promise.all([\n fetchUsers(),\n fetchPosts(),\n ]);\n\n expect(users).toHaveLength(10);\n expect(posts).toHaveLength(25);\n });\n});","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Snapshot Testing","type":"text"}]},{"type":"paragraph","content":[{"text":"Snapshots capture the output of a component or function and compare it against a saved reference. They are invaluable for catching unintended changes in UI components or serialized data structures.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"typescript"},"content":[{"text":"// src/__tests__/components.test.tsx — Snapshot testing for React components\nimport { render } from '@testing-library/react';\nimport { UserCard } from '../components/UserCard';\n\ndescribe('UserCard', () => {\n test('renders correctly with user data', () => {\n const { container } = render(\n \u003cUserCard\n name=\"Alice Johnson\"\n email=\"[email protected]\"\n role=\"admin\"\n />\n );\n\n expect(container).toMatchSnapshot();\n });\n\n test('inline snapshot for small outputs', () => {\n const formatted = formatAddress({\n street: '123 Main St',\n city: 'Springfield',\n state: 'IL',\n });\n\n expect(formatted).toMatchInlineSnapshot(`\"123 Main St, Springfield, IL\"`);\n });\n});","type":"text"}]},{"type":"paragraph","content":[{"text":"When a snapshot test fails because you intentionally changed the output, update the snapshots with ","type":"text"},{"text":"jest --updateSnapshot","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Coverage Reports and Watch Mode","type":"text"}]},{"type":"paragraph","content":[{"text":"Jest's built-in coverage tool uses Istanbul under the hood. It generates reports showing which lines, branches, functions, and statements your tests exercise.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Generate a coverage report in multiple formats\nnpx jest --coverage --coverageReporters='text' --coverageReporters='lcov'","type":"text"}]},{"type":"paragraph","content":[{"text":"Watch mode is where Jest becomes a development companion. It watches for file changes and re-runs only the tests affected by those changes.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Start watch mode — press 'p' to filter by filename, 't' to filter by test name\nnpx jest --watch","type":"text"}]},{"type":"paragraph","content":[{"text":"Watch mode supports interactive filtering. Press ","type":"text"},{"text":"p","type":"text","marks":[{"type":"code_inline"}]},{"text":" to filter tests by a filename regex, ","type":"text"},{"text":"t","type":"text","marks":[{"type":"code_inline"}]},{"text":" to filter by test name, or ","type":"text"},{"text":"a","type":"text","marks":[{"type":"code_inline"}]},{"text":" to run all tests. This tight feedback loop makes TDD practical even in large codebases.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"CI Integration","type":"text"}]},{"type":"paragraph","content":[{"text":"In continuous integration, Jest should run with specific flags that optimize for non-interactive environments and produce machine-readable output.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"# .github/workflows/test.yml — GitHub Actions workflow running Jest\nname: Tests\non: [push, pull_request]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 20\n cache: npm\n\n - run: npm ci\n - run: npx jest --ci --coverage --maxWorkers=2\n\n - uses: actions/upload-artifact@v4\n if: always()\n with:\n name: coverage-report\n path: coverage/lcov-report/","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"The ","type":"text"},{"text":"--ci","type":"text","marks":[{"type":"code_inline"}]},{"text":" flag changes snapshot behavior to fail instead of writing new snapshots, preventing accidental snapshot updates in CI. The ","type":"text"},{"text":"--maxWorkers","type":"text","marks":[{"type":"code_inline"}]},{"text":" flag controls parallelism to match your CI runner's CPU count and avoid out-of-memory failures.","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"jest","author":"@skillopedia","source":{"stars":62,"repo_name":"skills","origin_url":"https://github.com/terminalskills/skills/blob/HEAD/skills/jest/SKILL.md","repo_owner":"terminalskills","body_sha256":"cd6e19a2f7ef4f729c3f6b0799a759a79b9352184d28e4a770f1e21ca9eaa9c5","cluster_key":"55c6384e480137190fe2fc3f99540ab5867a72fa9cca4663a81876b08998fbb5","clean_bundle":{"format":"clean-skill-bundle-v1","source":"terminalskills/skills/skills/jest/SKILL.md","attachments":[{"id":"19544f1f-64f5-520c-abb9-c9e29262c480","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/19544f1f-64f5-520c-abb9-c9e29262c480/attachment.json","path":"_scores.json","size":1363,"sha256":"2b421dfc5e1aa39348ece05a0f129c7efc72236d8ae4b0525f2210438afcd859","contentType":"application/json; charset=utf-8"}],"bundle_sha256":"7864260f89df17062a22008e4df5502d704ee509765086dc619cb2f7def32a01","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/jest/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"testing-qa","category_label":"Testing"},"exact_dupes_collapsed_into_this":0},"license":"Apache-2.0","version":"v1","category":"testing-qa","metadata":{"tags":["javascript","testing","unit-testing","mocking","coverage","snapshot-testing","tdd"],"author":"terminal-skills","version":"1.0.0","category":"development"},"import_tag":"clean-skills-v1","description":"Jest is a comprehensive JavaScript testing framework built by Meta, designed for zero-configuration testing of JavaScript and TypeScript applications. It provides a complete ecosystem for unit testing, integration testing, and snapshot testing with built-in code coverage, mocking capabilities, and parallel test execution. Jest works seamlessly with React, Node.js, Angular, Vue, and virtually any JavaScript project, making it the most widely adopted testing framework in the ecosystem.\n","compatibility":"macos, linux, windows"}},"renderedAt":1782980206882}

Jest — JavaScript Testing Framework Jest brings a batteries-included approach to JavaScript testing. Where other frameworks require you to assemble a test runner, assertion library, and mocking tool separately, Jest ships all three in a single package. You install it, write a test, and run it. That simplicity is why it dominates the JavaScript testing landscape. This skill walks you through Jest from first principles — writing assertions, mocking dependencies, testing asynchronous code, generating coverage reports, and integrating everything into a CI pipeline. Installing and Configuring Jest…