chai
Installation
SKILL.md
Chai
Chai is an assertion library. It pairs naturally with Mocha. It supports TDD (assert) and BDD (expect, should) styles.
When to Use
- BDD/TDD Assertion Library: Pairing with test runners like Mocha to write expressive, human-readable assertions in JavaScript/TypeScript.
- Expect / Should / Assert Syntax: Choosing between chainable BDD assertions (
expect(foo).to.be.a('string')) and classical TDDassert. - Deep Object & Array Equality: Comparing nested objects, array sets, and property structures effortlessly.
- Plugin Ecosystem (chai-as-promised, chai-http): Extending assertion vocabularies with async promises and HTTP response assertions.
Quick Start
import { expect } from "chai";
const foo = "bar";
const beverages = { tea: ["chai", "matcha", "oolong"] };