[YUNIKORN-3254] Migrate unit tests from Karma to Vitest#271
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #271 +/- ##
==========================================
+ Coverage 38.77% 41.66% +2.89%
==========================================
Files 2 61 +59
Lines 49 2328 +2279
Branches 0 383 +383
==========================================
+ Hits 19 970 +951
- Misses 27 1165 +1138
- Partials 3 193 +190 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Since we are in angular v20, vitest support is available from v21 onwards. Why don't you upgrade angular to 21 along with unit tests? Is there any breaking changes from 20 to 21? Also can you check the config files with newly generated angular 21 sample app and verify the config files side by side?
| "build:prod": "ng build --configuration production", | ||
| "start:srv": "json-server --watch json-db.json", | ||
| "test:coverage": "ng test --code-coverage --karma-config=./karma.conf.ci.js --watch=false", | ||
| "test:coverage": "ng test --watch=false", |
There was a problem hiding this comment.
In angular 21, coverage is supported by --coverage flag, add it for test:coverage command.
|
Thanks for reviewing @akhilpb001. I will work on these changes and update the PR |
- Upgrade all @angular/* packages to ^21.2.0 and TypeScript to ~5.9.2 - Add provideZoneChangeDetection() to AppModule (required by Angular 21) - Add null guard for queueSelect ViewChild in apps-view component (Angular 21 TestBed rethrows errors previously swallowed) - Fix queue-v2 spec: prevent D3 visualization from running under jsdom - Fix test:coverage script to use --coverage flag (Angular 21 stable)
Angular 20 → 21 UpgradePackage upgrades
|
|
The changes look good from my side. |
What is this PR for?
Migrate the unit test infrastructure from the deprecated Karma + Jasmine stack to Vitest, using Angular's built-in
@angular/build:unit-testbuilder. Karma is no longer maintained and Vitest becomes the official Angular test runner default in Angular 21. This migration removes 12 Karma/Jasmine devDependencies, eliminates the Puppeteer/Chrome requirement, and runs tests under jsdom instead of a headless browser.What type of PR is it?
What is the Jira issue?
https://issues.apache.org/jira/browse/YUNIKORN-3254
How should this be tested?
Run
make test— all 24 test files (50 tests) should pass.No behavioral changes to the application code; only test infrastructure and spec files are modified.
Screenshots (if appropriate)
N/A
Questions: