Registry / testing / chai-things

chai-things

JSON →
library0.2.0jsnpmunverified

Chai Things (v0.2.0, unmaintained since 2015) extends Chai assertion library with array element matchers like `include.something.that`, `all`, and `none`. Allows deep equality, property, and nested assertions on arrays. Last updated on npm in 2016; no releases for 9+ years. Use with Chai v4.x but may have compatibility issues. Alternative: use native Chai `members` matcher with deep equality or Lodash`_.some`/_.every.

npm install chai-things
INSTALL
IMPORT
SIG · CHAI-THINGS
C
chai-things
testingjavascriptv0.2.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import chaiThings from 'chai-things'; chai.use(chaiThings);
✗ const chaiThings = require('chai-things'); chai.use(chaiThings);
CommonJS require works but is not recommended for ESM projects. The package does not export named symbols.
chai-things
✓ import 'chai-things'; // side-effect import when used via chai.should()
✗ import { something } from 'chai-things';
chai-things does not export named symbols; it only registers Chai plugins and extends the assertion chain.
Plugin usage
✓ chai.use(require('chai-things')); // CommonJS
✗ const { Plugin } = require('chai-things');
chai-things must be used with chai.use(). There is no default export or Plugin class.

Install chai-things, register with chai, and use include.something.that / all / none assertions on arrays.

const chai = require('chai'); chai.should(); chai.use(require('chai-things')); // Example: const items = [{ a: 1 }, { b: 2 }]; items.should.include.something.that.deep.equals({ b: 2 }); // passes items.should.all.have.property('a'); // fails because { b: 2 } does not have property 'a' items.should.not.include.something.that.deep.equals({ c: 3 }); // passes
Debug
Known issues
deprecatedPackage has not been updated since 2016. It may not work with Chai 5.x or newer.
fix
Consider using chai.assert.deepInclude or other native Chai methods, or migrate to a maintained library.
affects: >=0.2.0
gotchaCannot be used with ESM imports directly; only CommonJS require works reliably.
fix
Use dynamic import: const chaiThings = (await import('chai-things')).default;
affects: >=0.2.0
breakingIn Chai 4.x, 'should' interface requires chai.should() call before chai.use(require('chai-things')).
fix
Always call chai.should() earlier or use chai.expect with chai-things.
affects: >=0.0.1
gotchaThe 'all' and 'none' matchers treat empty arrays as vacuously true (all matches everything, none matches nothing).
fix
Add explicit length check if needed: arr.should.have.length.gt(0).and.all.satisfy(...).
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: Cannot read property 'use' of undefined
chai is not imported or chai.should() not called.
fix
Ensure you have required chai and called chai.should() or chai.expect before using chai-things.
AssertionError: expected [] to include something that deeply equals ...
Using something matcher on an empty array; no element matches.
fix
Check that array is not empty or use include.something.that on non-empty arrays.
chai-things: Error: cannot call include.something.that on non-array value
Attempting to use include.something.that on a non-array object.
fix
Ensure the value being tested is an Array.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
chairequiredpeer dependency; required to use chai-things
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
chai-things — npm install chai-things · libregistry