Skip to content

Internalize reporter implementations into main package#106

Merged
lambdalisue merged 6 commits intomainfrom
ref/reporter
Feb 1, 2026
Merged

Internalize reporter implementations into main package#106
lambdalisue merged 6 commits intomainfrom
ref/reporter

Conversation

@lambdalisue
Copy link
Member

@lambdalisue lambdalisue commented Jan 31, 2026

Summary

  • Add internal reporter module with Writer, shared formatting utilities, and snapshot test kit
  • Implement ListReporter and JSONReporter with comprehensive test coverage
  • Replace external @probitas/reporter dependency with internal src/cli/reporter/ module
  • Remove unsupported reporter types ("dot", "tap") from configuration
  • Update documentation to reflect new reporter architecture

Why

Reporters are tightly coupled to the CLI implementation and don't benefit from being external packages. Internalizing them:

  • Reduces maintenance overhead — no need to coordinate versions across packages
  • Simplifies development — reporters live alongside the CLI code that uses them
  • Enables faster iteration — changes don't require cross-package coordination
  • Maintains extensibility — still implements standard Reporter interface from @probitas/runner

The implementation is split into 4 logical commits:

  1. FoundationWriter (queue-based serialization), shared format utilities, test kit
  2. ImplementationListReporter and JSONReporter with snapshot tests
  3. Integration — rewire imports from external package to local module
  4. Documentation — update guides and remove obsolete references

Test Plan

  • All tests pass with deno task verify (45 passed, 0 failed)
  • ListReporter produces correct output (validated via snapshots)
  • JSONReporter produces correct output (validated via snapshots)
  • Custom reporter documentation example is accurate
  • No type errors or lint warnings

Copilot AI review requested due to automatic review settings January 31, 2026 05:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR internalizes the JSON and List reporter implementations into the CLI package, removing the external @probitas/reporter dependency and adding snapshot-based test coverage for the new internal reporters.

Changes:

  • Replaced @probitas/reporter imports with internal reporter implementations under src/cli/reporter/.
  • Added internal reporter implementations (ListReporter, JSONReporter) plus a Writer utility for serialized stream output.
  • Added reporter test infrastructure and ListReporter snapshot coverage; updated development docs and Deno import mappings.

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/cli/utils.ts Switches reporter resolution to internal reporter modules and internal ReporterOptions type.
src/cli/utils_test.ts Updates reporter imports used in resolveReporter tests.
src/cli/reporter/writer.ts Introduces a serialized writer abstraction for reporter output streams.
src/cli/reporter/types.ts Adds internal ReporterOptions type used by CLI reporter resolution and tests.
src/cli/reporter/list_reporter.ts Adds internal ListReporter implementation (detailed console output + summary).
src/cli/reporter/list_reporter_test.ts Adds ListReporter snapshot tests, including multiline error/skip cases.
src/cli/reporter/json_reporter.ts Adds internal JSONLines reporter implementation.
src/cli/reporter/json_reporter_test.ts Adds JSONReporter snapshot test harness invocation.
src/cli/reporter/_testkit.ts Adds shared reporter snapshot test harness + fixtures.
src/cli/reporter/snapshots/list_reporter_test.ts.snap Commits ListReporter snapshots.
deno.json Removes @probitas/reporter import mapping; adds @std/testing/snapshot mapping.
deno.lock Removes locked dependency entries related to @probitas/reporter and updates lock state accordingly.
.claude/rules/development.md Updates custom reporter guidance to align with the new reporter architecture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…N reporter serialization

Replace the stateless `errorReplacer` with a stateful `createReplacer()`
factory that tracks the ancestor chain to detect circular object references,
uses a WeakSet to detect re-encountered Error instances, and converts BigInt
values to strings. Without this, JSON.stringify throws TypeError when
scenario results contain BigInt values or circular object graphs.
…ementation

- Use WritableStream<Uint8Array> for type safety
- Fix Writer debug metrics (correct byteLength calculation, remove incorrect queueDepth)
- Remove unreachable default case in getKindChar for exhaustiveness checking
- Consolidate reporter options types (ListReporterOptions and JSONReporterOptions now alias ReporterOptions)
@lambdalisue lambdalisue merged commit f4ebc4d into main Feb 1, 2026
4 checks passed
@lambdalisue lambdalisue deleted the ref/reporter branch February 1, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants