BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
8.3k
Stars
717
Forks
90
Open issues
30
Contributors
AI Analysis
Chai is a widely-adopted BDD/TDD assertion library for Node.js and browsers that works with any testing framework. It excels as a flexible assertion layer for developers building test suites, offering multiple assertion styles (assert, expect, should) and a plugin architecture. It benefits any JavaScript developer writing tests but is not a standalone testing framework—it requires pairing with runners like Mocha.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Chai: The veteran BDD/TDD assertion library still powering millions of JavaScript test suites
Chai is a flexible assertion library for JavaScript that supports three API styles — assert, expect, and should — allowing teams to write test assertions in whichever idiom fits their codebase. It is framework-agnostic, pairing with Mocha, Jest, Jasmine, or any other runner. Built for Node.js and browsers, it has been a cornerstone of the JavaScript testing ecosystem since 2011. Adoption is massive: it is one of the most downloaded npm packages and ships with or alongside many popular testing stacks. Its plugin architecture extends its utility into domains like HTTP testing (chai-http) and promises (chai-as-promised).
Created in December 2011, Chai emerged when Node.js testing tooling was still forming. It became the de facto assertion companion to Mocha and remained dominant through most of the 2010s. Jest's rise introduced built-in assertions that reduced the need for a separate library in new projects.
Chai's star growth is now flat — it gained 0 stars in the last 7 days — reflecting saturation rather than decline. It reached peak mindshare around 2015-2019 as the Mocha+Chai combination became standard. Download counts remain very high due to the vast number of existing projects and transitive dependencies, but new project adoption likely skews toward Jest's built-in assertions. Growth is now purely inertial.
Chai is among the top downloaded packages on npm with hundreds of millions of monthly downloads historically. It is a declared or transitive dependency in countless open-source projects and production codebases. Direct adoption evidence is overwhelming at ecosystem scale, even if new project adoption rates have slowed.
Appears to be a single-package library with a plugin system built around a central `use()` API. Likely modular internally, with separate entry points for each assertion style (register-assert, register-expect, register-should). Related utilities (deep-eql, assertion-error, loupe, pathval, check-error) are maintained as separate packages under the chaijs GitHub org, suggesting a composable, low-coupling design.
Not documented in README, but given the project's age, maturity, and community size, test coverage is likely comprehensive. The presence of a dedicated deep-eql package for equality testing suggests careful attention to correctness.
Last push was June 22, 2026 — 3 days before the evaluation date — indicating active, ongoing maintenance. The project has identified core contributors and alumni, a contributing guide, and an OpenCollective for funding. Maintenance pace appears slow but deliberate, which is appropriate for a mature, stable library.
ADOPT IF: your stack already uses Mocha or another assertion-free test runner and you want a stable, well-documented assertion library with multiple style options and a rich plugin ecosystem. AVOID IF: you are starting a new project with Jest or Vitest, which provide built-in assertions that eliminate the need for a separate library. MONITOR IF: you rely on specific chai plugins (chai-http, chai-as-promised, etc.) — check that those plugins are maintained for your Node.js version, as the plugin ecosystem varies in maintenance quality.
Independent dimensions
Mainstream potential
3/10
Technical importance
7/10
Adoption evidence
9/10
- Declining new project adoption as Jest and Vitest bundle their own assertion APIs, which may gradually reduce community investment and plugin ecosystem activity.
- Plugin ecosystem quality is uneven — third-party chai-* packages are not all maintained at the same cadence as core Chai, creating potential compatibility gaps on newer Node.js versions.
- The 'should' style modifies Object.prototype, which can cause subtle conflicts in complex projects — this is a known and documented limitation but still a practical risk.
- Small active contributor base (3 listed core contributors) means bus-factor risk exists, even though the project has remained consistently maintained so far.
- As TypeScript adoption deepens, the ergonomics of Chai's type definitions may lag behind Jest/Vitest's tightly integrated TypeScript experience, creating friction for TS-first teams.
Chai will remain stable and widely used for years due to its enormous installed base, but is unlikely to regain top-of-mind status for new projects. It will persist as a maintained, niche-but-critical dependency.
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Website
- https://chaijs.github.io
- Language
- JavaScript
- License
- MIT
- Last updated
- 1d ago
- Created
- 178mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
`TypeError: Cannot read properties of undefined (reading 'indexOf')` with `chai.expect(func).throws('boom!')` and `func` throws non error instance
`truncateThreshold: 0` prints `process` and triggers DeprecationWarning
Dependency Dashboard
Disable loupe's `customInspect` option to avoid collisions.
Async support in core
Top contributors
Recent releases
Similar repos
chaijs/chai-as-promised
Chai as Promised extends the Chai assertion library with fluent syntax for...
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
8.3k | +1 | JavaScript | 8/10 | 1d ago |
|
|
1.4k | — | JavaScript | 8/10 | 4d ago |
|
|
23k | — | JavaScript | 9/10 | 1d ago |
|
|
15.8k | — | JavaScript | 8/10 | 6d ago |
|
|
5.4k | — | TypeScript | 8/10 | 7h ago |
|
|
9.9k | — | JavaScript | 8/10 | 3d ago |
Jest ships its own `expect` API that covers most of Chai's use cases without an additional dependency. For projects already using Jest, Chai adds little unless specific plugins are needed. This is the primary reason Chai's new adoption has slowed.
Node's built-in assert module requires no installation and has improved significantly. For minimalist setups, it competes directly with Chai's assert style, though Chai's error messages and plugin ecosystem remain superior.
Vitest, the fast-growing Vite-native test runner, includes a Jest-compatible expect API. New projects on the Vite/Vitest stack have little incentive to add Chai separately.
Jasmine also bundles its own matchers. Like Jest and Vitest, it reduces the need for Chai when used as an all-in-one solution.
A historical competitor for the 'should' style. Largely inactive now; Chai's `should` interface covers the same ground while the project has remained maintained.