AUI-51 / Feat: Upgrade to Angular 21, Vitest, standalone, oxfmt#1420
AUI-51 / Feat: Upgrade to Angular 21, Vitest, standalone, oxfmt#1420
Conversation
Test Results54 tests +1 54 ✅ +1 0s ⏱️ -14s Results for commit 4aa14b4. ± Comparison against base commit b8a57e5. This pull request removes 53 and adds 54 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1420 +/- ##
==========================================
- Coverage 99.67% 98.54% -1.14%
==========================================
Files 49 49
Lines 617 411 -206
Branches 39 91 +52
==========================================
- Hits 615 405 -210
- Misses 2 5 +3
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| 0, | ||
| this.buildInjector(model, rendererDestructionSubject.asObservable(), viewContainerRef) | ||
| ); | ||
| const renderer = this.rendererLibrary.lookupRenderer(model.constructor as Type<unknown>) as Type<TRenderer>; |
There was a problem hiding this comment.
we need to test the dashboards really well to ensure we don't break anything with this change
There was a problem hiding this comment.
Absolutely. Everything seems to work from what I can see from the demo app, but real-world testing will be important.
| "tslib": "^2.8.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@ngneat/spectator": "^22.1.0" |
There was a problem hiding this comment.
is this no longer needed?
There was a problem hiding this comment.
It was only used in one place and the vanilla approach was simple, so killed an unnecessary dependency
| "module": "commonjs" | ||
| "typeRoots": ["../../node_modules/@types", "../../node_modules"], | ||
| "types": ["vitest/globals"], | ||
| "skipLibCheck": true, |
There was a problem hiding this comment.
why are we turning off these flags and strictTemplates checks?
There was a problem hiding this comment.
This is specifically for tests.
There was a problem hiding this comment.
Turned out all the tests are compliant anyway, so can kill this.
- Upgrade all @angular/* packages from v20 to v21 - Replace @angular-builders/jest with @angular/build:unit-test (Vitest runner) - Upgrade RxJS from v6 to v7, add npm overrides for @hypertrace/hyperdash peer dep - Make all library and app components/directives/pipes standalone - Remove deprecated APIs: ComponentFactoryResolver, HttpClientTestingModule, *ngIf/*ngFor - Replace zone-dependent test utilities (fakeAsync/tick) with Vitest fake timers - Remove @ngneat/spectator, zone.js, and all Jest-related dependencies BREAKING CHANGE: Update Angular to v21, RxJS to v7, make components standalone, switch from Jest to Vitest
62a2def to
b47c0f3
Compare
|
I feel that we should go zone-less in a different PR later. Since there is older code, there might be hidden zone related bugs. @knagurski |
| selector: '[hdaDashboardModel]', | ||
| inputs: ['hdaDashboardModel'], | ||
| standalone: false | ||
| standalone: true |
There was a problem hiding this comment.
nit: this is not needed anymore as its true by default.
There was a problem hiding this comment.
DOH! Killed them all now
| "@angular/common": "^21.0.0", | ||
| "@angular/core": "^21.0.0", | ||
| "@angular/platform-browser": "^21.0.0", | ||
| "rxjs": "^7.8.2", |
There was a problem hiding this comment.
This would mean that we need to upgrade to v7 in the tui repo right? There are couple of breaking changes that needs to be addressed in the tui repo if we want to upgrade to v7.
@knagurski so it would be better to try out v7 in tui and then proceed with merging this.
There was a problem hiding this comment.
@adisreyaj good idea. RxJS v7 isn't required for Angular 21, so I've rolled it back to v6. It should be forward-compatible with v7, so we can trigger this upgrade from the TUI side.
Revert the branch to RxJS 6 and align published peer constraints with upstream hyperdash requirements. Add a shared Vitest runner config so Angular 21 tests resolve correctly when RxJS 6 is installed.
Had another look through and the zoned vs zoneless is mostly a consuming app concern. The library itself triggers calls to the change detector and uses OnPush. Custom renderer/editor components in the host app are where there could be a problem when the host is zoneless. As-is this should work fine in zoned and zoneless apps. |
- Remove eslint-config-prettier and its ESLint extends entry (replaced by oxfmt) - Remove ts-node devDependency (no longer needed after Jest→Vitest) - Remove stale .vscode/launch.json (referenced deleted Jest config) - Remove emitDecoratorMetadata from tsconfig (unnecessary for Angular) - Remove duplicate deserialization-manager.service export in public_api - Remove vestigial standalone param from mockDirective test utility - Widen rxjs peer dependency to ^6.5.5 || ^7.0.0 - Enable @angular-eslint/prefer-standalone lint rule - Add non-standalone renderer backward compatibility test - Add util/ to coverage exclusions (types-only files) - Update README with Angular 21 prerequisites and RxJS 6+7 support
Summary
@angular-builders/jest) to Vitest (@angular/build:unit-test) with zoneless AOT@ngneat/spectatorHttpClientTestingModule,waitForAsync,fakeAsync)