Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bizzye avatar

Javascript Typescript Jest

  • 1 installs
  • Updated June 16, 2026
  • bizzye/life-jornal

javascript-typescript-jest is a Claude skill providing best practices for writing JavaScript/TypeScript tests with Jest, including mocking, structure, and common patterns.

About

This skill provides best practices for writing JavaScript and TypeScript tests with Jest. It covers test file structure and naming, mocking strategies, testing async code, snapshot testing, and testing React components with React Testing Library. It also lists common Jest matchers. A developer uses it as a reference when writing or reviewing Jest tests. Sourced from the github/awesome-copilot repository.

  • Best practices for JavaScript/TypeScript tests with Jest: structure, mocking, async, snapshots
  • Covers React Testing Library patterns and querying by accessibility role
  • Lists common Jest matchers for values, promises, arrays, objects, and mocks

Javascript Typescript Jest by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,750 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Jul 7, 2026 (Skillselion catalog sync)
At a glance

javascript-typescript-jest capabilities & compatibility

Use cases
testing · code review
IDEs
vscode
From the docs

What javascript-typescript-jest says it does

Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
SKILL.md
Use React Testing Library over Enzyme for testing components
SKILL.md
Use `jest.mock()` for module-level mocks
SKILL.md
npx skills add https://github.com/bizzye/life-jornal --skill javascript-typescript-jest

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
Last updatedJune 16, 2026
Repositorybizzye/life-jornal

What it does

Reference Jest best practices for structuring, mocking, and writing JavaScript/TypeScript and React tests.

Who is it for?

Writing and structuring Jest unit and React component tests.

When should I use this skill?

Use when writing or reviewing JavaScript/TypeScript tests with Jest.

What you get

Well-structured Jest tests with sound mocking, async handling, and matcher usage.

Files

SKILL.mdMarkdownGitHub ↗

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 components
  • Test user behavior and component accessibility
  • Query elements by accessibility roles, labels, or text content
  • Use userEvent over fireEvent for 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

FAQ

What testing library does this skill recommend for React?

React Testing Library over Enzyme, querying by accessibility roles, labels, or text and using userEvent over fireEvent.

How should test files be named?

With a .test.ts or .test.js suffix, placed next to the code or in a __tests__ directory.

Testing & QAtestingfrontend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.