Skip to content

Conversation

Copy link

Copilot AI commented Jan 21, 2026

Migrates the entire test suite to Vitest, removing Jest dependencies and updating Angular configuration to use the native @angular/build:unit-test builder.

Changes

Dependencies

  • Removed: jest, jest-environment-jsdom, @types/jest, ts-jest
  • Added: vitest@^4.0.8, @vitest/browser@^4.0.8 (Angular 21 compatibility)

Configuration

  • Updated angular.json: @angular-devkit/build-angular:jest@angular/build:unit-test
  • Removed libs/core/jest.config.js and libs/components/jest.config.js
  • Cleaned up tsconfig.spec.json (removed ts-jest config)

Test Files (22 files)

All spec files updated to use explicit Vitest imports and APIs:

// Before
import { TestBed } from '@angular/core/testing'

describe('MyService', () => {
  let spy: jest.SpyInstance
  
  beforeEach(() => {
    spy = jest.spyOn(service, 'method')
  })
  
  test('should work', () => {
    const mock = jest.fn()
    expect(mock).toHaveBeenCalled()
  })
})

// After
import { TestBed } from '@angular/core/testing'
import { describe, it, expect, beforeEach, vi } from 'vitest'

describe('MyService', () => {
  let spy: ReturnType<typeof vi.spyOn>
  
  beforeEach(() => {
    spy = vi.spyOn(service, 'method')
  })
  
  it('should work', () => {
    const mock = vi.fn()
    expect(mock).toHaveBeenCalled()
  })
})

All jest.*vi.* and test()it() throughout codebase.

Original prompt

This section details on the original issue you should resolve

<issue_title>update tests to vitest</issue_title>
<issue_description>- [ ] remove all jest deps

  • install vitest
  • use @angular/build:unit-test in angular.json for the test architext and configure it for vitest
  • use imports in all tests (spec files) for describe, it, expect and vi instead of global types
  • refactor tests use run with vitest</issue_description>

<agent_instructions>name the branch copilot/#67-update-tests-to-vitest</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Remove jest dependencies from package.json
- Install vitest and @vitest/browser (v4.0.8 compatible with Angular 21)
- Update angular.json to use @angular/build:unit-test
- Remove jest config files
- Update tsconfig.spec.json to remove jest-specific config
- Add vitest imports (describe, it, expect, vi, beforeEach, afterEach) to all spec files
- Replace jest.fn() with vi.fn()
- Replace jest.spyOn() with vi.spyOn()
- Replace jest.SpyInstance with ReturnType<typeof vi.spyOn>
- Replace test() with it() in all spec files

Co-authored-by: mumenthalers <3604424+mumenthalers@users.noreply.github.com>
Copilot AI changed the title [WIP] Update tests to use vitest framework Migrate test suite from Jest to Vitest Jan 21, 2026
Copilot AI requested a review from mumenthalers January 21, 2026 16:42
@mumenthalers mumenthalers force-pushed the copilot/update-tests-to-vitest branch from 42fa7b2 to 0192875 Compare January 22, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update tests to vitest

2 participants