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

Merged
merged 1 commit into from
Aug 18, 2025

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
@clydin clydin requested a review from alan-agius4 August 18, 2025 12:36
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 18, 2025
@clydin clydin merged commit 6c64560 into angular:main Aug 18, 2025
35 checks passed
@clydin clydin deleted the unit-test/runner-abstraction branch August 18, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker 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.

2 participants