Skip to content

Missing option to declare dependency external in unit-test builder #30741

@heddendorp

Description

@heddendorp

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

I am running unit tests with vitest in the node cofig. To test http requests I would like to use https://mswjs.io/
The build is complaining though because msw/node should not be included in a browser environment. I can not mark the dependency as external though.
My build is a packagr builder since the tests are for a library.
Happy to provide more information if needed.

Minimal Reproduction

Try to import import { setupServer } from 'msw/node' according to the vitest guide https://vitest.dev/guide/mocking.html#requests in the unit-test builder tests for a library

Exception or Error


Your Environment

Angular CLI: 20.1.0
Node: 24.2.0
Package Manager: yarn 4.9.2
OS: darwin arm64

Angular: 20.1.0
... build, cli, common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.0
@angular-devkit/core         20.1.0
@angular-devkit/schematics   20.1.0
@schematics/angular          20.1.0
ng-packagr                   20.1.0
rxjs                         7.8.2
typescript                   5.8.3

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions