Skip to content

feat(node): export capturePrintError#10253

Closed
samchungy wants to merge 1 commit intovitest-dev:mainfrom
samchungy:export-helpful-reporters
Closed

feat(node): export capturePrintError#10253
samchungy wants to merge 1 commit intovitest-dev:mainfrom
samchungy:export-helpful-reporters

Conversation

@samchungy
Copy link
Copy Markdown

@samchungy samchungy commented May 3, 2026

Description

I'm trying to implement a custom reporter which uses GitHub check runs annotations based on the github actions reporter but I notice it has access to things which aren't publicly accessible.

The task type in TestModule is accessed by every other reporter so I'm not entirely sure why it's marked as internal as it seems strange that I shouldn't access it if I wanted to implement a custom reporter.

The capturePrintError is used by the junit and actions reporters so it would be useful for me to be able to use it too.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 3, 2026

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 325981a
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/69f6baffda2f4f000881863b
😎 Deploy Preview https://deploy-preview-10253--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@samchungy samchungy changed the title feat(node): add capturePrintError export and update TestModule feat(node): export capturePrintError and update TestModule May 3, 2026
@samchungy samchungy changed the title feat(node): export capturePrintError and update TestModule feat(node): export capturePrintError and update TestModule type May 3, 2026
@samchungy samchungy force-pushed the export-helpful-reporters branch 2 times, most recently from ae4757a to f306bcd Compare May 3, 2026 03:56
@samchungy samchungy marked this pull request as ready for review May 3, 2026 04:21
@hi-ogawa
Copy link
Copy Markdown
Collaborator

hi-ogawa commented May 3, 2026

The task type in TestModule is accessed by every other reporter so I'm not entirely sure why it's marked as internal as it seems strange that I shouldn't access it if I wanted to implement a custom reporter.

I think RunnerTestFile being internal is an intended architecture. TestModule is newer user-facing reporter API and RunnerXxx is old (and still raw internal) representation. Builtin reporter should technically operate on newer API too, but they aren't just migrated yet.

And that also means capturePrintError(..., { task }) shouldn't be a public API as is though the request sounds reasonable. We probably need to refactor something there, so exploring that aspect would be more helpful.

@hi-ogawa hi-ogawa moved this to P2 - 2 in Team Board May 3, 2026
@hi-ogawa hi-ogawa added the p2-to-be-discussed Enhancement under consideration (priority) label May 3, 2026
@samchungy
Copy link
Copy Markdown
Author

The task type in TestModule is accessed by every other reporter so I'm not entirely sure why it's marked as internal as it seems strange that I shouldn't access it if I wanted to implement a custom reporter.

I think RunnerTestFile being internal is an intended architecture. TestModule is newer user-facing reporter API and RunnerXxx is old (and still raw internal) representation. Builtin reporter should technically operate on newer API too, but they aren't just migrated yet.

And that also means capturePrintError(..., { task }) shouldn't be a public API as is though the request sounds reasonable. We probably need to refactor something there, so exploring that aspect would be more helpful.

Oooo I see, would you be okay if I update the PR for just exporting capturePrintError?

@hi-ogawa
Copy link
Copy Markdown
Collaborator

hi-ogawa commented May 4, 2026

Oooo I see, would you be okay if I update the PR for just exporting capturePrintError?

We don't want to leak { task } as options, so need to refactor it first. It appears that's already redundant so testing removing it #10259.

@samchungy samchungy force-pushed the export-helpful-reporters branch from f306bcd to 80bbc06 Compare May 4, 2026 11:50
@samchungy samchungy changed the title feat(node): export capturePrintError and update TestModule type feat(node): export capturePrintError May 4, 2026
@hi-ogawa hi-ogawa mentioned this pull request May 5, 2026
7 tasks
@hi-ogawa
Copy link
Copy Markdown
Collaborator

hi-ogawa commented May 5, 2026

Would this shape work for you?

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

Labels

p2-to-be-discussed Enhancement under consideration (priority)

Projects

Status: P2 - 2

Development

Successfully merging this pull request may close these issues.

2 participants