no public TestInfoError
This commit is contained in:
parent
0669a71309
commit
845c521cf9
|
|
@ -4,42 +4,12 @@
|
||||||
|
|
||||||
Information about an error thrown during test execution.
|
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
|
## property: TestInfoError.message
|
||||||
* since: v1.10
|
* since: v1.10
|
||||||
- type: ?<[string]>
|
- type: ?<[string]>
|
||||||
|
|
||||||
Error message. Set when [Error] (or its subclass) has been thrown.
|
Error message. Set when [Error] (or its subclass) has been thrown.
|
||||||
|
|
||||||
## property: TestInfoError.shortMessage
|
|
||||||
* since: v1.49
|
|
||||||
- type: ?<[string]>
|
|
||||||
|
|
||||||
Failure message.
|
|
||||||
|
|
||||||
## property: TestInfoError.stack
|
## property: TestInfoError.stack
|
||||||
* since: v1.10
|
* since: v1.10
|
||||||
- type: ?<[string]>
|
- type: ?<[string]>
|
||||||
|
|
|
||||||
|
|
@ -14,18 +14,19 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { TestError } from '../../types/testReporter';
|
||||||
import type { TestInfoError } from '../../types/test';
|
import type { TestInfoError } from '../../types/test';
|
||||||
import type { MatcherResult } from '../matchers/matcherHint';
|
import type { MatcherResult } from '../matchers/matcherHint';
|
||||||
import { serializeError } from '../util';
|
import { serializeError } from '../util';
|
||||||
|
|
||||||
export function serializeWorkerError(error: Error | any): TestInfoError {
|
export function serializeWorkerError(error: Error | any): TestInfoError & Pick<TestError, 'shortMessage'|'log'|'expected'|'actual'|'locator'> {
|
||||||
return {
|
return {
|
||||||
...serializeError(error),
|
...serializeError(error),
|
||||||
...serializeExpectDetails(error),
|
...serializeExpectDetails(error),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function serializeExpectDetails(e: Error): Pick<TestInfoError, 'shortMessage'|'log'|'expected'|'actual'|'locator'> {
|
function serializeExpectDetails(e: Error): Pick<TestError, 'shortMessage'|'log'|'expected'|'actual'|'locator'> {
|
||||||
const matcherResult = (e as any).matcherResult as MatcherResult<unknown, unknown>;
|
const matcherResult = (e as any).matcherResult as MatcherResult<unknown, unknown>;
|
||||||
if (!matcherResult)
|
if (!matcherResult)
|
||||||
return {};
|
return {};
|
||||||
|
|
|
||||||
25
packages/playwright/types/test.d.ts
vendored
25
packages/playwright/types/test.d.ts
vendored
|
|
@ -9149,36 +9149,11 @@ export interface TestInfo {
|
||||||
* Information about an error thrown during test execution.
|
* Information about an error thrown during test execution.
|
||||||
*/
|
*/
|
||||||
export interface TestInfoError {
|
export interface TestInfoError {
|
||||||
/**
|
|
||||||
* Actual value.
|
|
||||||
*/
|
|
||||||
actual?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expected value.
|
|
||||||
*/
|
|
||||||
expected?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Receiver's locator.
|
|
||||||
*/
|
|
||||||
locator?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call log.
|
|
||||||
*/
|
|
||||||
log?: Array<string>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error message. Set when [Error] (or its subclass) has been thrown.
|
* Error message. Set when [Error] (or its subclass) has been thrown.
|
||||||
*/
|
*/
|
||||||
message?: string;
|
message?: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Failure message.
|
|
||||||
*/
|
|
||||||
shortMessage?: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error stack. Set when [Error] (or its subclass) has been thrown.
|
* Error stack. Set when [Error] (or its subclass) has been thrown.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue