بنقرة واحدة
jest-testing
Write, run, debug, and stabilize Jest tests for JavaScript, TypeScript, Node, and React projects.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Write, run, debug, and stabilize Jest tests for JavaScript, TypeScript, Node, and React projects.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Scaffold and register new OpenCode agents in this repository following the modular TypeScript structure. Use when creating, scaffolding, adding, or modifying agents under src/agents/. Triggers on: "create agent", "new agent", "add agent", "scaffold agent", "create a new agent", "nuevo agente", "crear agente", "añadir agente".
Review pull requests and local branch diffs with evidence-based findings, risk assessment, and actionable feedback.
Write, run, debug, and stabilize Karma/Jasmine tests, especially Angular unit and component tests.
Angular engineering guidelines for standalone apps, signals, RxJS, templates, routing, and rendering performance. Use this skill when writing, reviewing, or refactoring Angular code to keep components predictable, efficient, and easy to maintain.
| name | jest-testing |
| description | Write, run, debug, and stabilize Jest tests for JavaScript, TypeScript, Node, and React projects. |
| allowed-tools | Bash(npm:*) Bash(npx:*) Bash(node:*) |
Use this skill when writing, running, debugging, or stabilizing Jest tests for JavaScript, TypeScript, Node, and React projects.
For Vite-first projects, consider Vitest unless the project already uses Jest.
# Run the project test script
npm test
# Run in watch mode
npm test -- --watch
# Run one test file
npx jest path/to/file.test.ts
# Run tests matching a name
npx jest -t "test name"
# Run tests related to a changed source file
npx jest --findRelatedTests src/foo.ts
# Generate coverage
npx jest --coverage
# CI run with coverage
npx jest --ci --coverage
# Debug one test serially
node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand path/to/test
user-event for interactions and avoid component internals.@jest/globals when needed; run tsc --noEmit if Babel only transpiles and does not type-check.await expect(loadUser()).resolves.toEqual({ id: '1' });
await expect(loadUser()).rejects.toThrow('not found');
resolves and rejects for promise expectations.expect.assertions(...) for rejection and callback paths that must assert.done callbacks with promises or async functions.const load = jest.fn().mockResolvedValue({ id: '1' });
const spy = jest.spyOn(console, 'error').mockImplementation(() => {});
jest.mock('../api', () => ({
...jest.requireActual('../api'),
fetchUser: jest.fn().mockRejectedValue(new Error('offline')),
}));
spy.mockRestore();
jest.fn, jest.spyOn, and jest.mock for collaborators and boundaries.mockResolvedValue and mockRejectedValue for async dependencies.jest.requireActual for partial mocks.jest.clearAllMocks(), jest.restoreAllMocks(), or per-mock restore calls.jest.useFakeTimers();
jest.advanceTimersByTime(1000);
jest.runOnlyPendingTimers();
jest.useRealTimers();
useFakeTimers, runAllTimers, runOnlyPendingTimers, and advanceTimersByTime for deterministic time-based tests.npx jest path/to/file.test.ts --runInBand --detectOpenHandles
npx jest -t "test name" --runInBand
node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand path/to/test
--runInBand when debugging shared state, timers, or open handles.node vs jsdom), and setup files.test.only and describe.only before final validation.npx jest --ci --coverage
npx jest --runInBand --detectOpenHandles
--ci for non-interactive runs.test.only, describe.only, broad snapshots, or skipped tests in committed code.done with promises or async tests.