Jasmine Behavior-Driven Testing
jasmine.github.io
3
Leaving SiteNav
External Link Disclaimer
You are about to visit jasmine.github.io. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Jasmine is a behavior-driven development testing framework for JavaScript that requires no external dependencies, runs in both browsers and Node.js, and provides syntax designed to read like natural language specifications. Tests are organized using describe blocks that group related specs, with it blocks defining individual test cases, and beforeEach, afterEach, beforeAll, and afterAll hooks for setup and teardown. The built-in matcher library provides expectations covering equality, truthiness, containment, type checking, string pattern matching, numeric comparison, null and undefined checks, error throwing, and spy call verification. Custom matchers can be registered globally or scoped to individual suites. Spies serve as the mocking mechanism, allowing developers to stub functions, track call counts, capture arguments, return predetermined values, and chain call-through behavior where the original implementation still executes. Asynchronous testing uses async-await syntax natively, and the framework handles promise resolution automatically within expectations. The framework was originally created to test web applications and has since been adopted for Angular, React, Vue, and Node.js backends, with official packages providing integration for each environment. The standalone distribution provides a zip file with a SpecRunner HTML page for browser-based execution without a build step. Random test execution order helps detect hidden dependencies between specs, and a seed value can pin the order for debugging. Configuration files control spec file patterns, helper loading, reporters, and execution timeout values.
Statistics
3
Views
0
Clicks
0
Like
0
Dislike