jasmine-skill — Claude Code skill: generate Jasmine tests
Generates test specs in Jasmine for JavaScript and TypeScript. Includes BDD patterns, spy and mock syntax, async support — the code editor writes describe, it, expect, and spy calls automatically.
MIT 237 installs ★ 393 updated 2026-10-13
npx skills add LambdaTest/agent-skills --skill jasmine-skill -a claude-codeWhat jasmine-skill does
The skill equips an AI code editor with Jasmine patterns: test suites and specs (describe, it), matchers to assert values, spies to track function calls and mock APIs, async test flows with async/await or done callbacks, and clock control for timer tests. Examples cover Calculator, UserService, timeout handling.
Setup requires Node.js: npm install jasmine --save-dev && npx jasmine init. Once added, the editor triggers Jasmine suggestions when you mention "Jasmine", "createSpy", "toHaveBeenCalled", or ask for test specs directly. Run tests with npx jasmine or target a file: npx jasmine spec/calculatorSpec.js.
What it helps with
- write a test for a function with async logic
- create a mock API and verify it was called with the right arguments
- check that a function throws an error with a specific message
- track how many times a function got called
Example prompts for the agent
- Write a Jasmine test for an add function that sums two numbers
- Create a spy on getUserData and verify it gets called with the correct parameters
- Make a test that uses jasmine.clock() to check a timeout
How to install jasmine-skill
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill jasmine-skill -a claude-code2Manually: put the files in place
~/.claude/skills/jasmine-skill/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/jasmine-skill/
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill jasmine-skill -a codex2Manually: put the files in place
.agents/skills/jasmine-skill/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill jasmine-skill -a cursor2Manually: put the files in place
.cursor/skills/jasmine-skill/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install LambdaTest/agent-skills jasmine-skill2Manually: put the files in place
.github/skills/jasmine-skill/SKILL.md1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill jasmine-skill -a gemini-cli2Platform CLI
gemini skills install https://github.com/LambdaTest/agent-skills --path jasmine-skillManually: put the files in place
.devin/skills/jasmine-skill/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill jasmine-skill -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about jasmine-skill
How do I install jasmine-skill for Claude Code?
Run npx skills add LambdaTest/agent-skills --skill jasmine-skill -a claude-code, then check ~/.claude/skills/jasmine-skill/SKILL.md.
What does jasmine-skill do?
It generates BDD test specs: describe blocks, it tests, matchers for assertions, spies for mocking, and async patterns with async/await or done callbacks.
Which platforms support jasmine-skill?
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode each have their own install command.
Source text
SKILL.md · MIT
---
name: jasmine-skill
description: >
Generates Jasmine tests in JavaScript. BDD-style framework with spies and
async support. Use when user mentions "Jasmine", "jasmine.createSpy",
"toHaveBeenCalled". Triggers on: "Jasmine", "jasmine test", "createSpy",
"Jasmine spec".
languages:
- JavaScript
- TypeScript
category: unit-testing
license: MIT
metadata:
author: TestMu AI
version: "1.0"
---
# Jasmine Testing Skill
## Core Patterns
### Basic Test
```javascript
describe('Calculator', () => {
let calc;
beforeEach(() => { calc = new Calculator(); });
it('should add two numbers', () => {
expect(calc.add(2, 3)).toBe(5);
});
it('should throw on divide by zero', () => {
expect(() => calc.divide(10, 0)).toThrowError('Division by zero');
});
});
```
### Matchers
```javascript
expect(value).toBe(exact); // === strict
expect(value).toEqual(object); // Deep equality
expect(value).toBeTruthy();
expect(value).toBeFalsy();
expect(value).toBeNull();
expect(value).toBeUndefined();
expect(value).toBeDefined();
expect(value).toBeNaN();
expect(value).toBeGreaterThan(3);
expect(value).toBeCloseTo(0.3, 5);
expect(str).toContain('sub');
expect(str).toMatch(/pattern/);
expect(arr).toContain(item);
expect(fn).toThrow();
expect(fn).toThrowError('message');
// Negation
expect(value).not.toBe(other);
```
### Spies
```javascript
describe('UserService', () => {
let service, api;
beforeEach(() => {
api = jasmine.createSpyObj('api', ['get', 'post']);
service = new UserService(api);
});
it('fetches user from API', async () => {
api.get.and.returnValue(Promise.resolve({ name: 'Alice' }));
const user = await service.getUser(1);
expect(user.name).toBe('Alice');
expect(api.get).toHaveBeenCalledWith('/users/1');
expect(api.get).toHaveBeenCalledTimes(1);
});
});
// Spy on existing method
spyOn(obj, 'method').and.returnValue(42);
spyOn(obj, 'method').and.callThrough(); // Call original
spyOn(obj, 'method').and.throwError('err');
```
### Async Testing
```javascript
it('fetches data', async () => {
const data = await fetchData();
expect(data).toBeDefined();
});
// With done callback
it('fetches data', (done) => {
fetchData().then(data => {
expect(data).toBeDefined();
done();
});
});
// Clock control
beforeEach(() => { jasmine.clock().install(); });
afterEach(() => { jasmine.clock().uninstall(); });
it('handles timeout', () => {
const callback = jasmine.createSpy();
setTimeout(callback, 1000);
jasmine.clock().tick(1001);
expect(callback).toHaveBeenCalled();
});
```
## Setup: `npm install jasmine --save-dev && npx jasmine init`
## Run: `npx jasmine` or `npx jasmine spec/calculatorSpec.js`
## Deep Patterns
See `reference/playbook.md` for production-grade patterns:
| Section | What You Get |
|---------|-------------|
| §1 Project Setup | jasmine.json, TypeScript, spec reporter config |
| §2 Spies — Complete API | spyOn, createSpyObj, callFake, returnValues, call tracking |
| §3 Async Testing | async/await, expectAsync, promise matchers |
| §4 Custom Matchers | Domain-specific matchers, asymmetric matchers |
| §5 Test Organization | Nested describe, shared state, focused/excluded |
| §6 Fetch & Module Mocking | globalThis.fetch spy, HTTP error handling |
| §7 Browser Testing | DOM creation, keyboard events, focus trapping with Karma |
| §8 CI/CD Integration | GitHub Actions with coverage, browser testing |
| §9 Debugging Table | 12 common problems with causes and fixes |
| §10 Best Practices | 14-item checklist for production Jasmine testing |
© TestMu AI · MIT · LambdaTest/agent-skills