Skip to content

Commit

Permalink
chore(expect): add 2 print utils to main expect export (expect.print)…
Browse files Browse the repository at this point in the history
… (print utils from src/print)
  • Loading branch information
mrienstra committed Sep 9, 2021
1 parent 65912a8 commit e3140f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/expect/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import {
setState,
} from './jestMatchersObject';
import matchers from './matchers';
import {
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring,
} from './print';
import spyMatchers from './spyMatchers';
import toThrowMatchers, {
createMatcher as createThrowMatcher,
Expand Down Expand Up @@ -358,6 +362,11 @@ expect.extend = (matchers: MatchersObject): void =>
setMatchers(matchers, false, expect);
expect.matchers = matchers;

expect.print = {
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring,
};

expect.anything = anything;
expect.any = any;

Expand Down
11 changes: 11 additions & 0 deletions packages/expect/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ export type Expect = {
[id: string]: AsymmetricMatcher;
not: {[id: string]: AsymmetricMatcher};
matchers: MatchersObject;
print: {
printReceivedStringContainExpectedResult(
received: string,
result: RegExpExecArray | null,
): string;
printReceivedStringContainExpectedSubstring(
received: string,
start: number,
length: number,
): string;
};
};

interface Constructable {
Expand Down

0 comments on commit e3140f5

Please sign in to comment.