Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#51439 update(jest-image-snapshot): v4.3 up…
Browse files Browse the repository at this point in the history
…date by @peterblazejewicz

- `dumpInlineDiffToConsole` option
- align with 4.3 version deps
- drop v.2 to avoid maintenance burden
- minor code format

https://github.com/americanexpress/jest-image-snapshot#%EF%B8%8F-api

Thanks!
  • Loading branch information
peterblazejewicz committed Feb 26, 2021
1 parent f6ddda2 commit 2a84cde
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 209 deletions.
13 changes: 11 additions & 2 deletions types/jest-image-snapshot/index.d.ts
@@ -1,4 +1,4 @@
// Type definitions for jest-image-snapshot 4.1
// Type definitions for jest-image-snapshot 4.3
// Project: https://github.com/americanexpress/jest-image-snapshot#readme
// Definitions by: Janeene Beeforth <https://github.com/dawnmist>
// erbridge <https://github.com/erbridge>
Expand Down Expand Up @@ -59,6 +59,12 @@ export interface MatchImageSnapshotOptions {
* @default false
*/
dumpDiffToConsole?: boolean;
/**
* Will output the image to the terminal using iTerm's Inline Images Protocol.
* If the term is not compatible, it does the same thing as `dumpDiffToConsole`.
* @default false
*/
dumpInlineDiffToConsole?: boolean;
/**
* Removes coloring from the console output, useful if storing the results to a file.
* @default false.
Expand Down Expand Up @@ -117,7 +123,10 @@ export function configureToMatchImageSnapshot(
/**
* Mutates original state with new state
*/
export function updateSnapshotState<TObject, TPartial>(originalSnapshotState: TObject, partialSnapshotState: TPartial): TObject & TPartial;
export function updateSnapshotState<TObject, TPartial>(
originalSnapshotState: TObject,
partialSnapshotState: TPartial,
): TObject & TPartial;

declare global {
namespace jest {
Expand Down
9 changes: 7 additions & 2 deletions types/jest-image-snapshot/jest-image-snapshot-tests.ts
@@ -1,5 +1,9 @@
// Typescript Version: 2.3
import { configureToMatchImageSnapshot, MatchImageSnapshotOptions, toMatchImageSnapshot, updateSnapshotState } from 'jest-image-snapshot';
import {
configureToMatchImageSnapshot,
MatchImageSnapshotOptions,
toMatchImageSnapshot,
updateSnapshotState,
} from 'jest-image-snapshot';

it('should be able to use toMatchImageSnapshot in a test', () => {
expect.extend({ toMatchImageSnapshot });
Expand Down Expand Up @@ -35,6 +39,7 @@ it('Should be able to use configuration directly in toMatchImageSnapshot', () =>
},
customDiffDir: './diffs',
diffDirection: 'vertical',
dumpInlineDiffToConsole: true,
updatePassedSnapshot: true,
failureThreshold: 10,
failureThresholdType: 'percent',
Expand Down
2 changes: 1 addition & 1 deletion types/jest-image-snapshot/package.json
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"ssim.js": "^3.1.0"
"ssim.js": "^3.1.1"
}
}
117 changes: 0 additions & 117 deletions types/jest-image-snapshot/v2/index.d.ts

This file was deleted.

58 changes: 0 additions & 58 deletions types/jest-image-snapshot/v2/jest-image-snapshot-tests.ts

This file was deleted.

28 changes: 0 additions & 28 deletions types/jest-image-snapshot/v2/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion types/jest-image-snapshot/v2/tslint.json

This file was deleted.

0 comments on commit 2a84cde

Please sign in to comment.