mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add new options to MatchImageSnapshotOptions * toMatchImageSnapshot can be given options directly instead of needing to use configureToMatchImageSnapshot for specifying the options.
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
// Typescript Version: 2.3
|
|
import { toMatchImageSnapshot, configureToMatchImageSnapshot, MatchImageSnapshotOptions } from 'jest-image-snapshot';
|
|
|
|
it('should be able to use toMatchImageSnapshot in a test', () => {
|
|
expect.extend({ toMatchImageSnapshot });
|
|
|
|
expect(400).toMatchImageSnapshot();
|
|
});
|
|
|
|
it('should be able to use configureToMatchImageSnapshot in a test', () => {
|
|
const matchFn = configureToMatchImageSnapshot({
|
|
noColors: true,
|
|
customDiffConfig: {
|
|
threshold: 5,
|
|
includeAA: false
|
|
},
|
|
failureThreshold: 10,
|
|
failureThresholdType: 'percent'
|
|
});
|
|
expect.extend({ toMatchImageSnapshot: matchFn });
|
|
|
|
expect('Me').toMatchImageSnapshot();
|
|
});
|
|
|
|
it('Should be able to use configuration directly in toMatchImageSnapshot', () => {
|
|
expect.extend({ toMatchImageSnapshot });
|
|
|
|
const options: MatchImageSnapshotOptions = {
|
|
noColors: true,
|
|
customDiffConfig: {
|
|
threshold: 5,
|
|
includeAA: false
|
|
},
|
|
customDiffDir: './diffs',
|
|
diffDirection: 'vertical',
|
|
updatePassedSnapshot: true,
|
|
failureThreshold: 10,
|
|
failureThresholdType: 'percent'
|
|
};
|
|
|
|
expect('Me').toMatchImageSnapshot(options);
|
|
});
|