diff --git a/docs/src/test-api/class-testinfoerror.md b/docs/src/test-api/class-testinfoerror.md index e5b81d2bb3..66e78ecabd 100644 --- a/docs/src/test-api/class-testinfoerror.md +++ b/docs/src/test-api/class-testinfoerror.md @@ -4,42 +4,12 @@ Information about an error thrown during test execution. -## property: TestInfoError.actual -* since: v1.49 -- type: ?<[string]> - -Actual value. - -## property: TestInfoError.expected -* since: v1.49 -- type: ?<[string]> - -Expected value. - -## property: TestInfoError.locator -* since: v1.49 -- type: ?<[string]> - -Receiver's locator. - -## property: TestInfoError.log -* since: v1.49 -- type: ?<[Array]<[string]>> - -Call log. - ## property: TestInfoError.message * since: v1.10 - type: ?<[string]> Error message. Set when [Error] (or its subclass) has been thrown. -## property: TestInfoError.shortMessage -* since: v1.49 -- type: ?<[string]> - -Failure message. - ## property: TestInfoError.stack * since: v1.10 - type: ?<[string]> diff --git a/packages/playwright/src/worker/util.ts b/packages/playwright/src/worker/util.ts index 670a21341f..c8c4c67262 100644 --- a/packages/playwright/src/worker/util.ts +++ b/packages/playwright/src/worker/util.ts @@ -14,18 +14,19 @@ * limitations under the License. */ +import type { TestError } from '../../types/testReporter'; import type { TestInfoError } from '../../types/test'; import type { MatcherResult } from '../matchers/matcherHint'; import { serializeError } from '../util'; -export function serializeWorkerError(error: Error | any): TestInfoError { +export function serializeWorkerError(error: Error | any): TestInfoError & Pick { return { ...serializeError(error), ...serializeExpectDetails(error), }; } -function serializeExpectDetails(e: Error): Pick { +function serializeExpectDetails(e: Error): Pick { const matcherResult = (e as any).matcherResult as MatcherResult; if (!matcherResult) return {}; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 86f2369db4..a989fe69b2 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -9149,36 +9149,11 @@ export interface TestInfo { * Information about an error thrown during test execution. */ export interface TestInfoError { - /** - * Actual value. - */ - actual?: string; - - /** - * Expected value. - */ - expected?: string; - - /** - * Receiver's locator. - */ - locator?: string; - - /** - * Call log. - */ - log?: Array; - /** * Error message. Set when [Error] (or its subclass) has been thrown. */ message?: string; - /** - * Failure message. - */ - shortMessage?: string; - /** * Error stack. Set when [Error] (or its subclass) has been thrown. */