Skip to content

test: analyse need for golden-file assertions on generator/parser HTML output #69

Description

@harrydayexe

Is your feature request related to a problem? Please describe.
The product's primary output — generated HTML — is asserted with weak substring
checks at the generator and parser layers (e.g. contains "<h1",
"Test Post", "<strong>valid</strong>"), and there are no .golden expected-
output files. A regression that mangled surrounding markup, dropped an
attribute, reordered sections, or corrupted escaping while still emitting the
asserted substring would pass unnoticed.

Note this is scoped to the generator/parser rendering layers only — the
outputter already does byte-for-byte content comparison
(directoryWriter_test.go), so the write layer is not in question.

Describe the solution you'd like
An analysis (not necessarily implementation in this issue) of whether golden-file
/ byte-exact assertions should be introduced for a few representative renders.
The analysis should produce a recommendation covering:

  • Which documents are worth snapshotting (e.g. a post with code + footnotes, the
    index, a tag page) vs. keeping substring checks.
  • A normalisation strategy for volatile fields (e.g. Year/date) and volatile
    markup (goldmark version bumps, syntax-highlight spans).
  • Whether to adopt a -update flag convention for regenerating goldens.

Describe alternatives you've considered

  • Keep substring assertions as-is (cheapest, but weak on the Add parser and logging #1 named failure
    mode: incorrect HTML).
  • Golden-everything (rejected pre-emptively — churny, breaks on every goldmark
    bump).

Additional context
Raised by the testing audit (golden-file finding, Medium). This issue only asks
for the analysis/decision; any implementation can be split out once the scope is
agreed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or improvement suggested by users

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions