Chai is a widely used BDD/TDD assertion library for both Node.js and browser environments, designed to be framework-agnostic and pair delightedly with any JavaScript testing framework. The current stable version is 6.2.2, with frequent patch and minor releases, alongside periodic major updates, demonstrating an active development cadence.
npm install chaiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic assertions using Chai's Expect style, including numerical comparisons, boolean checks, and deep object equality.
Update your imports to reference the main `chai` package directly, e.g., `import { expect } from 'chai';` instead of `import { expect } from 'chai/lib/expect';`.After `import { should } from 'chai';`, add `should();` on the next line.Prefer importing assertion styles locally (e.g., `import { expect } from 'chai';`) to avoid global pollution and ensure better test isolation.Change the import path to `import { expect } from 'chai';` or `import { assert } from 'chai';`.Add `should();` immediately after the import statement: `import { should } from 'chai'; should();`.Update your code to use ESM `import` statements, for example, `import { expect } from 'chai';` instead of `const expect = require('chai').expect;`.No dependency data recorded yet.