Repository navigation
First release of the 2.x line on npm. The 2.x line adds support for chai 5 and 6 and includes breaking changes for anyone upgrading from 1.x.
Breaking changes
-
Dropped support for chai < 5. The peer dependency is now
chai >= 5. -
chai.tv4is no longer set. The tv4 instance is now exposed on the plugin itself instead of on the chai object.Why: chai 5 and 6 are ES modules. The module namespace object exported by an ES module is sealed, so new properties cannot be added to it. Setting
chai.tv4 = ...from a plugin silently fails in these versions, making the tv4 configuration API completely broken for anyone on chai 5+.Migrate configuration calls:
const chai = require('chai'); // before chai.use(require('chai-json-schema')); chai.tv4.addSchema('http://example.com/schema', schema); chai.tv4.cyclicCheck = true; // after const chaiJsonSchema = require('chai-json-schema'); chai.use(chaiJsonSchema); chaiJsonSchema.tv4.addSchema('http://example.com/schema', schema); chaiJsonSchema.tv4.cyclicCheck = true;
The
jsonSchemaandnotJsonSchemaassertion methods themselves are unchanged.
Other changes
- Dropped Node 18 support (
enginesis now>= 20). Node 18 cannotrequire()ES modules, which chai 5+ are. - Removed
serialize-javascriptoverride (mocha now ships a non-vulnerable version directly).
Functionally identical to the 2.0.0 tag.