
Javascript Typescript Jest
- 12k installs
- 37.1k repo stars
- Updated July 28, 2026
- github/awesome-copilot
javascript-typescript-jest is a copilot skill listing Jest best practices for JS/TS tests, mocking, async patterns, snapshots, and React Testing Library usage.
About
javascript-typescript-jest is an awesome-copilot skill that encodes Jest testing conventions for JS and TS codebases. It specifies file naming with .test.ts or .test.js, colocated or __tests__ placement, nested describe blocks, and descriptive it names following describe/it structure. Mocking guidance covers jest.mock module mocks, jest.spyOn function spies, mockImplementation and mockReturnValue, plus jest.resetAllMocks in afterEach. Async tests must return promises or use async/await with resolves/rejects matchers and jest.setTimeout for slow cases. Snapshot tests are scoped to stable UI or object shapes with careful review before commit. React guidance prefers Testing Library over Enzyme, accessibility-first queries, and userEvent over fireEvent. A matcher cheat sheet spans primitives, truthiness, numbers, strings, arrays, objects, exceptions, and mock call assertions. Developers invoke it when writing or reviewing Jest suites for TS/JS services or React components.
- Documents .test.ts/.test.js naming, colocated or __tests__ placement, and nested describe/it structure.
- Covers jest.mock, jest.spyOn, mockImplementation, mockReturnValue, and resetAllMocks between tests.
- Async guidance: promises, async/await, resolves/rejects matchers, and jest.setTimeout tuning.
- React section favors Testing Library, accessibility queries, and userEvent interactions.
- Includes a common Jest matchers reference for primitives, collections, exceptions, and mocks.
Javascript Typescript Jest by the numbers
- 11,975 all-time installs (skills.sh)
- +158 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #61 of 2,184 Testing & QA skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
javascript-typescript-jest capabilities & compatibility
- Capabilities
- jest file layout and naming conventions · module and function mocking patterns · async and snapshot testing guidance · react testing library query and interaction rule · common matcher reference cheat sheet
- Use cases
- testing · frontend
What javascript-typescript-jest says it does
Name test files with `.test.ts` or `.test.js` suffix
Use React Testing Library over Enzyme for testing components
Reset mocks between tests with `jest.resetAllMocks()` in `afterEach`
npx skills add https://github.com/github/awesome-copilot --skill javascript-typescript-jestAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 12k |
|---|---|
| repo stars | ★ 37.1k |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 28, 2026 |
| Repository | github/awesome-copilot ↗ |
How should I structure Jest tests, mocks, and React component tests in a TypeScript codebase?
Apply Jest best practices for JavaScript and TypeScript tests covering structure, mocking, async code, snapshots, and React Testing Library patterns.
Who is it for?
Developers adding or reviewing Jest coverage in JavaScript or TypeScript projects, including React UIs.
Skip if: Skip when the project uses Vitest, Playwright-only E2E, or a non-Jest runner without adaptation.
When should I use this skill?
User asks for Jest patterns, TS test structure, React Testing Library guidance, or mock reset conventions.
What you get
Consistent Jest test files with documented mocking, async, snapshot, and React Testing Library conventions.
- Jest test files
- Mock setup modules
Files
Test Structure
- Name test files with
.test.tsor.test.jssuffix - 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()ormockReturnValue()to define mock behavior - Reset mocks between tests with
jest.resetAllMocks()inafterEach
Testing Async Code
- Always return promises or use async/await syntax in tests
- Use
resolves/rejectsmatchers 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 components
- Test user behavior and component accessibility
- Query elements by accessibility roles, labels, or text content
- Use
userEventoverfireEventfor more realistic user interactions
Common Jest Matchers
- Basic:
expect(value).toBe(expected),expect(value).toEqual(expected) - Truthiness:
expect(value).toBeTruthy(),expect(value).toBeFalsy() - Numbers:
expect(value).toBeGreaterThan(3),expect(value).toBeLessThanOrEqual(3) - Strings:
expect(value).toMatch(/pattern/),expect(value).toContain('substring') - Arrays:
expect(array).toContain(item),expect(array).toHaveLength(3) - Objects:
expect(object).toHaveProperty('key', value) - Exceptions:
expect(fn).toThrow(),expect(fn).toThrow(Error) - Mock functions:
expect(mockFn).toHaveBeenCalled(),expect(mockFn).toHaveBeenCalledWith(arg1, arg2)
Related skills
How it compares
Use javascript-typescript-jest for Jest unit and component tests; pick E2E or Playwright skills when full browser flows are the target.
FAQ
Who is javascript-typescript-jest for?
JavaScript and TypeScript developers standardizing Jest unit and component tests in copilot-assisted workflows.
When should I use javascript-typescript-jest?
When writing new .test.ts files, fixing flaky async tests, or aligning React tests with Testing Library practices.
Is javascript-typescript-jest safe to install?
Review the Security Audits panel on this page before installing in production.