test(html): validate generated HTML is well-formed#812
Merged
Conversation
Adds an HTML5-parser-based check (html5ever) that parses every generated HTML file and asserts it has no parse errors, wired into the test suite via `html_output_is_valid` over the comprehensive "multiple" fixture. Setting this up surfaced one real defect: the symbol redirect pages were emitted as a bare `<meta http-equiv="refresh">` with no document structure, which is not a valid HTML document. Make the redirect template a complete document (doctype/head/body) with a visible fallback link, so all generated HTML now validates.
|
|
crowlKats
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Sets up HTML validation in the HTML test suite (issue #634): generated HTML should be checked for missing closing tags / invalid markup, not just snapshot-compared.
assert_generated_html_is_validparses every generated.htmlfile with a real HTML5 parser (html5ever+markup5ever_rcdom) and asserts the parse produced no errors. It's wired in viahtml_output_is_valid, which runs it over the comprehensivemultiplefixture (classes, interfaces, enums, type aliases, namespaces, drilldown member pages, redirects, and the all-symbols/index pages).Fix surfaced while setting this up
The validator immediately caught one real defect: the symbol redirect pages (e.g.
~/Foo.prototype.html) were emitted as a bare<meta http-equiv="refresh" …>with no surrounding document — not a valid HTML document. The content pages were all already clean.The redirect template is now a complete HTML document (doctype,
<head>with charset/title,<body>) with a visible fallback link for users whose browsers don't honor the meta refresh. With that, every generated page validates.Notes
html5ever/markup5ever_rcdomare added asdev-dependenciesonly.Unexpected token) and passes after.Fixes #634