Skip to content

[Report] Refactor Reporter Configuration for Type Safety and Extensibility #46

@priyanshus

Description

@priyanshus

Currently, the reporters field in EvaliphyConfig accepts (string | any)[] | string, which is too permissive and lacks IDE discoverability. To align with "Strict Typing" principles, we need to restrict this to a set of supported reporter types. This will prevent configuration errors and provide a better developer experience through auto-completion.

Task: Implement a foundation which will be later evolved to excel/csv and other reporters.

The foundation should support:

  • Console Reporter: Should be active by default.
  • HTML Reporter: Should be easily toggled.
  • Extensibility: The structure must allow for adding csv and excel formats in the near future without breaking changes.

Acceptance Criteria:

  • Define a SupportedReporter union type (e.g., 'console' | 'html').
  • Update EvaliphyConfig interface in packages/core/src/config/types.ts to use the new restricted types.
  • Update the Zod schema in packages/core/src/config/schema.ts to validate these specific strings.
  • Ensure mergeConfig logic handles the default state (e.g., ensuring console is always present or enabled).
  • Verify that the reporter factory/registry can correctly resolve these literal types.
  • Sufficient test coverage. Update e2e-tests.

Note: Please test your fix before raising PR. Don't blindly accept what LLM generates.

Describe the solution you'd like

export type BuiltInReporter = 'console' | 'html';

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions