Skip to content

Conversation

clydin
Copy link
Member

@clydin clydin commented Sep 16, 2025

Previously, missing peer dependencies for test runners (e.g., jsdom, karma-coverage, playwright) were only discovered late in the execution process, often leading to cryptic errors. When multiple packages were missing, this resulted in a frustrating cycle of running the command, installing a package, and repeating.

This change introduces a comprehensive, upfront dependency validation system:

  • A validateDependencies hook is added to the TestRunner interface, allowing each runner to declare its own requirements.
  • A DependencyChecker class now collects all missing dependencies and reports them to the user in a single, clean error message without a stack trace.
  • Both the Karma and Vitest runners implement this hook to check for all required packages based on the user's configuration (including browser launchers, coverage packages, and the JSDOM environment).

@clydin clydin added the target: major This PR is targeted for the next major release label Sep 16, 2025
…runners

Previously, missing peer dependencies for test runners (e.g., `jsdom`, `karma-coverage`, `playwright`) were only discovered late in the execution process, often leading to cryptic errors. When multiple packages were missing, this resulted in a frustrating cycle of running the command, installing a package, and repeating.

This change introduces a comprehensive, upfront dependency validation system:

- A `validateDependencies` hook is added to the `TestRunner` interface, allowing each runner to declare its own requirements.
- A `DependencyChecker` class now collects all missing dependencies and reports them to the user in a single, clean error message without a stack trace.
- Both the Karma and Vitest runners implement this hook to check for all required packages based on the user's configuration (including browser launchers, coverage packages, and the JSDOM environment).
@clydin clydin force-pushed the unit-test/dependency-checks branch from f9bdc8a to b3cb767 Compare September 16, 2025 00:54
@clydin clydin marked this pull request as ready for review September 16, 2025 00:54
@clydin clydin merged commit c6176f6 into angular:main Sep 16, 2025
55 of 56 checks passed
@clydin clydin deleted the unit-test/dependency-checks branch September 16, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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