Skip to content
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
30 changes: 22 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
/// <reference types="jest"/>

type DiffOptions = {
expand?: boolean,
colors?: boolean,
contextLines?: number,
};
expand?: boolean
colors?: boolean
contextLines?: number
}

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

declare module 'snapshot-diff' {
function diff(a: any, b: any, options?: DiffOptions): string;
namespace diff {}
export = diff;
declare module "snapshot-diff" {
interface SnapshotDiff {
/**
* Compare the changes from a, to b
*/
(a: any, b: any, options?: DiffOptions): string
/**
* Allows you to pull out toMatchDiffSnapshot and
* make it available via `expect.extend({ toMatchDiffSnapshot })`.
*/
toMatchDiffSnapshot: (newObject: any) => void
}
const diff: SnapshotDiff
export = diff
}