Skip to content

Jest running multiple times in monorepo #1910

@vscaiceanu-1a

Description

@vscaiceanu-1a

Describe the Bug

When running jest in a monorepo with 2 projects, all tests are executed twice.

If a 3rd item is added to the projects array in jest.config.js, the tests run 3 times.

Minimal Reproduction

You can use https://github.com/vscaiceanu-1a/ng-monorepo-jest to reproduce the problem.

Setup npm install.

Then npm run ng test webapp.

 PASS   webapp  projects/webapp/src/app/app.component.spec.ts
 PASS   webapp  projects/webapp/src/app/app.component.spec.ts

Test Suites: 2 passed, 2 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        1.078 s
Ran all test suites in 2 projects.

Expected Behavior

Project tests are executed once.

Environment


Libs
- @angular/core version: ^19.1.0
- @angular-devkit/build-angular version: ^19.2.6
- @angular-builders/jest version: ~19.0.0

For Tooling issues:
- Node version: v20.11.1
- Platform:  Mac

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions