Fix ANSI color parsing and add specs

What does this MR do and why?

Fix ANSI color parsing for job logs and add specs.

References

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. Check out this branch
  2. In the GDK, create a new project and add a .gitlab-ci.yml file.
  3. Add this to the file:
image: busybox:latest

ansi:
  stage: build
  script:
    - echo -e "\e[101m Background bright red,\e[49m now cleared,\e[91m Foreground bright red,\e[39m now cleared."
    - printf '\e[101m Background bright red,\e[49m now cleared,\e[91m Foreground bright red,\e[39m now cleared.'
  1. Run a new pipeline
  2. Depending on how you run runners on your development setup, either one or both of the script statements will have colored log output, and it will match the "After" screenshot above, with red background ending before now cleared.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #324896 (closed)

Merge request reports

Loading