`unit-test` builder with `vitest` runner and `--debug` option fails
Command
test
Is this a regression?
- [x] Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
Just before https://github.com/angular/angular-cli/commit/cf47d15efb4ad6ff68fc64be6d60df158c53baeb
Description
When using --debug option with Vitest, it produces the following error: AggregateError: Failed to initialize projects. There were errors during projects setup. See below for more details.
This happens because Vitest checks that there is a chromium browser in the instances list: https://github.com/vitest-dev/vitest/blob/9e24a59f2c9dbd44439e38968c6c6eb216ebd50a/packages/vitest/src/node/config/resolveConfig.ts#L850C17-L850C37 but during this check it verifies that the project is not filtered out.
Problem is that the project option is set to the value of projectName which does not match the instance name ${projectName} (chromium).
It would be also nice to fail gracefully when debug is set and there is no chromium browser.
(By the way, the error is truncated when using the CLI. In plain Vitest, the aggregated errors are logged)
Minimal Reproduction
ng test --debug
Exception or Error
AggregateError: Failed to initialize projects. There were errors during projects setup. See below for more details
Your Environment
Build of cf47d15efb4ad6ff68fc64be6d60df158c53baeb.
Anything else relevant?
No response
The aggregate error logging is fixed by https://github.com/angular/angular-cli/pull/31712