Skip to content

Warning for Custom Builders When Running ng test #33920

Closed as not planned
Closed as not planned

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

Activity

  1. added
    gemini-triaged
    on Aug 25, 2026
  2. added this to the needsTriage milestone on Aug 25, 2026
  3. changed the title [-]Unit Test Builder Warning for custom builders[/-] [+]Warning for Custom Builders When Running `ng test`[/+] on Aug 25, 2026
  4. alan-agius4 commented on Aug 26, 2026

    @alan-agius4
    Collaborator

    Hi @HazzMan2409,

    This warning is intentional and accurate.

    The unit-test builder does not actually execute the builder configured in buildTarget. Instead, it inspects the target to extract options and feeds them directly into @angular/build's internal application build pipeline.

    Because of this:

    • Custom builders (like @angular-builders/custom-esbuild) and any custom logic they provide (such as custom esbuild plugins, loaders, or build lifecycle hooks) are not executed during ng test.
    • Third-party builders may also introduce custom options or schema differences that the internal build pipeline does not support.

    The builder falls back to a best-effort execution with the options it can read, which is why this is a warning rather than a hard error. However, suppressing this warning would be misleading, as it would suggest that the custom builder is actively running and supported.

    For these reasons, we cannot remove the warning for custom builders.

  5. HazzMan2409 commented on Aug 26, 2026

    @HazzMan2409
    Author

    Hi @alan-agius4 thanks for that information.

    My confusion comes from the fact that in that packages docs it states:
    "The @angular-builders/custom-esbuild:unit-test builder is an enhanced version of the @angular/build:unit-test builder that reuses your application ESBuild plugins during test execution."

    So essentially this custom builder will always be subject to the warning and there is really nothing they can do other than change their entire approach of building on top of @angular/build:unit-test to ensure it never appears.

    If that package is doing something that is not supported by your team can you let me know and I can raise an issue there? If it is supported then that warning shouldn't really be happening I reckon.

  6. angular-automatic-lock-bot commented on Oct 20, 2026

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/buildgemini-triaged

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions