no public TestInfoError

This commit is contained in:
Yury Semikhatsky 2024-10-18 13:55:44 -07:00
parent 0669a71309
commit 845c521cf9
3 changed files with 3 additions and 57 deletions

View file

@ -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]>

View file

@ -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<TestError, 'shortMessage'|'log'|'expected'|'actual'|'locator'> {
return {
...serializeError(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>;
if (!matcherResult)
return {};

View file

@ -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<string>;
/**
* 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.
*/