Sitelet https://github.com/angular/angular-cli/issues/33920
Skip to content

Warning for Custom Builders When Running ng test #33920

Description

@HazzMan2409

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Currently an ng test will warn if the builder used is not @angular/build:application or @angular/build:ng-packagr.

There are packages such as angular-builder/custom-esbuild that provide their own builder and using one will warn. This feels incorrect. Can we change the logic around the warning to ensure custom builders do not get one?

Minimal Reproduction

The logic for the warning is available here ->

if (builderName === '@angular/build:application') {
buildTargetOptions = (await context.validateOptions(
await context.getTargetOptions(normalizedOptions.buildTarget),
builderName,
)) as unknown as ApplicationBuilderInternalOptions;
} else if (builderName === '@angular/build:ng-packagr') {
const ngPackagrOptions = await context.validateOptions(
await context.getTargetOptions(normalizedOptions.buildTarget),
builderName,
);
buildTargetOptions = await transformNgPackagrOptions(
context,
ngPackagrOptions,
normalizedOptions.projectRoot,
);
} else {
context.logger.warn(
`The 'buildTarget' is configured to use '${builderName}', which is not supported. ` +
`The 'unit-test' builder is designed to work with '@angular/build:application' or '@angular/build:ng-packagr'. ` +
'Unexpected behavior or build failures may occur.',
);

Exception or Error

`The 'buildTarget' is configured to use '@angular-builders/custom-esbuild:application', which is not supported. The 'unit-test' builder is designed to work with '@angular/build:application' or '@angular/build:ng-packagr'. Unexpected behavior or build failures may occur.`

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI       : 22.1.3
Angular           : 22.1.0
Node.js           : 22.22.3
Package Manager   : npm 10.9.8
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations       │ 22.1.0            │ ^22.1.0           │
│ @angular/build            │ 22.1.3            │ ^22.1.3           │
│ @angular/cli              │ 22.1.3            │ ^22.1.3           │
│ @angular/common           │ 22.1.0            │ ^22.1.0           │
│ @angular/compiler         │ 22.1.0            │ ^22.1.0           │
│ @angular/compiler-cli     │ 22.1.0            │ ^22.1.0           │
│ @angular/core             │ 22.1.0            │ ^22.1.0           │
│ @angular/elements         │ 22.1.0            │ ^22.1.0           │
│ @angular/forms            │ 22.1.0            │ ^22.1.0           │
│ @angular/platform-browser │ 22.1.0            │ ^22.1.0           │
│ @angular/router           │ 22.1.0            │ ^22.1.0           │
│ ng-packagr                │ 22.1.1            │ 22.1.1            │
│ rxjs                      │ 7.8.2             │ ~7.8.1            │
│ typescript                │ 6.0.3             │ ~6.0.3            │
│ zone.js                   │ 0.16.0            │ 0.16.0            │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions