Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 3, 2025

This PR migrates the project's testing framework from Jest to Vitest while preserving all existing test functionality and behavior.

Changes Made

Dependencies Updated

  • Removed: jest, ts-jest, @types/jest, eslint-plugin-jest
  • Added: vitest, @vitest/ui, eslint-plugin-vitest, @types/node

Configuration Files

  • Replaced jest.config.js with vitest.config.ts using equivalent configuration
  • Updated tsconfig.test.json to use vitest/globals types instead of jest
  • Updated eslint.config.js to use eslint-plugin-vitest instead of eslint-plugin-jest
  • Updated tsconfig.json to exclude vitest.config.ts from main build

Test Code Migration

Updated __tests__/generate-sbom.test.ts to use Vitest APIs:

  • Changed imports from '@jest/globals' to 'vitest'
  • Replaced jest.mock() with vi.mock()
  • Replaced jest.fn() with vi.fn()
  • Replaced jest.spyOn() with vi.spyOn()
  • Replaced jest.clearAllMocks() with vi.clearAllMocks()

Package Scripts

Updated package.json scripts:

  • "test": "vitest run" (was "jest")
  • "btest": "npm run build & vitest run" (was "npm run build & jest")

Verification

✅ All existing tests continue to pass with identical behavior
✅ Build process works correctly (npm run build)
✅ Linting passes (npm run lint)
✅ Full workflow succeeds (npm run all)
✅ Test output format is clean and informative

The migration maintains 100% compatibility with existing test logic while providing the benefits of Vitest (faster execution, better TypeScript support, and modern ESM compatibility).

Fixes #108.


💡 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.

Copilot AI and others added 2 commits July 3, 2025 21:10
@Copilot Copilot AI changed the title [WIP] Update test framework from jest to vitest Migrate test framework from Jest to Vitest Jul 3, 2025
@Copilot Copilot AI requested a review from colindembovsky July 3, 2025 21:12
Copilot finished work on behalf of colindembovsky July 3, 2025 21:12
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 test framework from jest to vitest
2 participants