Skip to content

Increase test coverage for diagnostic formatting functions #21

Description

@davidnbr

Description

Current test coverage is 38.5%. New functions added in the error formatting feature could use additional test coverage.

Functions Needing More Tests

  • sanitizeTerraformANSI() - edge cases with various ANSI sequences
  • theme() - caching behavior verification
  • renderDiagnosticDetailLine() - various marker patterns and modes
  • createGuideReplacer() - replacement accuracy

Suggested Test Cases

sanitizeTerraformANSI

  • Nested ANSI codes
  • Malformed ANSI sequences
  • Mixed color and formatting codes
  • Empty strings

Theme Caching

  • Verify cache is used on repeated calls
  • Verify cache invalidation after toggleRenderingMode()

renderDiagnosticDetailLine

  • Dashboard mode with error severity
  • Dashboard mode with warning severity
  • HighContrast mode with error severity
  • HighContrast mode with warning severity
  • Lines with underline markers (^, ~)
  • Lines with location markers (on file.tf line X)

Underline Pattern

  • Various indentation levels
  • Mixed ^ and ~ characters
  • Edge cases (empty, whitespace only)

Created from code review of fix_errors_format_default branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions