jasmine-skill
jasmine-skill enables you to craft well-organized unit tests following Jasmine's behavior-driven development patterns. Use describe blocks to group related tests, it blocks to define individual test cases, and expect assertions to validate your code's behavior. Perfect for developers building robust test suites with clear, readable test structure.
jasmine-skill teaches you to structure unit tests with Jasmine's BDD-style syntax. Start with a describe block to group related tests, then nest it blocks for individual test cases. Inside each it block, use expect assertions to validate your code's behavior. For example: describe('Calculator', () => { it('should add two numbers', () => { expect(2 + 2).toBe(4); }); }); This pattern keeps your tests organized, readable, and maintainable.
AI-generated summary based on this skill's SKILL.md
Install
LambdaTest/agent-skills/jasmine-skill · repository language: Python
git clone https://github.com/LambdaTest/agent-skills
cp -r agent-skills/jasmine-skill ~/.claude/skills/jasmine-skillFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How to write jasmine tests using describe and it blocks?
jasmine-skill teaches you to structure unit tests with Jasmine's BDD-style syntax. Start with a describe block to group related tests, then nest it blocks for individual test cases. Inside each it block, use expect assertions to validate your code's behavior. For example: describe('Calculator', () => { it('should add two numbers', () => { expect(2 + 2).toBe(4); }); }); This pattern keeps your tests organized, readable, and maintainable.
What are spyOn and createSpy in jasmine-skill for mocking?
jasmine-skill covers spies, stubs, and mocks to isolate code under test. Use spyOn to track calls on existing object methods: spyOn(obj, 'method'). Use createSpy to create a standalone spy function: const spy = jasmine.createSpy('myspy'). Both let you verify function calls with matchers like toHaveBeenCalled, toHaveBeenCalledWith, and check call counts. Spies replace the original implementation, letting you test interactions without side effects.
How does jasmine-skill handle async testing with promises and async/await?
jasmine-skill provides utilities for testing asynchronous code including promises, async/await, and timeout handling. Use the done callback in it blocks: it('test', (done) => { asyncFunc().then(() => { expect(true).toBe(true); done(); }); }). For async/await, mark your test function as async: it('test', async () => { const result = await asyncFunc(); expect(result).toBe(expected); }). jasmine-skill also includes clock.tick() for controlling time-based operations and testing delayed callbacks.
What does jasmine-skill include for setting up the testing environment with npm?
jasmine-skill covers Jasmine testing environment setup with npm, configuration, and CI/CD integration. Install Jasmine via npm, configure jasmine.json with spec patterns and helper files, then run tests with npm scripts. jasmine-skill guides you through integrating with CI/CD pipelines like GitHub Actions, enabling automated test runs on every commit. Proper setup ensures your test suite runs consistently across development and production environments.
What expect matchers and custom matchers does jasmine-skill teach?
jasmine-skill teaches standard expect matchers like toBe, toEqual, toContain, toThrow, and toHaveBeenCalled for validating test assertions. Beyond built-in matchers, jasmine-skill covers advanced patterns including custom matchers that extend Jasmine's assertion library for domain-specific checks. You can define custom matchers in beforeEach or helper files to create reusable, expressive assertions tailored to your application's needs.
How does jasmine-skill help with DOM testing and debugging test failures?
jasmine-skill covers advanced patterns for DOM testing and debugging common test failures. Learn to test HTML elements, events, and DOM manipulation using Jasmine with Karma as a test runner. jasmine-skill provides strategies for isolating DOM-related bugs, reading test output, and using browser developer tools to inspect failing tests. Combine beforeEach and afterEach hooks to set up and clean up DOM state between tests, ensuring reliable and maintainable test suites.
SKILL.md
rendered from the published skill — quoted content, verbatim
Jasmine Testing Skill
Core Patterns
Basic Test
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,
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 3 files
jasmine-skill/SKILL.md
jasmine-skill/reference/advanced-patterns.md
jasmine-skill/reference/playbook.md