Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add setSerializers and defaultSerializers to TS types #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
thymikee merged 1 commit into master from fix/ts
Nov 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions index.d.ts
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,42 +1,60 @@
/// <reference types="jest"/>

type DiffOptions = {
expand?: boolean
colors?: boolean
contextLines?: number
stablePatchmarks?: boolean
aAnnotation?: string
bAnnotation?: string
}
expand?: boolean;
colors?: boolean;
contextLines?: number;
stablePatchmarks?: boolean;
aAnnotation?: string;
bAnnotation?: string;
};

declare namespace jest {
interface Matchers<R, T> {
/**
* Compare the difference between the actual in the `expect()`
* vs the object inside `valueB` with some extra options.
*/
toMatchDiffSnapshot(valueB: any, options?: DiffOptions, testName?: string): R
toMatchDiffSnapshot(
valueB: any,
options?: DiffOptions,
testName?: string
): R;
}
}

declare module "snapshot-diff" {
interface Serializer {
test: (value: any) => boolean;
print: (value: any, _serializer?: Function) => string;
diffOptions: (valueA: any, valueB: any) => DiffOptions;
}

declare module 'snapshot-diff' {
interface SnapshotDiff {
/**
* Compare the changes from a, to b
*/
(a: any, b: any, options?: DiffOptions): string
(a: any, b: any, options?: DiffOptions): string;
/**
* Allows you to pull out toMatchDiffSnapshot and
* make it available via `expect.extend({ toMatchDiffSnapshot })`.
*/
toMatchDiffSnapshot: jest.CustomMatcher
toMatchDiffSnapshot: jest.CustomMatcher;
/**
* By default Jest adds extra quotes around strings so it makes diff
* snapshots of objects too noisy. To fix this – snapshot-diff comes
* with custom serializer.
*/
getSnapshotDiffSerializer: () => jest.SnapshotSerializerPlugin
getSnapshotDiffSerializer: () => jest.SnapshotSerializerPlugin;
/**
* Add new serializers for unsupported data types, or to set a different
* serializer for React components. If you want to keep the default React
* serializer in place, don't forget to add the default serializers to your
* list of serializers.
*/
setSerializers: (serializers: Array<Serializer>) => void;
defaultSerializers: Array<Serializer>;
}
const diff: SnapshotDiff
export = diff
const diff: SnapshotDiff;
export = diff;
}

AltStyle によって変換されたページ (->オリジナル) /