Agent skill · Testing & QA

javascript-typescript-jest

Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.

GitHub68,948★ · +463/wk · 2 repos on radarProfile →
copilotMIT
Install
npx skills add github/awesome-copilot --skill javascript-typescript-jest --agent copilot

Same command for any agent — swap --agent for claude-code, codex, cursor.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Path: skills/javascript-typescript-jest/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 37,432 · +281 this week
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

### Test Structure - Name test files with `.test.ts` or `.test.js` suffix - Place test files next to the code they test or in a dedicated `__tests__` directory - Use descriptive test names that explain the expected behavior - Use nested describe blocks to organize related tests - Follow the pattern: `describe('Component/Function/Class', () => { it('should do something', () => {}) })` ### Effective Mocking - Mock external dependencies (APIs, databases, etc.) to isolate your tests - Use `jest.mock()` for module-level mocks - Use `jest.spyOn()` for specific function mocks - Use `mockImplementation()` or `mockReturnValue()` to define mock behavior - Reset mocks between tests with `jest.resetAllMocks()` in `afterEach` ### Testing Async Code - Always return promises or use async/await syntax in tests - Use `resolves`/`rejects` matchers for promises - Set appropriate timeouts for slow tests with `jest.setTimeout()` ### Snapshot Testing - Use snapshot tests for UI components or complex objects that change infrequently - Keep snapshots small and focused - Review snapshot changes carefully before committing ### Testing React Components - Use React Testing Library over Enzyme for testing comp

What's inside
Steps it walks through
  1. Test Structure
  2. Effective Mocking
  3. Testing Async Code
  4. Snapshot Testing
  5. Testing React Components
  6. Common Jest Matchers
More from awesome-copilot
All skills →
About this skill
What does the javascript-typescript-jest skill do?

Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.

How do I install it?

Run `npx skills add github/awesome-copilot --skill javascript-typescript-jest --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From github/awesome-copilot, a repository with 37,432 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going