question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng test does not run tests for all projects

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Don’t know

Description

The ng test documentation states “When a project name is not supplied, it will execute for all projects”. However, this does not appear to be true. Only the tests for a single project are run.

image

🔬 Minimal Reproduction

  1. Clone https://github.com/swseverance/my-workspace
  2. npm install
  3. Run ng test and observe how only the tests for the app are run. The tests for the lib are not run.

OR

  1. Create a workspace
  2. Create an app within the workspace
  3. Create a lib within the workspace
  4. Run ng test and observe how only the tests for the app are run. The tests for the lib are not run.

🔥 Exception or Error

N/A

🌍 Your Environment


Angular CLI: 11.2.14
Node: 14.17.0
OS: darwin x64

Angular: 11.2.14
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.14
@angular-devkit/build-angular   0.1102.14
@angular-devkit/core            11.2.14
@angular-devkit/schematics      11.2.14
@schematics/angular             11.2.14
@schematics/update              0.1102.14
ng-packagr                      11.2.4
rxjs                            6.6.7
typescript                      4.1.6

Anything else relevant?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Lonli-Loklicommented, Feb 22, 2022

So what is the solution to run all tests in monorepo?

0reactions
TrevorKarjaniscommented, Oct 5, 2021

The newly generated repository for #21619 reproduces this as well, but our upgraded v12 application does not.

I stand to correct myself. The test command runs only the default project tests when a project is not provided and watch true by default. All tests are run when no project is provided and watch is false which we found useful for CI. Sorry for the confusion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng 10: how to run tests for all projects
according to the docs of ng test, ng test (without any project) should run all tests: When a project name is not supplied,...
Read more >
ng test
Option Description Value Type Defau... ‑‑browsers Override which browsers tests are run against. string ‑‑code‑coverage Output a code coverage report. boolean false ‑‑code‑coverage‑exclude Globs to exclude...
Read more >
Angular CLI: “ng test” with Jest in 3 minutes (v2)
I'm not going to explain why you should choose Jest over Karma, assuming you already ... After you've done that ng test will...
Read more >
Executing Unit Tests Using the Angular CLI
You learned that you can use the ng test command to execute all of your unit tests via the Jasmine testing framework while...
Read more >
Run tests | IntelliJ IDEA Documentation
If your tests don't require any specific actions before start and you ... Place the caret at the test class to run all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found