Ghost/test/utils/snapshots.js
Naz 5a150cc3b6 Removed duplicate snapshot initialization code
refs https://github.com/TryGhost/Toolbox/issues/158

- Allows for much smaller amount of code to configure a test to work with chai-jest-snapshots. They now work automatically for all regression tests and could be enabled for other suites by adding the "--require=./test/utils/snapshots.js" parameter in respective test:* package script
- Regenerated snapshot for authentication test as the naming structure
changed a little with the snapshot metadata being taken on a higher
level in the test (uses the suite name instead of a specific describe it
used to be called from)
2021-12-10 06:37:31 +13:00

15 lines
316 B
JavaScript

const chai = require('chai');
const chaiJestSnapshot = require('@ethanresnick/chai-jest-snapshot');
chai.use(chaiJestSnapshot);
exports.mochaHooks = {
beforeAll() {
chaiJestSnapshot.resetSnapshotRegistry();
},
beforeEach() {
chaiJestSnapshot.configureUsingMochaContext(this);
}
};