Chai Snapshot Tests
Adds support for Jest-like snapshot testing
to chai. It works by creating a __snapshots__
directory alongside your tests,
which contains the snapshot files in json
format.
Installation
# npm npm install --save-dev chai-snapshot-tests # yarn yarn add --dev chai-snapshot-tests
Usage
const chai = ;const snapshots = ; // snapshots will be created relative to the current file// `foo/bar/mytest.js` -> `foo/bar/__snapshots__/mytest.js.json`chai; const assert expect = chai; // Example with strings, but works with anything!// With assert style assertionsassert;// or with expect style assertions; // Pass `true` to update the snapshot `snapName` with a new value;
License
MIT, see License.md