Tests not loaded for default generated Angular 15 workspace - follow up to issue #60
BePo65 opened this issue · 2 comments
The Bug
- In a newly generated angular workspace with a library and an application project, the karma-test-explorer shows only the tests in the application project, but not the tests in the library project.
Steps to Reproduce the Behavior
- Create new angular workspace with 2 projects:
ng new my-library --create-application=false
cd my-library
npm install --save @angular/material @angular/cdk @angular/animations
ng g application demo-app --style=scss --routing=true
ng g library angular-lib
ng add @angular/material --project=demo-app
ng add @angular/material --project=angular-lib
- Open workspace in VSCode
- Open Test pane
- See only the 3 tests from the application project
Expected Behavior
- The tests from all projects should be visible.
Provide Debug Logs
Log files:
Karma.Test-Explorer_workspace.txt
Karma.Server_my-library_demo-app.txt
Karma.Test-Explorer_my-library_demo-app.txt
Minimal Reproduction Project
- See it on github
Screenshots
Please Provide the Following Information
- OS: Windows 10
- Environment: the pc itself
- Node Version: 16.18.1 (on Windows)
- Karma Version: 6.4.1
- Frameworks: Angular, Jasmine
- VS Code versions:
Version: 1.74.3 (system setup)
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T16:59:02.252Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: No
Additional Context
- Don't know, if this is relevant, but according to an open issue in angular-cli angular will only run all tests, when
--watch=false
; otherwise only for the "default" project. - IMHO the pr resulting from issue #60 made tests "available" in angular 15; but as it seems, not for multi project workspaces.
@BePo65 Karma Test Explorer only loads the first project in your Angular workspace the first time its opened in VS Code, but in the testing side bar, you can use the folder button on the top toolbar to additionally load every/any other project in your workspace. Karma test explorer will then remember your project selection and reload the tests for the same projects anytime you subsequently open your project in VS Code.
At some point in the past, Karma Test Explorer started using the defaultProject
option in the angular.json
config to determine which project to load by default and in its absence would simply load the first project, but since that option has since been deprecated, it may make more sense in future releases, for it to load all the Angular workspace projects the first time.
Wow, live can be so easy 😄 - thanks a lot for the help.