Skip to content

Truncating titles #2581

Open
Open
@make-github-pseudonymous-again

Description

I often find myself formatting generated long test and macro titles to shorter strings (I never felt the need to do this for assertion titles, as I rarely use them). I do this to avoid littering AVA's output. See for instance here where I truncate large integer string representations or here where I did not truncate the title string by lack of motivation to implement yet another custom truncation function.

I thought it would make sense to have some sensible default tagged template literal function to nicelly format these. I think it can easily be implemented independently from AVA (requiring to manually tag each title template literal). Do you think it would make sense to include such a solution as part of the ava package?

I do not think such a transformation should be applied by default to all titles, since, as I understand it, titles are used as test unique keys. Now only the printed title could be altered but in case of an error there would be no way to visually distinguish between two tests whose distinct titles get formatted to the same printed string. Although a solution in that case would be to dump the unique title without formatting.

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