HTML Report: source link + code snippet on Source tab (#5993) by thomhurst · Pull Request #6100 · thomhurst/TUnit (original) (raw)

@thomhurst

Closes #5993. The HTML report's Source tab only showed path:line. When running in GitHub Actions it now also renders a "Jump to source" link and a lazily-fetched code snippet of the test method.

Shared GitHubSourceLink.ToRepoRelativePath helper extracted from GitHubReporter so both reporters strip workspace-relative paths the same way. CI context (repo/sha/workspace/serverUrl) is read once per report build.

Also fixes a pre-existing off-by-one: GitHubReporter source links added +1 to an already-1-based line number, pointing one line below the test.

[claude[bot]](/apps/claude)

@thomhurst

…ppet

[claude[bot]](/apps/claude)

[claude[bot]](/apps/claude)

@thomhurst

Prevent GITHUB_REPOSITORY/GITHUB_SHA leaking into subsequent tests.

[claude[bot]](/apps/claude)

@thomhurst

Detect the CI provider (GitHub, GitLab, Bitbucket) in C# and emit pre-substituted URL templates into the report; the client only fills {path}/{line}/{start}/{end}, so there is zero provider-specific JS and the report shrinks. Inline snippets are enabled only where the raw endpoint allows cross-origin fetch (GitHub.com, Bitbucket Cloud); GitLab and GitHub Enterprise are link-only. Never default an unknown server to github.com.

[claude[bot]](/apps/claude)

@thomhurst

Quality cleanup, no behavior change: rename GitHubSourceLink -> SourcePathResolver (now provider-agnostic), drop redundant workspace normalization at call sites (ToRepoRelativePath already normalizes), and switch the source-tab JS from string concatenation to template literals.

[claude[bot]](/apps/claude)

This was referenced

Jun 12, 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

[ Show hidden characters]({{ revealButtonHref }})