🧪
Testing3M+/wkMIT

jasmine

Jasmine is a behavior-driven development testing framework for JavaScript that does not depend on any other JavaScript framework and does not require a DOM. Cre

Installation

npm
npm install -D jasmine
yarn
yarn add -D jasmine
pnpm
pnpm add -D jasmine

Import

ESM
// jasmine uses globals: describe, it, expect

Quick Example

usage
describe('Calculator', () => {
  it('should add two numbers', () => {
    expect(1 + 2).toBe(3);
  });

  it('should handle negative numbers', () => {
    expect(-1 + 1).toBe(0);
  });
});

About jasmine

Jasmine is a behavior-driven development testing framework for JavaScript that does not depend on any other JavaScript framework and does not require a DOM. Created in 2010, Jasmine was one of the first BDD-style testing frameworks for JavaScript and heavily influenced Jest's API design. Jasmine provides describe/it blocks for organizing tests, a rich set of built-in matchers (toBe, toEqual, toBeTruthy, toContain, toThrow, etc.), spies for tracking function calls and controlling behavior, a clock mock for testing time-dependent code, and async test support. Jasmine tests are self-contained — the framework includes everything needed for testing without requiring external assertion or mocking libraries. The spy system allows creating standalone spies, spying on existing methods, and configuring return values or fake implementations. Jasmine's custom matcher system lets teams define domain-specific assertions that improve test readability. While Jest has largely replaced Jasmine in the React ecosystem, Jasmine remains the default test framework for Angular projects (through Karma) and is widely used in enterprise JavaScript applications. The framework's stability and minimal dependency footprint make it suitable for environments with strict dependency policies.

Quick Facts

Packagejasmine
CategoryTesting
Weekly Downloads3M+
LicenseMIT
Installnpm install -D jasmine

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.