Skip to content

fix(browser): resolve browser failure annotations to test sources in github-actions reporter#989

Merged
fi3ework merged 1 commit intomainfrom
974
Feb 28, 2026
Merged

fix(browser): resolve browser failure annotations to test sources in github-actions reporter#989
fi3ework merged 1 commit intomainfrom
974

Conversation

@fi3ework
Copy link
Copy Markdown
Member

@fi3ework fi3ework commented Feb 27, 2026

fix #974

Summary

In browser mode, test failure annotations in the github-actions reporter pointed to the HTTP-served bundle URL (e.g. http://localhost:PORT/@fs/...) instead of the original source file path. This prevented GitHub from correctly mapping errors back to source files.

Root Causes

  • BrowserTestRunResult had no getSourcemap implementation — the host controller always returned null, so reporters could never resolve browser stack frames to source files.
  • The sourcemap sources entries contained URL-relative paths or webpack:/// prefixes, which the Node.js reporter couldn't resolve to absolute filesystem paths.
  • After sourcemap resolution, HTTP frames that failed to map to user source still leaked through the stack filter.

Changes

  • Add packages/browser/src/sourceMap/sourceMapLoader.ts — shared source map fetching utility (inline + external .map) with caching, used by both the browser client and the host controller.
  • hostController.ts — implement getBrowserSourcemap: loads source maps for browser JS bundles and resolves sources entries (relative paths, webpack:/// prefixes) to absolute filesystem paths. Pass getSourcemap through BrowserTestRunResult so reporters receive real source locations. Fix browser runtime close lifecycle so cleanup runs correctly in all exit paths.
  • core/runTests.ts — build a unified getSourcemap that checks browser source maps first, then falls back to node bundler source maps.
  • core/utils/error.ts — add defaultResolveSourcePath to handle HTTP-origin frames correctly, add resolveSourcePath option on parseErrorStacktrace, and add a post-resolution filter to drop frames that remain as HTTP URLs (unresolved browser runtime internals).
  • Add E2E test e2e/browser-mode/githubActions.test.ts to assert that github-actions reporter annotations point to the correct source file and line.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@fi3ework fi3ework force-pushed the 974 branch 2 times, most recently from 43f5084 to b401bd7 Compare February 28, 2026 03:45
@fi3ework fi3ework marked this pull request as ready for review February 28, 2026 04:57
@fi3ework fi3ework requested a review from 9aoy February 28, 2026 04:57
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b401bd7449

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Amp-Thread-ID: https://ampcode.com/threads/T-019ca2d8-93c3-758c-b127-d32b39c04b83
Co-authored-by: Amp <amp@ampcode.com>
@fi3ework fi3ework merged commit d2fe679 into main Feb 28, 2026
15 of 17 checks passed
@fi3ework fi3ework deleted the 974 branch February 28, 2026 06:54
@fi3ework fi3ework mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GitHub Action reporter not working

2 participants