Skip to content

refactor(@angular/build): introduce internal generic test runner API in unit-test builder #30938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

clydin
Copy link
Member

@clydin clydin commented Aug 15, 2025

Refactors the unit-test builder to introduce an internal generic TestRunner API. This change decouples the main builder logic from the specifics of individual test runners like Karma and Vitest.

The new API consists of two main parts:

  • TestRunner: A declarative definition of a test runner, including its name and hooks for creating an executor and getting build options.
  • TestExecutor: A stateful object that manages a test execution session.

The Karma and Vitest runners have been refactored to implement this new API. The Karma runner is now marked as isStandalone: true to indicate that it manages its own build process. The Vitest runner now uses the getBuildOptions hook to provide its build configuration to the main builder.

…in unit-test builder

Refactors the unit-test builder to introduce a generic `TestRunner` API. This change decouples the main builder logic from the specifics of individual test runners like Karma and Vitest.

The new API consists of two main parts:
- `TestRunner`: A declarative definition of a test runner, including its name and hooks for creating an executor and getting build options.
- `TestExecutor`: A stateful object that manages a test execution session.

The Karma and Vitest runners have been refactored to implement this new API. The Karma runner is now marked as `isStandalone: true` to indicate that it manages its own build process. The Vitest runner now uses the `getBuildOptions` hook to provide its build configuration to the main builder.

This refactoring makes the unit-test builder more extensible, allowing for new test runners to be added more easily in the future. It also improves the separation of concerns within the builder, making the code easier to understand and maintain.
@clydin clydin added the target: major This PR is targeted for the next major release label Aug 15, 2025
@clydin clydin marked this pull request as ready for review August 16, 2025 02:18
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant