mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
chai-jest-snapshots doesn't use `export default`, so `import * as chaiJestSnapshots from 'chai-jest-snapshots'` gives compiler errors and `import chaiJestSnapshots from 'chai-jest-snapshots'` gives runtime errors
24 lines
714 B
TypeScript
24 lines
714 B
TypeScript
import * as chaiJestSnapshot from 'chai-jest-snapshot';
|
|
import { expect } from 'chai';
|
|
|
|
chai.use(chaiJestSnapshot);
|
|
|
|
expect({}).to.matchSnapshot();
|
|
expect({}).to.matchSnapshot(true);
|
|
expect({}).to.matchSnapshot("filename");
|
|
expect({}).to.matchSnapshot("filename", "snapshotname");
|
|
expect({}).to.matchSnapshot("filename", "snapshotname", false);
|
|
|
|
const mockContext: Mocha.IBeforeAndAfterContext = <any> {
|
|
currentTest: {
|
|
file: 'testfile',
|
|
fullTitle: () => 'fullTitle'
|
|
}
|
|
};
|
|
|
|
chaiJestSnapshot.setFilename("filename");
|
|
chaiJestSnapshot.setTestName("testname");
|
|
chaiJestSnapshot.configureUsingMochaContext(mockContext);
|
|
chaiJestSnapshot.resetSnapshotRegistry();
|
|
chaiJestSnapshot.addSerializer({});
|