test: migrate from jest to vitest - #1808
Merged
Merged
Conversation
madhavilosetty-intel
force-pushed
the
test/migrate-jest-to-vitest
branch
from
August 27, 2026 03:00
db94013 to
fa44757
Compare
madhavilosetty-intel
enabled auto-merge (squash)
August 27, 2026 03:00
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s test runner from Jest/ts-jest to Vitest (with v8 coverage), updating configuration, CI, and the existing unit tests to run under the new framework without changing shipped runtime output.
Changes:
- Adds Vitest configuration + setup (jsdom env, single-fork execution, v8 coverage, junit output).
- Updates TypeScript config and the test suite to use Vitest globals /
vimocks instead of Jest APIs. - Updates CI/workflow and tooling config (npm scripts, eslint ignores) and removes Jest config.
Reviewed changes
Copilot reviewed 22 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
vitest.setup.ts |
Adds jsdom canvas getContext stub to avoid native canvas dependency. |
vitest.config.ts |
Defines Vitest include patterns, jsdom env, reporters, and v8 coverage config. |
tsconfig.json |
Enables Vitest globals typing and adjusts TS compiler options for the new test setup. |
tsconfig.build.json |
Updates build exclusions for the new Vitest setup file. |
src/test/zlib.spec.js |
Migrates Jest mock usage to vi and switches module import style for Vitest. |
src/test/serverinit.spec.ts |
Removes Jest done callback pattern; uses assertion counting instead. |
src/test/securityresponse.spec.ts |
Removes Jest done callback pattern; uses assertion counting instead. |
src/test/securityoptions.spec.ts |
Removes Jest done callback pattern; uses assertion counting instead. |
src/test/rledecoder.spec.ts |
Updates environment annotation and replaces Jest mocks with vi mocks. |
src/test/kvmui.test.ws.ts |
Adjusts config typing and WebSocket constructor typing for Vitest/TS. |
src/test/keyboardhelper.test.ts |
Migrates spies/mocks to Vitest (vi) and updates spy typing. |
src/test/keyboardhelper.spec.ts |
Updates environment annotation and replaces Jest spy utilities with Vitest equivalents. |
src/test/imagehelper.spec.ts |
Updates environment annotation and replaces Jest mocks with vi mocks. |
src/test/iderDataProcessor.spec.ts |
Migrates spies/mocks to Vitest and updates spy typing. |
src/test/handshakestate.spec.ts |
Removes Jest done callback pattern; uses assertion counting instead. |
src/test/framebufferbellservercuttext.spec.ts |
Removes Jest done callback pattern; uses assertion counting instead. |
src/test/encoding.spec.ts |
Removes Jest done callback pattern; uses assertion counting instead. |
src/test/amtredirector.spec.ts |
Replaces Jest mocks with vi mocks. |
src/test/amtider.spec.ts |
Replaces Jest mocks/spies with Vitest equivalents; updates mock typings. |
src/test/amtdesktop.spec.ts |
Replaces Jest mocks/spies with Vitest equivalents. |
package.json |
Swaps Jest scripts/deps for Vitest + coverage-v8; adds typecheck. |
jest.config.js |
Removes Jest configuration file. |
eslint.config.cjs |
Ignores generated dist/** and coverage/**. |
.github/workflows/node.js.yml |
Updates CI to run typecheck, Vitest test/coverage, and renames artifact step. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
madhavilosetty-intel
force-pushed
the
test/migrate-jest-to-vitest
branch
2 times, most recently
from
August 27, 2026 21:33
4971683 to
fdfaeb7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 25 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
vitest.setup.ts:41
- The mocked canvas context currently hard-codes ctx.canvas to a plain object, so ctx.canvas !== the actual HTMLCanvasElement and width/height mutations don't affect the element. Returning the real canvas element ("this") makes code like ImageHelper.setRotation behave closer to production.
canvas: {
height: 768,
width: 1366
}
}) as unknown as HTMLCanvasElement['getContext']
madhavilosetty-intel
force-pushed
the
test/migrate-jest-to-vitest
branch
from
August 27, 2026 22:58
1bf4222 to
d5338f7
Compare
Replaces jest/ts-jest with vitest 4 + @vitest/coverage-v8. All 326 tests pass, verified per-suite against the jest baseline rather than on the total alone. The built dist is byte-identical to HEAD, so no shipped code changes.
madhavilosetty-intel
force-pushed
the
test/migrate-jest-to-vitest
branch
from
August 27, 2026 23:01
d5338f7 to
40edbb7
Compare
rsdmike
approved these changes
Aug 27, 2026
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces jest/ts-jest with vitest 4 + @vitest/coverage-v8.
All 326 tests pass, verified per-suite against the jest baseline rather than on the total alone.
The built dist is byte-identical to HEAD, so no shipped code changes.
Coverage baseline note
The reported coverage total drops versus the jest-era number. Jest had no
collectCoverageFrom, so it only instrumented files the tests actually loaded; vitest's v8 provider counts every file matched bycoverage.include(src/core/**), including files no test imports (e.g.Desktop.tsat 0%). This is a one-time denominator change — the same code is tested as before, per-suite coverage was verified against the jest baseline, and no code regressed. The memory-hungry RLEDecoder/ImageHelper suites stay excluded from the coverage run (as under jest), with their targets excluded from the denominator.PR Checklist
What are you changing?
Anything the reviewer should know when reviewing this PR?
If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )