Skip to content

[Feature]: Improve Formatting of Assertion Error Messages #34044

Open
@hardeep-qa

Description

@hardeep-qa

🚀 Feature Request

Currently, assertion error messages can be difficult to read, especially when dealing with complex data structures. This hinders debugging and troubleshooting efforts.

For example, the assertion:
expect(message).toHaveLength(0);

Produces the following output:

Expected length: 0
Received length: 1
Received array: [{"criticality": {"level": "NON_BREAKING"}, "message": "Field 'product' was added to object type 'Query'", "meta": {"addedFieldName": "product", "typeName": "Query", "typeType": "object type"}]

This raw output of 'Received array' is not easy to read and can make it time-consuming to identify the root cause of the error.

Proposed Solution:
Introduce a feature to format assertion error messages or format it by default, making them more readable and developer-friendly.

Image

Example

No response

Motivation

Format assertion error messages or format it by default, making them more readable and developer-friendly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions