From f7b0490500d05d40d77d278ae235536192657676 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 23 May 2024 13:44:15 -0700 Subject: [PATCH] chore: remove references to jest expand (#30988) Since https://github.com/microsoft/playwright/pull/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). --- packages/playwright/src/matchers/toEqual.ts | 5 +---- packages/playwright/src/matchers/toMatchText.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/playwright/src/matchers/toEqual.ts b/packages/playwright/src/matchers/toEqual.ts index c7b99815f9fc6..9dbf30ec5bb5f 100644 --- a/packages/playwright/src/matchers/toEqual.ts +++ b/packages/playwright/src/matchers/toEqual.ts @@ -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( this: ExpectMatcherContext, matcherName: string, @@ -61,7 +58,7 @@ export async function toEqual( received, EXPECTED_LABEL, RECEIVED_LABEL, - isExpand(this.expand), + false, ) + callLogText(log); // Passing the actual and expected objects so that a custom reporter diff --git a/packages/playwright/src/matchers/toMatchText.ts b/packages/playwright/src/matchers/toMatchText.ts index 64759f01b8b2b..1d66ab8d68eeb 100644 --- a/packages/playwright/src/matchers/toMatchText.ts +++ b/packages/playwright/src/matchers/toMatchText.ts @@ -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); } };