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).

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.

agentmods
npx agentmods add skills/boshi-xixixi/traeskill/javascript-typescript-jest
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00015 $0.00264
Sonnet 5 $0.00006 $0.00106
Haiku 4.5 $0.00003 $0.00053

Measured 2d ago against content hash cb9a552dfe63, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 2d 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. 2d 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 (261 stars, last pushed 3mo ago), licensed MIT. It adds 30 tokens to every session and 529 once invoked, about $0.0002 per session on Opus 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.

Related

Other skills, from other repositories

cocos-creator

写 Cocos Creator(TypeScript)时使用。组件、节点、prefab、事件、资源管理规范。.

Wade-DevCode/awesome-coding-skills-cn · 29 tokens

migrate-to-shoehorn

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

mxyhi/ok-skills · 48 tokens

testing-typescript

Use when writing tests for TypeScript or JavaScript code in frameworks such as Jest, Vitest, Bun, etc.

LandonSchropp/agent-toolkit · 24 tokens

bun-guides-test

Practical guides for testing TypeScript applications, mocking modules, mocking fetch, and running unit tests in Bun.

LuigiColantuono/bun-docs-toolkit · 27 tokens

typescript-best-practices

TypeScript async patterns, module conventions, error handling, and testing with Vitest. Use when writing async code, structuring modules, handling errors at boundaries, or writing unit tests in TypeScript projects. Apply whenever user writes async/await, Promise chains, try/catch, Vitest tests, or asks about error…

shipengqi/skills · 77 tokens

java-unit-test

为 Spring Boot 项目生成高质量 Java 单元测试代码。当用户要求"写单元测试"、"生成测试用例"、"帮我写 test"、"补充测试覆盖"、"写 JUnit 测试"、"写 Mockito 测试"、"测试这个 Service / Controller / Mapper"时,必须使用此 skill。即使用户只是说"帮我测一下这个方法"或贴出 Java 代码并问"怎么测",也应触发此 skill。.

hashgraph-online/awesome-codex-plugins · 113 tokens