Skip to content

Pretty-print html() output by default #1147

Closed
@ianwalter

Description

@ianwalter

What problem does this feature solve?

My team is using @vue/test-utils for snapshot testing components but the snapshots are hard to parse because the HTML string output from .html() is not formatted in a readable way. If html() pretty-printed the HTML it would be a lot easier to review changes to the component-generated HTML.

What does the proposed API look like?

html() would pretty-print the returned HTML string by default, perhaps using something like https://github.com/prettydiff/prettydiff. If necessary, a user could bypass pretty-printing by passing an option to .html(), perhaps .html(false) or .html({ prettyPrint: false }).

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