Skip to content

CI: display ansi codes when an assert-line fails #454

Open
@webstech

Description

@webstech

During test development, the ansi codes may not always be well understood. The current bats default error display does not help with determining the actual sequence of codes since the drivers are eating the codes. The bats framework uses cat to display the failing line in assertion tests.

What would be useful is to display the ansi codes in the error message. This could be done in a couple of ways to make the escape character not an escape character.

  1. change the generic run printf "%s" "$output" in tests to run printf "%s" "${output//\e/E}". Tests would need to check for E[ instead of \e[.
  2. introduce a mock for the cat command that does the escape character change. The test cases would need to set/unset the mock but the asserts would not change.

Any interest in this? There may be other options but these both work (have been tested) and are simple to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions