-
Notifications
You must be signed in to change notification settings - Fork 78
feat: migrate BUI + root tests from Jest to Vitest (follow-up to FR-2609) #6875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
graphite-app
merged 1 commit into
main
from
04-21-feat_migrate_bui_root_tests_from_jest_to_vitest_follow-up_to_fr-2609_
Apr 30, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Vitest ↔ Jest compatibility shim for the repo-root `/src` and `/scripts` | ||
| // test suites (FR-2609). | ||
| // | ||
| // Mirrors the shims in `react/__test__/vitest.jest-compat.ts` and | ||
| // `packages/backend.ai-ui/__test__/vitest.jest-compat.ts`. New tests should | ||
| // use `vi.*` directly; this is a migration aid. | ||
| import { vi } from "vitest"; | ||
|
|
||
| // `globals: true` in vitest.config.ts exposes `vi`/`describe`/`test`/etc as | ||
| // globals. This line ALSO exposes `vi` as `jest` so prior Jest-style calls | ||
| // (`jest.fn()`, `jest.spyOn()`, etc.) still resolve. | ||
| // NOTE: `jest.mock()` calls are NOT hoisted by Vitest — only literal | ||
| // `vi.mock()` is. Any test using `jest.mock()` must migrate to `vi.mock()`. | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| (globalThis as any).jest = vi; |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // `@jest/globals` re-export shim for Vitest (FR-2609). | ||
| // | ||
| // Some BUI tests import `{ describe, test, expect, jest }` from | ||
| // `'@jest/globals'`. Vitest's `globals: true` already makes these available | ||
| // as globals, and it also has direct named exports on `vitest` — but the | ||
| // two files that use this import style expect a module specifier of | ||
| // `@jest/globals`. The vitest.config alias maps that specifier to this file. | ||
| export { | ||
| describe, | ||
| test, | ||
| it, | ||
| expect, | ||
| beforeAll, | ||
| beforeEach, | ||
| afterAll, | ||
| afterEach, | ||
| vi as jest, | ||
| } from 'vitest'; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Vitest ↔ Jest compatibility shim for the BUI package (FR-2609). | ||
| // | ||
| // BUI tests still use `jest.fn()`, `jest.mock()`, `jest.spyOn()` etc. Rather | ||
| // than rename every call site, we expose `vi` under the name `jest` so | ||
| // existing tests run unchanged. New tests should use `vi.*` directly. | ||
| // | ||
| // Mirrors `react/__test__/vitest.jest-compat.ts`. | ||
| import { vi } from 'vitest'; | ||
|
|
||
| // `globals: true` in vitest.config.ts exposes `vi`/`describe`/`test`/etc as | ||
| // globals. This line ALSO exposes `vi` as `jest` so prior Jest-style calls | ||
| // still resolve. | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| (globalThis as any).jest = vi; |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.