Skip to content

Conversation

@PavDev3
Copy link
Contributor

@PavDev3 PavDev3 commented Dec 4, 2025

Update jest-preset-angular to version 16.0.0

Objective

Update jest-preset-angular from version 14.6.2 to 16.0.0 to resolve compatibility issues with Angular 21 and improve test configuration.

Changes Made

1. Dependency Updates

  • package.json: Updated jest-preset-angular from ^14.6.2 to ^16.0.0

2. Jest Configuration Migration

  • jest.config.ts:
    • Migrated from deprecated globals configuration to the new transform syntax
    • Configured the transformer with necessary ts-jest options
    • Commented out globalSetup (optional and was causing compatibility issues)

3. TypeScript Configuration for Tests

  • tsconfig.spec.json and projects/lux/tsconfig.spec.json:
    • Added emitDecoratorMetadata: true to properly support dependency injection in tests
    • Added paths mappings to correctly resolve Angular testing modules:
      • @angular/core/testing
      • @angular/common/http
      • @angular/common/http/testing
      • @angular/router/testing
      • @angular/platform-browser/animations

Issues Resolved

  • ✅ Removed deprecation warnings about using globals in ts-jest configuration
  • ✅ Fixed Angular testing module resolution errors (Cannot find module '@angular/core/testing')
  • ✅ Improved compatibility with Angular 21 and Jest 30.2.0
  • ✅ All tests now run successfully

Test Results

Test Suites: 14 passed, 14 total
Tests:       1 skipped, 109 passed, 110 total
Snapshots:   0 total
Time:        ~22-26s

Modified Files

  • package.json - Dependency update
  • jest.config.ts - Migration to new transform syntax
  • tsconfig.spec.json - Added emitDecoratorMetadata and paths
  • projects/lux/tsconfig.spec.json - Added emitDecoratorMetadata

Additional Notes

  • The globalSetup configuration was commented out as it's optional and was causing compatibility issues. If needed in the future, it can be properly configured according to jest-preset-angular 16.x documentation
  • The paths mappings in tsconfig.spec.json point directly to Angular type definition files to correctly resolve modules during TypeScript compilation in tests

…ef for better change detection. Adjusted test cases in Filter and Pagination components for improved clarity and consistency. Updated HTML attributes for Input component to use boolean binding.
@PavDev3 PavDev3 requested a review from Foxandxss December 4, 2025 22:24
@PavDev3 PavDev3 self-assigned this Dec 4, 2025
@PavDev3 PavDev3 added the dependencies Pull requests that update a dependency file label Dec 4, 2025
@PavDev3 PavDev3 marked this pull request as draft December 4, 2025 22:33
@PavDev3 PavDev3 marked this pull request as ready for review December 4, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants