Skip to content

Commit

Permalink
chore: remove references to jest expand (#30988)
Browse files Browse the repository at this point in the history
Since #7722 we always set
expand to false
[here](https://github.com/microsoft/playwright/blob/a106428114a7948f4c51e85a67fd4ce930a466f1/packages/playwright/src/matchers/expect.ts#L176)
and don't expose any means to change that (in jest it's
expect.setState).
  • Loading branch information
yury-s committed May 23, 2024
1 parent a106428 commit f7b0490
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/playwright/src/matchers/toEqual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import type { Locator } from 'playwright-core';
const EXPECTED_LABEL = 'Expected';
const RECEIVED_LABEL = 'Received';

// The optional property of matcher context is true if undefined.
const isExpand = (expand?: boolean): boolean => expand !== false;

export async function toEqual<T>(
this: ExpectMatcherContext,
matcherName: string,
Expand Down Expand Up @@ -61,7 +58,7 @@ export async function toEqual<T>(
received,
EXPECTED_LABEL,
RECEIVED_LABEL,
isExpand(this.expand),
false,
) + callLogText(log);

// Passing the actual and expected objects so that a custom reporter
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/matchers/toMatchText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function toMatchText(
const labelExpected = `Expected ${typeof expected === 'string' ? stringSubstring : 'pattern'}`;
if (notFound)
return messagePrefix + `${labelExpected}: ${this.utils.printExpected(expected)}\nReceived: ${received}` + callLogText(log);
return messagePrefix + this.utils.printDiffOrStringify(expected, receivedString, labelExpected, 'Received string', this.expand !== false) + callLogText(log);
return messagePrefix + this.utils.printDiffOrStringify(expected, receivedString, labelExpected, 'Received string', false) + callLogText(log);
}
};

Expand Down

0 comments on commit f7b0490

Please sign in to comment.