javascript-typescript-jest

javascript-typescript-jest is a skill for Claude Code, Codex from boshi-xixixi/TraeSkill. It costs 30 tokens per session (529 once invoked), scanned A, original, MIT.

A guide to writing JavaScript and TypeScript tests with Jest, a testing framework for checking code behavior.

In plain words
What is it for?
Use it to write unit tests for JavaScript, TypeScript, and React code with Jest.
Why use it?
It explains how to structure tests, mock outside services, test asynchronous code, and check React components without relying on real dependencies.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to write unit tests for JavaScript, TypeScript, and React code with Jest.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/boshi-xixixi/traeskill/javascript-typescript-jest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add boshi-xixixi/TraeSkill --skill javascript-typescript-jest
Clone the repo
git clone --depth 1 https://github.com/boshi-xixixi/TraeSkill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for javascript-typescript-jest

README.md
[![agentmods](https://agentmods.dev/badge/skills/boshi-xixixi/traeskill/javascript-typescript-jest/github.svg)](https://agentmods.dev/skills/boshi-xixixi/traeskill/javascript-typescript-jest)
Your own site
<a href="https://agentmods.dev/skills/boshi-xixixi/traeskill/javascript-typescript-jest"><img src="https://agentmods.dev/badge/skills/boshi-xixixi/traeskill/javascript-typescript-jest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for javascript-typescript-jest

Your own site · 80×15
<a href="https://agentmods.dev/skills/boshi-xixixi/traeskill/javascript-typescript-jest"><img src="https://agentmods.dev/badge/skills/boshi-xixixi/traeskill/javascript-typescript-jest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 529 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00529
Opus 5.5 $0.00012 $0.00212
Sonnet 5.5 $0.00006 $0.00106
Haiku 4.5 $0.00003 $0.00053

Measured 1mo ago against content hash cb9a552dfe63, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

javascript-typescript-jest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.trae/Skills/.agents/skills/javascript-typescript-jest/SKILL.md · 45 lines

How it starts

The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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)

Read the full file on GitHub · 45 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 45 lines · 30 tokens per session scan A cb9a552dfe63

Subscribe to this mod's changes

javascript-typescript-jest is a skill published in the GitHub repository boshi-xixixi/TraeSkill (277 stars, last pushed 5mo ago), licensed MIT. It adds 30 tokens to every session and 529 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.