Skip to content

Tests using web-test-runner fail on multi project apps #28261

Open

Description

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

If you create a new angular app with two projects, and try to run the unit tests using web-test-runner, the spec files cannot be located.

Minimal Reproduction

  • Create a new angular app with two projects.
ng new my-workspace --no-create-application
cd my-workspace
ng generate application my-app
ng generate application my-app2
  • Use the web-test-runner
    npm install @web/test-runner -D
    Replace @angular-devkit/build-angular:karma by @angular-devkit/build-angular:web-test-runner in angular.json

  • Rune the unit tests
    ng test

Exception or Error

NOTE: The Web Test Runner builder is currently EXPERIMENTAL and not ready for production use.
The 'assets' option is not yet supported by this builder.
The 'styles' option is not yet supported by this builder.
The 'inlineStyleLanguage' option is not yet supported by this builder.
The 'stylePreprocessorOptions' option is not yet supported by this builder.
The 'sourceMap' option is not yet supported by this builder.
The 'progress' option is not yet supported by this builder.
The 'preserveSymlinks' option is not yet supported by this builder.
Application bundle generation failed. [2.082 seconds]

✘ [ERROR] File 'projects/my-app/src/app/app.component.spec.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

  Ensure the file is part of the TypeScript program via the 'files' or 'include' property.

Your Environment

Angular CLI: 18.2.1
Node: 18.20.4
Package Manager: npm 10.7.0
OS: linux x64

Angular: 18.2.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.1
@angular-devkit/build-angular   18.2.1
@angular-devkit/core            18.2.1
@angular-devkit/schematics      18.2.1
@angular/cli                    18.2.1
@schematics/angular             18.2.1
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else relevant?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions