Skip to content

πŸͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(web): migrate test framework from Jest to Vitest (#13191)

Tobias Wochinger585b50ae7670
diff --git a/.agents/skills/backend-dev-guidelines/AGENTS.md b/.agents/skills/backend-dev-guidelines/AGENTS.md
index c9b25cd406..ff3baba9bb 100644
--- a/.agents/skills/backend-dev-guidelines/AGENTS.md
+++ b/.agents/skills/backend-dev-guidelines/AGENTS.md
@@ -130,8 +130,8 @@ web/src/
β”‚ β”‚ β”œβ”€β”€ public/ # Public REST APIs
β”‚ β”‚ └── trpc/ # tRPC endpoint
β”‚ └── [routes].tsx # Next.js pages
-β”œβ”€β”€ __tests__/ # Jest tests
-β”‚ └── async/ # Integration tests
+β”œβ”€β”€ __tests__/ # Vitest tests
+β”‚ └── server/ # Integration tests
β”œβ”€β”€ instrumentation.ts # OpenTelemetry (FIRST IMPORT)
└── env.mjs # Environment config
```
@@ -359,12 +359,12 @@ Write tests for all new features and bug fixes. See [testing-guide.md](reference
**Test Types:**
-| Type | Framework | Location | Purpose |
-| ----------- | --------- | --------------------------------------- | ---------------------------- |
-| Integration | Jest | `web/src/__tests__/async/` | Full API endpoint testing |
-| tRPC | Jest | `web/src/__tests__/async/` | tRPC procedures with auth |
-| Service | Jest | `web/src/__tests__/async/repositories/` | Repository/service functions |
-| Worker | Vitest | `worker/src/__tests__/` | Queue processors & streams |
+| Type | Framework | Location | Purpose |
+| ----------- | --------- | ------------------------------------------ | ---------------------------- |
+| Integration | Vitest | `web/src/__tests__/server/` | Full API endpoint testing |
+| tRPC | Vitest | `web/src/__tests__/server/` | tRPC procedures with auth |
+| Service | Vitest | `web/src/__tests__/server/repositories/` | Repository/service functions |
+| Worker | Vitest | `worker/src/__tests__/` | Queue processors & streams |
**Quick Examples:**
@@ -570,7 +570,7 @@ Environment variable validation with Zod, package-specific configs (web/env.mjs
### [testing-guide.md](references/testing-guide.md)
-Integration tests (Public API with makeZodVerifiedAPICall), tRPC tests (createInnerTRPCContext, appRouter.createCaller), service-level tests (repository/service functions), worker tests (vitest with streams), test isolation principles, running tests (Jest for web, vitest for worker)
+Integration tests (Public API with makeZodVerifiedAPICall), tRPC tests (createInnerTRPCContext, appRouter.createCaller), service-level tests (repository/service functions), worker tests (vitest with streams), test isolation principles, running tests (Vitest for web and worker)
**Skill Status**: COMPLETE βœ…
**Line Count**: ~540 lines
diff --git a/.agents/skills/backend-dev-guidelines/references/services-and-repositories.md b/.agents/skills/backend-dev-guidelines/references/services-and-repositories.md
index 737b2020b8..3b2e66ea39 100644
--- a/.agents/skills/backend-dev-guidelines/references/services-and-repositories.md
+++ b/.agents/skills/backend-dev-guidelines/references/services-and-repositories.md
@@ -810,16 +810,17 @@ class UserService {
import { UserService } from "../services/userService";
import { userRepository } from "../repositories/UserRepository";
import { ConflictError } from "../utils/errors";
+import type { Mock } from "vitest";
// Mock repository
-jest.mock("../repositories/UserRepository");
+vi.mock("../repositories/UserRepository");
describe("UserService", () => {
let userService: UserService;
beforeEach(() => {
userService = new UserService();
- jest.clearAllMocks();
+ vi.clearAllMocks();
});
describe("createUser", () => {
@@ -831,8 +832,8 @@ describe("UserService", () => {
roles: ["user"],
};
- (userRepository.emailExists as jest.Mock).mockResolvedValue(false);
- (userRepository.create as jest.Mock).mockResolvedValue({
+ (userRepository.emailExists as Mock).mockResolvedValue(false);
+ (userRepository.create as Mock).mockResolvedValue({
userID: "123",
...userData,
});
@@ -855,7 +856,7 @@ describe("UserService", () => {
roles: ["user"],
};
- (userRepository.emailExists as jest.Mock).mockResolvedValue(true);
+ (userRepository.emailExists as Mock).mockResolvedValue(true);
// Act & Assert
await expect(userService.createUser(userData)).rejects.toThrow(
diff --git a/.agents/skills/backend-dev-guidelines/references/testing-guide.md b/.agents/skills/backend-dev-guidelines/references/testing-guide.md
index 672ce5d6cd..9db03aac1a 100644
--- a/.agents/skills/backend-dev-guidelines/references/testing-guide.md
+++ b/.agents/skills/backend-dev-guidelines/references/testing-guide.md
@@ -20,9 +20,9 @@ Langfuse uses multiple testing strategies for different layers:
| Test Type | Framework | Location | Purpose |
|-----------|-----------|----------|---------|
-| Integration | Jest | `web/src/__tests__/async/` | Full API endpoint testing |
-| tRPC | Jest | `web/src/__tests__/async/` | tRPC procedure testing with auth |
-| Service | Jest | `web/src/__tests__/async/repositories/` | Repository/service function testing |
+| Integration | Vitest | `web/src/__tests__/server/` | Full API endpoint testing |
+| tRPC | Vitest | `web/src/__tests__/server/` | tRPC procedure testing with auth |
+| Service | Vitest | `web/src/__tests__/server/repositories/` | Repository/service function testing |
| Worker | Vitest | `worker/src/__tests__/` | Queue processors and streams |
---
@@ -31,7 +31,7 @@ Langfuse uses multiple testing strategies for different layers:
Test full REST API endpoints end-to-end using HTTP requests.
-**File location:** `web/src/__tests__/async/datasets-api.servertest.ts`
+**File location:** `web/src/__tests__/server/datasets-api.servertest.ts`
```typescript
import { makeZodVerifiedAPICall } from "../helpers";
@@ -73,7 +73,7 @@ describe("Dataset API", () => {
Test individual repository/service functions with isolated data.
-**File location:** `web/src/__tests__/async/repositories/event-repository.servertest.ts`
+**File location:** `web/src/__tests__/server/repositories/event-repository.servertest.ts`
```typescript
import {
@@ -186,7 +186,7 @@ describe("Event Repository Tests", () => {
Test tRPC procedures with caller pattern and auth context.
-**File location:** `web/src/__tests__/async/automations-trpc.servertest.ts`
+**File location:** `web/src/__tests__/server/automations-trpc.servertest.ts`
```typescript
import { appRouter } from "@/src/server/api/root";
@@ -505,23 +505,20 @@ const projectId = "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a";
## Running Tests
-### Web Tests (Jest)
+### Web Tests (Vitest)
```bash
-# Run all tests
-pnpm test
+# Run all server tests
+pnpm --filter web run test
-# Run sync tests
-pnpm test-sync
-
-# Run async tests
-pnpm test -- --testPathPattern="async"
+# Run all client tests
+pnpm --filter web run test-client
# Run specific test file
-pnpm test -- --testPathPattern="datasets-api"
+pnpm --filter web run test -- datasets-api
-# Run specific test
-pnpm test -- --testPathPattern="datasets-api" --testNamePattern="should create dataset"
+# Run watch mode
+pnpm --filter web run test:watch
```
### Worker Tests (Vitest)
@@ -537,16 +534,6 @@ pnpm run test --filter=worker -- batchExport
pnpm run test --filter=worker -- batchExport -t "should export observations"
```
-### Coverage
-
-```bash
-# Web coverage
-pnpm test -- --coverage
-
-# Worker coverage
-pnpm run test --filter=worker -- --coverage
-```
-
---
**Related Files:**
diff --git a/.agents/skills/turborepo/references/best-practices/dependencies.md b/.agents/skills/turborepo/references/best-practices/dependencies.md
index 90902e2970..ad81b9e55a 100644
--- a/.agents/skills/turborepo/references/best-practices/dependencies.md
+++ b/.agents/skills/turborepo/references/best-practices/dependencies.md
@@ -94,13 +94,13 @@ cd packages/utils && bun add lodash
```bash
# pnpm
-pnpm add jest --save-dev --filter=web --filter=@repo/ui
+pnpm add vitest --save-dev --filter=web --filter=@repo/ui
# npm
-npm install jest --save-dev --workspace=web --workspace=@repo/ui
+npm install vitest --save-dev --workspace=web --workspace=@repo/ui
# yarn (v2+)
-yarn workspaces foreach -R --from '{web,@repo/ui}' add jest --dev
+yarn workspaces foreach -R --from '{web,@repo/ui}' add vitest --dev
```
### Internal Packages
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index b49689aa39..3451dfcd4e 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -321,11 +321,11 @@ jobs:
LANGFUSE_INIT_USER_PASSWORD: "password"
- name: run tests
working-directory: web
- run: npx dotenv -e ../.env.test -e ../.env -- npx jest --verbose --runInBand --detectOpenHandles --selectProjects server --shard=${{ matrix.shard }}/3
+ run: npx dotenv -e ../.env.test -e ../.env -- vitest run --project server --shard=${{ matrix.shard }}/3
- name: run test-client
if: matrix.deploy-mode == '' && matrix.shard == 1
working-directory: web
- run: npx dotenv -e ../.env.test -e ../.env -- npx jest --verbose --runInBand --detectOpenHandles --selectProjects client
+ run: npx dotenv -e ../.env.test -e ../.env -- vitest run --project client
tests-worker:
timeout-minutes: 20
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3900c99038..27601fb829 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -316,18 +316,16 @@ Tests automatically create the PostgreSQL test database if it doesn't exist and
### Tests in the `web` package (public API)
-We're using Jest with in the `web` package. Therefore, if you want to provide an argument to the test runner, do it directly without an intermittent `--`.
-
-There are two types of unit tests:
+We're using Vitest in the `web` package. There are two types of unit tests:
- `test` (server tests)
- `test-client`
-To run a specific test, for example the test: `"should handle special characters in prompt names"` in `prompts.v2.servertest.ts`, run:
+To run a specific test by name within a file, run:
```sh
cd web # or with --filter=web
-pnpm test --testPathPatterns="prompts\.v2\.servertest" --testNamePattern="should handle special characters in prompt names"
+pnpm test -- prompts.v2.servertest -t "should handle special characters in prompt names"
```
To run all tests:
@@ -344,7 +342,7 @@ pnpm run test:watch
### Tests in the `worker` package
-For the `worker` package, we're using `vitest` to run unit tests.
+For the `worker` package, we're also using Vitest to run unit tests.
```sh
pnpm run test --filter=worker -- FILE_YOU_WANT_TO_TEST.ts -t "test name"
@@ -357,7 +355,7 @@ We use GitHub Actions for CI/CD, the configuration is in [`.github/workflows/pip
CI on `main` and `pull_request`
- Check Linting
-- E2E test of API using Jest
+- E2E test of API using Vitest
- E2E tests of UI using Playwright
CD on `main`
diff --git a/packages/config-typescript/nextjs.json b/packages/config-typescript/nextjs.json
index 37a3457c82..dc1ea1aec6 100644
--- a/packages/config-typescript/nextjs.json
+++ b/packages/config-typescript/nextjs.json
@@ -27,7 +27,6 @@
"isolatedModules": true,
"jsx": "preserve",
"types": [
- "jest",
"node"
],
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 18b5a2d97b..79162c5cdb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -774,9 +774,6 @@ importers:
'@types/eslint':
specifier: ^9.6.1
version: 9.6.1
- '@types/jest':
- specifier: ^29.5.12
- version: 29.5.12
'@types/lodash':
specifier: ^4.17.24
version: 4.17.24
@@ -798,6 +795,9 @@ importers:
'@typescript/native-preview':
specifier: 7.0.0-dev.20260122.3
version: 7.0.0-dev.20260122.3
+ '@vitejs/plugin-react':
+ specifier: ^4.7.0
dotenv-cli:
specifier: ^7.4.2
version: 7.4.4
@@ -807,12 +807,6 @@ importers:
eslint-config-next:
specifier: 16.2.3
- jest:
- specifier: ^30.2.0
- jest-environment-jsdom:
- specifier: ^30.2.0
- version: 30.2.0
node-mocks-http:
specifier: ^1.17.2
version: 1.17.2(@types/[email protected])(@types/[email protected])
@@ -825,15 +819,15 @@ importers:
tailwindcss:
specifier: ^4.2.2
version: 4.2.2
- ts-node:
- specifier: ^10.9.2
- version: 10.9.2(@types/[email protected])([email protected])
- tsconfig-paths:
- specifier: ^4.2.0
- version: 4.2.0
typescript:
specifier: ^5.7.2
version: 5.9.2
+ vite-tsconfig-paths:
+ specifier: ^6.1.1
+ vitest:
+ specifier: ^4.1.4
wait-for-expect:
specifier: ^3.0.2
version: 3.0.2
@@ -1455,6 +1449,18 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
resolution: {integrity: sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==}
engines: {node: '>=6.9.0'}
@@ -2317,16 +2323,6 @@ packages:
resolution: {integrity: sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw==}
engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}
- resolution: {integrity: sha512-kazxw2L9IPuZpQ0mEt9lu9Z98SqR74xcagANmMBU16X0lS23yPc0+S6hGLUz8kVRlomZEs/5S/Zlpqwf5yu6OQ==}
- engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}
- peerDependencies:
- canvas: ^3.0.0
- jsdom: '*'
- peerDependenciesMeta:
- canvas:
- optional: true
-
resolution: {integrity: sha512-/QPTL7OBJQ5ac09UDRa3EQes4gt1FTEG/8jZ/4v5IVzx+Cv7dLxlVIvfvSVRiiX2drWyXeBjkMSR8hvOWSog5g==}
engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}
@@ -4070,6 +4066,9 @@ packages:
peerDependencies:
release-it: '>=18.0.0 || >=19.0.0'
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==}
+
'@rollup/[email protected]':
resolution: {integrity: sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==}
engines: {node: '>=16.0.0 || 14 >= 14.17'}
@@ -5030,9 +5029,6 @@ packages:
resolution: {integrity: sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==}
- '@types/[email protected]':
- resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==}
-
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
@@ -5410,6 +5406,12 @@ packages:
cpu: [x64]
os: [win32]
+ '@vitejs/[email protected]':
+ resolution: {integrity: sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==}
+ engines: {node: ^14.18.0 || >=16.0.0}
+ peerDependencies:
+ vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
+
'@vitest/[email protected]':
resolution: {integrity: sha512-x7FptB5oDruxNPDNY2+S8tCh0pcq7ymCe1gTHcsp733jYjrJl8V1gMUlVysuCD9Kz46Xz9t1akkv08dPcYDs1w==}
peerDependencies:
@@ -7122,6 +7124,9 @@ packages:
resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==}
+
resolution: {integrity: sha512-7ABviyMOlX5hIVD60YOfHw4/CxOfBhyduaYB+wbFWCWoni4N7SLcV46hrVRktuBbZjFC9ONyqamZITN7q3n32w==}
engines: {node: '>=18'}
@@ -7654,15 +7659,6 @@ packages:
resolution: {integrity: sha512-lpWlJlM7bCUf1mfmuqTA8+j2lNURW9eNafOy99knBM01i5CQeY5UH1vZjgT9071nDJac1M4XsbyI44oNOdhlDQ==}
engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}
- resolution: {integrity: sha512-zbBTiqr2Vl78pKp/laGBREYzbZx9ZtqPjOK4++lL4BNDhxRnahg51HtoDrk9/VjIy9IthNEWdKVd7H5bqBhiWQ==}
- engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}
- peerDependencies:
- canvas: ^3.0.0
- peerDependenciesMeta:
- canvas:
- optional: true
-
resolution: {integrity: sha512-ElU8v92QJ9UrYsKrxDIKCxu6PfNj4Hdcktcn0JX12zqNdqWHB0N+hwOnnBBXvjLd2vApZtuLUGs1QSY+MsXoNA==}
engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}
@@ -9322,6 +9318,10 @@ packages:
redux:
optional: true
+ resolution: {integrity: sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==}
+ engines: {node: '>=0.10.0'}
+
resolution: {integrity: sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==}
engines: {node: '>=10'}
@@ -10117,13 +10117,19 @@ packages:
peerDependencies:
typescript: '*'
+ resolution: {integrity: sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==}
+ engines: {node: ^18 || >=20}
+ hasBin: true
+ peerDependencies:
+ typescript: ^5.0.0
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==}
- resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
@@ -10400,6 +10406,11 @@ packages:
'@egjs/hammerjs': ^2.0.0
component-emitter: ^1.3.0 || ^2.0.0
+ resolution: {integrity: sha512-2cihq7zliibCCZ8P9cKJrQBkfgdvcFkOOc3Y02o3GWUDLgqjWsZudaoiuOwO/gzTzy17cS5F7ZPo4bsnS4DGkg==}
+ peerDependencies:
+ vite: '*'
+
resolution: {integrity: sha512-1mncVwJxy2C9ThLwz0+2GKZyEXuC3MyWtAAlNftlZZXZDP3AJt5FmwcMit/IGGaNZ8ZOB2BNO/HFUB+CpN0NQw==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -10733,6 +10744,7 @@ snapshots:
'@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])
'@csstools/css-tokenizer': 3.0.4
lru-cache: 10.4.3
+ optional: true
'@aws-crypto/[email protected]':
dependencies:
@@ -11618,86 +11630,113 @@ snapshots:
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
dependencies:
'@babel/core': 7.29.0
'@babel/helper-plugin-utils': 7.27.1
+ optional: true
+
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/helper-plugin-utils': 7.27.1
+
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/helper-plugin-utils': 7.27.1
'@babel/[email protected]': {}
@@ -11730,7 +11769,8 @@ snapshots:
'@trpc/server': 11.13.4([email protected])
flat: 6.0.1
- '@bcoe/[email protected]': {}
+ optional: true
'@bcoe/[email protected]': {}
@@ -11819,12 +11859,14 @@ snapshots:
dependencies:
'@jridgewell/trace-mapping': 0.3.9
- '@csstools/[email protected]': {}
+ '@csstools/[email protected]':
+ optional: true
'@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':
dependencies:
'@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])
'@csstools/css-tokenizer': 3.0.4
+ optional: true
'@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':
dependencies:
@@ -11832,12 +11874,15 @@ snapshots:
'@csstools/css-calc': 2.1.4(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])
'@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])
'@csstools/css-tokenizer': 3.0.4
+ optional: true
'@csstools/[email protected](@csstools/[email protected])':
dependencies:
'@csstools/css-tokenizer': 3.0.4
+ optional: true
- '@csstools/[email protected]': {}
+ '@csstools/[email protected]':
+ optional: true
dependencies:
@@ -12529,8 +12574,10 @@ snapshots:
get-package-type: 0.1.0
js-yaml: 3.14.2
resolve-from: 5.0.0
+ optional: true
- '@istanbuljs/[email protected]': {}
+ '@istanbuljs/[email protected]':
+ optional: true
'@jedmao/[email protected]': {}
@@ -12542,6 +12589,7 @@ snapshots:
jest-message-util: 30.2.0
jest-util: 30.2.0
slash: 3.0.0
+ optional: true
dependencies:
@@ -12578,19 +12626,10 @@ snapshots:
- esbuild-register
- supports-color
- ts-node
+ optional: true
- '@jest/[email protected]': {}
-
- dependencies:
- '@jest/environment': 30.2.0
- '@jest/fake-timers': 30.2.0
- '@jest/types': 30.2.0
- '@types/jsdom': 21.1.7
- '@types/node': 24.3.0
- jest-mock: 30.2.0
- jest-util: 30.2.0
- jsdom: 26.1.0
+ optional: true
dependencies:
@@ -12598,14 +12637,17 @@ snapshots:
'@jest/types': 30.2.0
'@types/node': 24.3.0
jest-mock: 30.2.0
+ optional: true
dependencies:
jest-get-type: 29.6.3
+ optional: true
dependencies:
'@jest/get-type': 30.1.0
+ optional: true
dependencies:
@@ -12613,6 +12655,7 @@ snapshots:
jest-snapshot: 30.2.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -12622,8 +12665,10 @@ snapshots:
jest-message-util: 30.2.0
jest-mock: 30.2.0
jest-util: 30.2.0
+ optional: true
- '@jest/[email protected]': {}
+ optional: true
dependencies:
@@ -12633,11 +12678,13 @@ snapshots:
jest-mock: 30.2.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
'@types/node': 24.3.0
jest-regex-util: 30.0.1
+ optional: true
dependencies:
@@ -12666,14 +12713,17 @@ snapshots:
v8-to-istanbul: 9.2.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
'@sinclair/typebox': 0.27.8
+ optional: true
dependencies:
'@sinclair/typebox': 0.34.45
+ optional: true
dependencies:
@@ -12681,12 +12731,14 @@ snapshots:
chalk: 4.1.2
graceful-fs: 4.2.11
natural-compare: 1.4.0
+ optional: true
dependencies:
'@jridgewell/trace-mapping': 0.3.31
callsites: 3.1.0
graceful-fs: 4.2.11
+ optional: true
dependencies:
@@ -12694,6 +12746,7 @@ snapshots:
'@jest/types': 30.2.0
'@types/istanbul-lib-coverage': 2.0.6
collect-v8-coverage: 1.0.2
+ optional: true
dependencies:
@@ -12701,6 +12754,7 @@ snapshots:
graceful-fs: 4.2.11
jest-haste-map: 30.2.0
slash: 3.0.0
+ optional: true
dependencies:
@@ -12721,6 +12775,7 @@ snapshots:
write-file-atomic: 5.0.1
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -12730,6 +12785,7 @@ snapshots:
'@types/node': 24.3.0
'@types/yargs': 17.0.35
chalk: 4.1.2
+ optional: true
dependencies:
@@ -12740,6 +12796,7 @@ snapshots:
'@types/node': 24.3.0
'@types/yargs': 17.0.35
chalk: 4.1.2
+ optional: true
'@jridgewell/[email protected]':
dependencies:
@@ -14612,6 +14669,8 @@ snapshots:
release-it: 19.2.4(@types/[email protected])([email protected])
semver: 7.7.4
+ '@rolldown/[email protected]': {}
+
dependencies:
'@rollup/pluginutils': 5.3.0([email protected])
@@ -14919,19 +14978,23 @@ snapshots:
- encoding
- supports-color
- '@sinclair/[email protected]': {}
+ '@sinclair/[email protected]':
+ optional: true
- '@sinclair/[email protected]': {}
+ '@sinclair/[email protected]':
+ optional: true
'@sindresorhus/[email protected]': {}
'@sinonjs/[email protected]':
dependencies:
type-detect: 4.0.8
+ optional: true
'@sinonjs/[email protected]':
dependencies:
'@sinonjs/commons': 3.0.1
+ optional: true
dependencies:
@@ -15663,26 +15726,24 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
+ '@types/[email protected]':
+ optional: true
dependencies:
'@types/istanbul-lib-coverage': 2.0.6
+ optional: true
dependencies:
'@types/istanbul-lib-report': 3.0.3
+ optional: true
dependencies:
expect: 29.7.0
pretty-format: 29.7.0
-
- '@types/[email protected]':
- dependencies:
- '@types/node': 24.3.0
- '@types/tough-cookie': 4.0.5
- parse5: 7.3.0
+ optional: true
'@types/[email protected]': {}
@@ -15799,7 +15860,8 @@ snapshots:
dependencies:
'@types/node': 24.3.0
- '@types/[email protected]': {}
+ '@types/[email protected]':
+ optional: true
'@types/[email protected]': {}
@@ -15822,11 +15884,13 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
+ '@types/[email protected]':
+ optional: true
dependencies:
'@types/yargs-parser': 21.0.3
+ optional: true
dependencies:
@@ -16052,6 +16116,18 @@ snapshots:
optional: true
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/[email protected])
+ '@babel/plugin-transform-react-jsx-source': 7.27.1(@babel/[email protected])
+ '@rolldown/pluginutils': 1.0.0-beta.27
+ '@types/babel__core': 7.20.5
+ react-refresh: 0.17.0
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
'@bcoe/v8-coverage': 1.0.2
@@ -16256,6 +16332,7 @@ snapshots:
dependencies:
type-fest: 0.21.3
+ optional: true
@@ -16273,6 +16350,7 @@ snapshots:
dependencies:
normalize-path: 3.0.0
picomatch: 2.3.2
+ optional: true
@@ -16423,6 +16501,7 @@ snapshots:
slash: 3.0.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -16433,10 +16512,12 @@ snapshots:
test-exclude: 6.0.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
'@types/babel__core': 7.20.5
+ optional: true
dependencies:
@@ -16463,12 +16544,14 @@ snapshots:
'@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/[email protected])
'@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/[email protected])
'@babel/plugin-syntax-top-level-await': 7.14.5(@babel/[email protected])
+ optional: true
dependencies:
'@babel/core': 7.29.0
babel-plugin-jest-hoist: 30.2.0
babel-preset-current-node-syntax: 1.2.0(@babel/[email protected])
+ optional: true
dependencies:
@@ -16542,6 +16625,7 @@ snapshots:
dependencies:
node-int64: 0.4.0
+ optional: true
@@ -16623,7 +16707,8 @@ snapshots:
+ optional: true
@@ -16692,7 +16777,8 @@ snapshots:
+ optional: true
@@ -16742,7 +16828,8 @@ snapshots:
- '@types/react'
- '@types/react-dom'
+ optional: true
dependencies:
@@ -16756,7 +16843,8 @@ snapshots:
transitivePeerDependencies:
- '@lezer/common'
+ optional: true
dependencies:
@@ -16882,6 +16970,7 @@ snapshots:
dependencies:
'@asamuzakjp/css-color': 3.2.0
rrweb-cssom: 0.8.0
+ optional: true
@@ -16939,6 +17028,7 @@ snapshots:
dependencies:
whatwg-mimetype: 4.0.0
whatwg-url: 14.2.0
+ optional: true
dependencies:
@@ -17024,6 +17114,7 @@ snapshots:
optionalDependencies:
babel-plugin-macros: 3.1.0
+ optional: true
@@ -17086,7 +17177,8 @@ snapshots:
dependencies:
dequal: 2.0.3
+ optional: true
@@ -17177,7 +17269,8 @@ snapshots:
+ optional: true
@@ -17214,6 +17307,7 @@ snapshots:
dependencies:
is-arrayish: 0.2.1
+ optional: true
dependencies:
@@ -17358,7 +17452,8 @@ snapshots:
+ optional: true
@@ -17708,6 +17803,7 @@ snapshots:
onetime: 5.1.2
signal-exit: 3.0.7
strip-final-newline: 2.0.0
+ optional: true
dependencies:
@@ -17721,7 +17817,8 @@ snapshots:
signal-exit: 4.1.0
strip-final-newline: 3.0.0
+ optional: true
@@ -17732,6 +17829,7 @@ snapshots:
jest-matcher-utils: 29.7.0
jest-message-util: 29.7.0
jest-util: 29.7.0
+ optional: true
dependencies:
@@ -17741,6 +17839,7 @@ snapshots:
jest-message-util: 30.2.0
jest-mock: 30.2.0
jest-util: 30.2.0
+ optional: true
@@ -17845,6 +17944,7 @@ snapshots:
dependencies:
bser: 2.1.1
+ optional: true
optionalDependencies:
@@ -17891,6 +17991,7 @@ snapshots:
dependencies:
locate-path: 5.0.0
path-exists: 4.0.0
+ optional: true
dependencies:
@@ -18031,14 +18132,16 @@ snapshots:
+ optional: true
dependencies:
dunder-proto: 1.0.1
es-object-atoms: 1.1.1
+ optional: true
@@ -18112,6 +18215,8 @@ snapshots:
define-properties: 1.2.1
gopd: 1.2.0
+
dependencies:
base64-js: 1.5.1
@@ -18227,6 +18332,7 @@ snapshots:
dependencies:
whatwg-encoding: 3.1.1
+ optional: true
@@ -18299,7 +18405,8 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ optional: true
@@ -18355,6 +18462,7 @@ snapshots:
dependencies:
pkg-dir: 4.2.0
resolve-cwd: 3.0.0
+ optional: true
@@ -18424,7 +18532,8 @@ snapshots:
call-bound: 1.0.4
get-intrinsic: 1.3.0
+ optional: true
@@ -18480,7 +18589,8 @@ snapshots:
+ optional: true
dependencies:
@@ -18519,7 +18629,8 @@ snapshots:
+ optional: true
@@ -18612,6 +18723,7 @@ snapshots:
semver: 7.7.4
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -18626,6 +18738,7 @@ snapshots:
istanbul-lib-coverage: 3.2.2
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -18652,6 +18765,7 @@ snapshots:
execa: 5.1.1
jest-util: 30.2.0
p-limit: 3.1.0
+ optional: true
dependencies:
@@ -18678,6 +18792,7 @@ snapshots:
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
+ optional: true
dependencies:
@@ -18697,6 +18812,7 @@ snapshots:
- esbuild-register
- supports-color
- ts-node
+ optional: true
dependencies:
@@ -18730,6 +18846,7 @@ snapshots:
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
+ optional: true
dependencies:
@@ -18737,6 +18854,7 @@ snapshots:
diff-sequences: 29.6.3
jest-get-type: 29.6.3
pretty-format: 29.7.0
+ optional: true
dependencies:
@@ -18744,6 +18862,7 @@ snapshots:
'@jest/get-type': 30.1.0
chalk: 4.1.2
pretty-format: 30.2.0
+ optional: true
dependencies:
@@ -18752,6 +18871,7 @@ snapshots:
dependencies:
detect-newline: 3.1.0
+ optional: true
dependencies:
@@ -18760,18 +18880,7 @@ snapshots:
chalk: 4.1.2
jest-util: 30.2.0
pretty-format: 30.2.0
-
- dependencies:
- '@jest/environment': 30.2.0
- '@jest/environment-jsdom-abstract': 30.2.0([email protected])
- '@types/jsdom': 21.1.7
- '@types/node': 24.3.0
- jsdom: 26.1.0
- transitivePeerDependencies:
- - bufferutil
- - supports-color
- - utf-8-validate
+ optional: true
dependencies:
@@ -18782,8 +18891,10 @@ snapshots:
jest-mock: 30.2.0
jest-util: 30.2.0
jest-validate: 30.2.0
+ optional: true
+ optional: true
dependencies:
@@ -18799,11 +18910,13 @@ snapshots:
walker: 1.0.8
optionalDependencies:
fsevents: 2.3.3
+ optional: true
dependencies:
'@jest/get-type': 30.1.0
pretty-format: 30.2.0
+ optional: true
dependencies:
@@ -18811,6 +18924,7 @@ snapshots:
jest-diff: 29.7.0
jest-get-type: 29.6.3
pretty-format: 29.7.0
+ optional: true
dependencies:
@@ -18818,6 +18932,7 @@ snapshots:
chalk: 4.1.2
jest-diff: 30.2.0
pretty-format: 30.2.0
+ optional: true
dependencies:
@@ -18830,6 +18945,7 @@ snapshots:
pretty-format: 29.7.0
slash: 3.0.0
stack-utils: 2.0.6
+ optional: true
dependencies:
@@ -18842,18 +18958,22 @@ snapshots:
pretty-format: 30.2.0
slash: 3.0.0
stack-utils: 2.0.6
+ optional: true
dependencies:
'@jest/types': 30.2.0
'@types/node': 24.3.0
jest-util: 30.2.0
+ optional: true
optionalDependencies:
jest-resolve: 30.2.0
+ optional: true
+ optional: true
dependencies:
@@ -18861,6 +18981,7 @@ snapshots:
jest-snapshot: 30.2.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -18872,6 +18993,7 @@ snapshots:
jest-validate: 30.2.0
slash: 3.0.0
unrs-resolver: 1.11.1
+ optional: true
dependencies:
@@ -18899,6 +19021,7 @@ snapshots:
source-map-support: 0.5.13
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -18926,6 +19049,7 @@ snapshots:
strip-bom: 4.0.0
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -18952,6 +19076,7 @@ snapshots:
synckit: 0.11.11
transitivePeerDependencies:
- supports-color
+ optional: true
dependencies:
@@ -18961,6 +19086,7 @@ snapshots:
ci-info: 3.9.0
graceful-fs: 4.2.11
picomatch: 2.3.2
+ optional: true
dependencies:
@@ -18970,6 +19096,7 @@ snapshots:
ci-info: 4.4.0
graceful-fs: 4.2.11
picomatch: 4.0.4
+ optional: true
dependencies:
@@ -18979,6 +19106,7 @@ snapshots:
chalk: 4.1.2
leven: 3.1.0
pretty-format: 30.2.0
+ optional: true
dependencies:
@@ -18990,6 +19118,7 @@ snapshots:
emittery: 0.13.1
jest-util: 30.2.0
string-length: 4.0.2
+ optional: true
dependencies:
@@ -19004,6 +19133,7 @@ snapshots:
jest-util: 30.2.0
merge-stream: 2.0.0
supports-color: 8.1.1
+ optional: true
dependencies:
@@ -19017,6 +19147,7 @@ snapshots:
- esbuild-register
- supports-color
- ts-node
+ optional: true
@@ -19078,6 +19209,7 @@ snapshots:
- bufferutil
- supports-color
- utf-8-validate
+ optional: true
@@ -19270,7 +19402,8 @@ snapshots:
+ optional: true
dependencies:
@@ -19328,13 +19461,15 @@ snapshots:
+ optional: true
dependencies:
p-locate: 4.1.0
+ optional: true
dependencies:
@@ -19443,6 +19578,7 @@ snapshots:
dependencies:
tmpl: 1.0.5
+ optional: true
@@ -19862,7 +19998,8 @@ snapshots:
+ optional: true
@@ -20057,7 +20194,8 @@ snapshots:
+ optional: true
dependencies:
@@ -20079,11 +20217,13 @@ snapshots:
+ optional: true
dependencies:
path-key: 3.1.1
+ optional: true
dependencies:
@@ -20093,7 +20233,8 @@ snapshots:
dependencies:
boolbase: 1.0.0
+ optional: true
dependencies:
@@ -20200,6 +20341,7 @@ snapshots:
dependencies:
mimic-fn: 2.1.0
+ optional: true
dependencies:
@@ -20271,6 +20413,7 @@ snapshots:
dependencies:
p-try: 2.2.0
+ optional: true
dependencies:
@@ -20283,6 +20426,7 @@ snapshots:
dependencies:
p-limit: 2.3.0
+ optional: true
dependencies:
@@ -20313,7 +20457,8 @@ snapshots:
+ optional: true
dependencies:
@@ -20355,6 +20500,7 @@ snapshots:
error-ex: 1.3.2
json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.2.4
+ optional: true
dependencies:
@@ -20462,13 +20608,15 @@ snapshots:
+ optional: true
dependencies:
find-up: 4.1.0
+ optional: true
dependencies:
@@ -20554,6 +20702,7 @@ snapshots:
'@jest/schemas': 29.6.3
ansi-styles: 5.2.0
react-is: 18.3.1
+ optional: true
@@ -20562,6 +20711,7 @@ snapshots:
'@jest/schemas': 30.0.5
ansi-styles: 5.2.0
react-is: 18.3.1
+ optional: true
@@ -20641,7 +20791,8 @@ snapshots:
+ optional: true
dependencies:
@@ -20719,7 +20870,8 @@ snapshots:
+ optional: true
@@ -20754,6 +20906,8 @@ snapshots:
'@types/react': 19.2.14
redux: 5.0.1
+
dependencies:
react: 19.2.4
@@ -20984,10 +21138,12 @@ snapshots:
dependencies:
resolve-from: 5.0.0
+ optional: true
+ optional: true
@@ -21074,7 +21230,8 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ optional: true
@@ -21120,6 +21277,7 @@ snapshots:
dependencies:
xmlchars: 2.2.0
+ optional: true
@@ -21273,7 +21431,8 @@ snapshots:
+ optional: true
@@ -21287,7 +21446,8 @@ snapshots:
dependencies:
unicode-emoji-modifier-base: 1.0.0
+ optional: true
@@ -21315,6 +21475,7 @@ snapshots:
dependencies:
buffer-from: 1.1.2
source-map: 0.6.1
+ optional: true
dependencies:
@@ -21359,6 +21520,7 @@ snapshots:
dependencies:
escape-string-regexp: 2.0.0
+ optional: true
@@ -21402,6 +21564,7 @@ snapshots:
dependencies:
char-regex: 1.0.2
strip-ansi: 6.0.1
+ optional: true
dependencies:
@@ -21489,9 +21652,11 @@ snapshots:
+ optional: true
+ optional: true
@@ -21550,7 +21715,8 @@ snapshots:
+ optional: true
dependencies:
@@ -21599,6 +21765,7 @@ snapshots:
'@istanbuljs/schema': 0.1.3
glob: 10.5.0
minimatch: 3.1.5
+ optional: true
@@ -21624,15 +21791,18 @@ snapshots:
+ optional: true
dependencies:
tldts-core: 6.1.86
+ optional: true
+ optional: true
dependencies:
@@ -21650,12 +21820,14 @@ snapshots:
dependencies:
tldts: 6.1.86
+ optional: true
dependencies:
punycode: 2.3.1
+ optional: true
@@ -21695,6 +21867,10 @@ snapshots:
string-argv: 0.3.2
typescript: 5.9.2
+ optionalDependencies:
+ typescript: 5.9.2
+
dependencies:
'@types/json5': 0.0.29
@@ -21702,12 +21878,6 @@ snapshots:
minimist: 1.2.8
strip-bom: 3.0.0
- dependencies:
- json5: 2.2.3
- minimist: 1.2.8
- strip-bom: 3.0.0
-
@@ -21736,9 +21906,11 @@ snapshots:
dependencies:
prelude-ls: 1.2.1
+ optional: true
+ optional: true
@@ -21956,6 +22128,7 @@ snapshots:
'@jridgewell/trace-mapping': 0.3.31
'@types/istanbul-lib-coverage': 2.0.6
convert-source-map: 2.0.0
+ optional: true
@@ -22020,6 +22193,16 @@ snapshots:
'@egjs/hammerjs': 2.0.17
component-emitter: 1.3.1
+ dependencies:
+ debug: 4.4.3
+ globrex: 0.1.2
+ tsconfck: 3.1.6([email protected])
+ transitivePeerDependencies:
+ - supports-color
+ - typescript
+
dependencies:
esbuild: 0.25.12
@@ -22072,12 +22255,14 @@ snapshots:
dependencies:
xml-name-validator: 5.0.0
+ optional: true
dependencies:
makeerror: 1.0.12
+ optional: true
dependencies:
@@ -22090,7 +22275,8 @@ snapshots:
+ optional: true
@@ -22136,6 +22322,7 @@ snapshots:
dependencies:
tr46: 5.1.1
webidl-conversions: 7.0.0
+ optional: true
dependencies:
@@ -22242,16 +22429,20 @@ snapshots:
dependencies:
imurmurhash: 0.1.4
signal-exit: 4.1.0
+ optional: true
+ optional: true
dependencies:
is-wsl: 3.1.1
+ optional: true
+ optional: true
diff --git a/vitest.workspace.ts b/vitest.workspace.ts
index 1a7ac9e0b2..93e9c41faf 100644
--- a/vitest.workspace.ts
+++ b/vitest.workspace.ts
@@ -1 +1 @@
-export default ["worker"];
+export default ["web", "worker"];
diff --git a/web/AGENTS.md b/web/AGENTS.md
index 7c52c18d43..bb3d9feaea 100644
--- a/web/AGENTS.md
+++ b/web/AGENTS.md
@@ -92,8 +92,8 @@ signoff of user-visible changes.
- Lint: `pnpm --filter web run lint`
- Lint fix: `pnpm --filter web run lint:fix`
- Typecheck: `pnpm --filter web run typecheck`
-- Server tests: `pnpm --filter web run test --testPathPatterns="<pattern>"`
-- Client tests: `pnpm --filter web run test-client --testPathPatterns="<pattern>"`
+- Server tests: `pnpm --filter web run test -- <pattern>`
+- Client tests: `pnpm --filter web run test-client -- <pattern>`
- E2E tests: `pnpm --filter web run test:e2e`
- Agent browser install to the default user-level Playwright cache: `pnpm run playwright:install`
- Build: `pnpm --filter web run build`
@@ -132,5 +132,5 @@ signoff of user-visible changes.
## Package-Specific Rules
- Router style is Pages Router-centric; follow existing routing patterns.
- Keep tests independent; no reliance on test execution order.
-- Confirm the target `*.clienttest.*` or `*.servertest.*` file exists before using `--testPathPatterns`; source files do not always have a matching colocated test file.
+- Confirm the target `*.clienttest.*` or `*.servertest.*` file exists before passing a pattern to `vitest run`; source files do not always have a matching colocated test file.
- Do not hand-edit build artifacts: `.next/*`, `.next-check/*`, `dist/*`.
diff --git a/web/jest.config.mjs b/web/jest.config.mjs
deleted file mode 100644
index 6382019ff7..0000000000
--- a/web/jest.config.mjs
+++ /dev/null
@@ -1,77 +0,0 @@
-// jest.config.mjs
-import nextJest from "next/jest.js";
-
-const createJestConfig = nextJest({
- // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
- dir: "./",
-});
-
-const clientTestConfig = {
- displayName: "client",
- testMatch: ["/**/*.clienttest.[jt]s?(x)"],
- testEnvironment: "jest-environment-jsdom",
- testEnvironmentOptions: { globalsCleanup: "on" },
-};
-
-const serverTestConfig = {
- displayName: "server",
- testPathIgnorePatterns: ["__e2e__"],
- testMatch: ["/**/server/**/*.servertest.[jt]s?(x)"],
- testEnvironment: "jest-environment-node",
- testEnvironmentOptions: { globalsCleanup: "on" },
- setupFilesAfterEnv: ["<rootDir>/src/__tests__/after-teardown.ts"],
- globalTeardown: "<rootDir>/src/__tests__/teardown.ts",
-};
-
-const endToEndServerTestConfig = {
- displayName: "e2e-server",
- testMatch: ["/**/*.servertest.[jt]s?(x)"],
- testPathIgnorePatterns: ["__tests__"],
- testEnvironment: "jest-environment-node",
- testEnvironmentOptions: { globalsCleanup: "on" },
- setupFilesAfterEnv: ["<rootDir>/src/__tests__/after-teardown.ts"],
- globalTeardown: "<rootDir>/src/__tests__/teardown.ts",
-};
-
-// To avoid the "Cannot use import statement outside a module" errors while transforming ESM.
-// jsonpath-plus is needed because @langfuse/shared barrel exports evals/utilities which imports it
-const esModules = ["superjson", "jsonpath-plus", "json-schema-faker"];
-
-// ESM-only packages need explicit resolution to bypass Jest's CJS exports-map resolver
-const esmOnlyModuleNameMapper = {
- "^json-schema-faker$":
- "<rootDir>/node_modules/json-schema-faker/dist/index.js",
-};
-
-const transformIgnorePatterns = [
- `/web/node_modules/(?!(${esModules.join("|")})/)`,
-];
-
-// Helper to merge our ESM moduleNameMapper with Next.js's built-in mappings
-const withEsmMapper = (/** @type {import('jest').Config} */ resolved) => ({
- ...resolved,
- transformIgnorePatterns,
- moduleNameMapper: {
- ...resolved.moduleNameMapper,
- ...esmOnlyModuleNameMapper,
- },
-});
-
-// Add any custom config to be passed to Jest
-/** @type {import('jest').Config} */
-const config = {
- // Ignore .next/standalone to avoid "Haste module naming collision" warning
- modulePathIgnorePatterns: ["<rootDir>/.next/"],
- // Jest 30 performance: recycle workers when memory exceeds limit
- workerIdleMemoryLimit: "512MB",
- // Add more setup options before each test is run
- projects: [
- // Added transformIgnorePatterns to handle ESM dependencies from @langfuse/shared
- // Without this, importing from @langfuse/shared fails with "Unexpected token 'export'" errors
- withEsmMapper(await createJestConfig(clientTestConfig)()),
- withEsmMapper(await createJestConfig(serverTestConfig)()),
- withEsmMapper(await createJestConfig(endToEndServerTestConfig)()),
- ],
-};
-
-export default config;
diff --git a/web/package.json b/web/package.json
index c9d4cf6950..0d1b32766d 100644
--- a/web/package.json
+++ b/web/package.json
@@ -17,12 +17,11 @@
"analyze": "dotenv -e ../.env -- next experimental-analyze",
"clean": "rm -rf node_modules",
"start": "dotenv -e ../.env -- sh -c 'NEXT_MANUAL_SIG_HANDLE=true next start'",
- "test": "dotenv -e ../.env.test -e ../.env -- jest --verbose --runInBand --selectProjects server",
- "test-client": "dotenv -e ../.env.test -e ../.env -- jest --verbose --selectProjects client",
- "test:watch": "dotenv -e ../.env.test -e ../.env -- jest --watch --runInBand",
+ "test": "dotenv -e ../.env.test -e ../.env -- vitest run --project server",
+ "test-client": "dotenv -e ../.env.test -e ../.env -- vitest run --project client",
+ "test:watch": "dotenv -e ../.env.test -e ../.env -- vitest --project client --project server",
"test:e2e": "dotenv -e ../.env.test -e ../.env -- playwright test --reporter=line",
- "test:e2e:server": "dotenv -e ../.env.test -e ../.env -- jest --runInBand --verbose --selectProjects e2e-server",
- "test:debug-handles": "dotenv -e ../.env.test -e ../.env -- jest --verbose --runInBand --detectOpenHandles --selectProjects server",
+ "test:e2e:server": "dotenv -e ../.env.test -e ../.env -- vitest run --project e2e-server",
"build-trace": "dotenv -e ../.env -- next internal trace .next/trace-turbopack"
},
"dependencies": {
@@ -179,7 +178,6 @@
"@types/chroma-js": "^3.1.2",
"@types/cors": "^2.8.19",
"@types/eslint": "^9.6.1",
- "@types/jest": "^29.5.12",
"@types/lodash": "^4.17.24",
"@types/node": "24.3.0",
"@types/react": "19.2.14",
@@ -187,18 +185,17 @@
"@types/react-grid-layout": "^1.3.6",
"@types/uuid": "^9.0.8",
"@typescript/native-preview": "7.0.0-dev.20260122.3",
+ "@vitejs/plugin-react": "^4.7.0",
"dotenv-cli": "^7.4.2",
"eslint": "^9.39.2",
"eslint-config-next": "16.2.3",
- "jest": "^30.2.0",
- "jest-environment-jsdom": "^30.2.0",
"node-mocks-http": "^1.17.2",
"prettier": "^3.8.1",
"prettier-plugin-tailwindcss": "^0.7.2",
"tailwindcss": "^4.2.2",
- "ts-node": "^10.9.2",
- "tsconfig-paths": "^4.2.0",
"typescript": "^5.7.2",
+ "vite-tsconfig-paths": "^6.1.1",
+ "vitest": "^4.1.4",
"wait-for-expect": "^3.0.2"
},
"ct3aMetadata": {
diff --git a/web/src/__tests__/buildStepData.clienttest.ts b/web/src/__tests__/buildStepData.clienttest.ts
index a0f3852ce2..654e822e8f 100644
--- a/web/src/__tests__/buildStepData.clienttest.ts
+++ b/web/src/__tests__/buildStepData.clienttest.ts
@@ -1,5 +1,5 @@
// No test dependencies from shared
-jest.mock("@langfuse/shared", () => ({
+vi.mock("@langfuse/shared", () => ({
ObservationType: {
SPAN: "SPAN",
EVENT: "EVENT",
@@ -444,54 +444,58 @@ describe("buildStepData", () => {
expect(result.every((obs) => obs.name.includes("__"))).toBe(true);
});
- it("should handle large number of observations with identical timestamps just below limit", () => {
- // This tests the edge case: create exactly 249 SPAN observations
- // with complex timing patterns that could cause infinite recursion
-
- const observations: AgentGraphDataResponse[] = [];
- const baseTime = new Date("2025-08-28T19:32:09.000Z").getTime();
-
- // Create exactly 249 SPAN observations to test the edge case just under the limit
- for (let i = 0; i < 249; i++) {
- // Create pathological timing patterns:
- // - Many observations with identical start times
- // - Zero duration observations
- // - Complex parent-child relationships
- const groupIndex = Math.floor(i / 20); // Group every 20 observations
- const sameStartTime = baseTime + groupIndex * 100; // Same start time for each group
- const zeroDuration = i % 3 === 0; // Every 3rd observation has zero duration
-
- observations.push(
- createMockObservation({
- id: `span_${i.toString().padStart(3, "0")}`,
- name: `complex_task_${i}`,
- startTime: new Date(sameStartTime).toISOString(),
- endTime: new Date(
- sameStartTime + (zeroDuration ? 0 : 10 + (i % 5)),
- ).toISOString(),
- parentObservationId:
- i === 0
- ? null
- : `span_${Math.max(0, i - 5)
- .toString()
- .padStart(3, "0")}`,
- observationType: "SPAN", // All SPANs, no EVENTs to avoid filtering
- }),
- );
- }
-
- jest.setTimeout(5000); // 5 second timeout to catch infinite recursion
-
- expect(() => {
- const result = buildStepData(observations);
-
- // Should process successfully without infinite recursion
- expect(result).toBeDefined();
- expect(Array.isArray(result)).toBe(true);
- // Should have more than 0 results since we're under the limit
- expect(result.length).toBeGreaterThan(0);
- }).not.toThrow();
- });
+ it(
+ "should handle large number of observations with identical timestamps just below limit",
+ { timeout: 5000 },
+ () => {
+ // This tests the edge case: create exactly 249 SPAN observations
+ // with complex timing patterns that could cause infinite recursion
+
+ const observations: AgentGraphDataResponse[] = [];
+ const baseTime = new Date("2025-08-28T19:32:09.000Z").getTime();
+
+ // Create exactly 249 SPAN observations to test the edge case just under the limit
+ for (let i = 0; i < 249; i++) {
+ // Create pathological timing patterns:
+ // - Many observations with identical start times
+ // - Zero duration observations
+ // - Complex parent-child relationships
+ const groupIndex = Math.floor(i / 20); // Group every 20 observations
+ const sameStartTime = baseTime + groupIndex * 100; // Same start time for each group
+ const zeroDuration = i % 3 === 0; // Every 3rd observation has zero duration
+
+ observations.push(
+ createMockObservation({
+ id: `span_${i.toString().padStart(3, "0")}`,
+ name: `complex_task_${i}`,
+ startTime: new Date(sameStartTime).toISOString(),
+ endTime: new Date(
+ sameStartTime + (zeroDuration ? 0 : 10 + (i % 5)),
+ ).toISOString(),
+ parentObservationId:
+ i === 0
+ ? null
+ : `span_${Math.max(0, i - 5)
+ .toString()
+ .padStart(3, "0")}`,
+ observationType: "SPAN", // All SPANs, no EVENTs to avoid filtering
+ }),
+ );
+ }
+
+ // 5 second timeout to catch infinite recursion is set via test options
+
+ expect(() => {
+ const result = buildStepData(observations);
+
+ // Should process successfully without infinite recursion
+ expect(result).toBeDefined();
+ expect(Array.isArray(result)).toBe(true);
+ // Should have more than 0 results since we're under the limit
+ expect(result.length).toBeGreaterThan(0);
+ }).not.toThrow();
+ },
+ );
it("should handle single observation", () => {
const observations: AgentGraphDataResponse[] = [
diff --git a/web/src/__tests__/chart-loading-state.clienttest.tsx b/web/src/__tests__/chart-loading-state.clienttest.tsx
index 46e608d5af..50c82cddc6 100644
--- a/web/src/__tests__/chart-loading-state.clienttest.tsx
+++ b/web/src/__tests__/chart-loading-state.clienttest.tsx
@@ -1,16 +1,15 @@
import React from "react";
import { act, fireEvent, render, screen } from "@testing-library/react";
-import "@testing-library/jest-dom";
import { SLOW_QUERY_HINT_TEXT } from "@langfuse/shared";
import { ChartLoadingState } from "@/src/features/widgets/chart-library/ChartLoadingState";
describe("ChartLoadingState", () => {
beforeEach(() => {
- jest.useFakeTimers();
+ vi.useFakeTimers();
});
afterEach(() => {
- jest.useRealTimers();
+ vi.useRealTimers();
});
test("keeps legacy pending state spinner-only without loading copy or hint", () => {
@@ -27,7 +26,7 @@ describe("ChartLoadingState", () => {
expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();
act(() => {
- jest.advanceTimersByTime(hintDelayMs);
+ vi.advanceTimersByTime(hintDelayMs);
});
expect(container.querySelector("svg")).toBeInTheDocument();
@@ -42,7 +41,7 @@ describe("ChartLoadingState", () => {
);
act(() => {
- jest.advanceTimersByTime(hintDelayMs);
+ vi.advanceTimersByTime(hintDelayMs);
});
expect(container.querySelector("svg")).toBeInTheDocument();
expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();
@@ -55,7 +54,7 @@ describe("ChartLoadingState", () => {
expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();
act(() => {
- jest.advanceTimersByTime(hintDelayMs);
+ vi.advanceTimersByTime(hintDelayMs);
});
expect(container.querySelector("svg")).toBeInTheDocument();
expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();
@@ -96,7 +95,7 @@ describe("ChartLoadingState", () => {
});
test("renders a retry button for error states when a retry handler is provided", () => {
- const onRetry = jest.fn();
+ const onRetry = vi.fn();
render(
<ChartLoadingState
@@ -121,14 +120,14 @@ describe("ChartLoadingState", () => {
expect(screen.queryByRole("progressbar")).not.toBeInTheDocument();
act(() => {
- jest.advanceTimersByTime(999);
+ vi.advanceTimersByTime(999);
});
expect(container.querySelector("svg")).toBeInTheDocument();
expect(screen.queryByRole("progressbar")).not.toBeInTheDocument();
act(() => {
- jest.advanceTimersByTime(1);
+ vi.advanceTimersByTime(1);
});
expect(container.querySelector("svg")).not.toBeInTheDocument();
@@ -150,7 +149,7 @@ describe("ChartLoadingState", () => {
);
act(() => {
- jest.advanceTimersByTime(1000);
+ vi.advanceTimersByTime(1000);
});
expect(container.querySelector("svg")).not.toBeInTheDocument();
@@ -165,7 +164,7 @@ describe("ChartLoadingState", () => {
render(<ChartLoadingState isLoading={true} progress={progress} />);
act(() => {
- jest.advanceTimersByTime(1000);
+ vi.advanceTimersByTime(1000);
});
const progressbar = screen.getByRole("progressbar", {
@@ -185,14 +184,14 @@ describe("ChartLoadingState", () => {
);
act(() => {
- jest.advanceTimersByTime(1000);
+ vi.advanceTimersByTime(1000);
});
const progressText = screen.getByText("Reading query progress...");
expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();
act(() => {
- jest.advanceTimersByTime(500);
+ vi.advanceTimersByTime(500);
});
const hint = screen.getByText(SLOW_QUERY_HINT_TEXT);
@@ -213,14 +212,14 @@ describe("ChartLoadingState", () => {
);
act(() => {
- jest.advanceTimersByTime(1000);
+ vi.advanceTimersByTime(1000);
});
expect(screen.getByRole("progressbar")).toBeInTheDocument();
expect(screen.queryByText("Running query")).not.toBeInTheDocument();
act(() => {
- jest.advanceTimersByTime(500);
+ vi.advanceTimersByTime(500);
});
expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();
diff --git a/web/src/__tests__/dom.clienttest.ts b/web/src/__tests__/dom.clienttest.ts
index b4fce0993a..5b6f97b163 100644
--- a/web/src/__tests__/dom.clienttest.ts
+++ b/web/src/__tests__/dom.clienttest.ts
@@ -1,4 +1,4 @@
-import * as DOMPurify from "dompurify";
+import DOMPurify from "dompurify";
// Create test cases
describe("should sanitize dom", () => {
diff --git a/web/src/__tests__/nestObservations.clienttest.ts b/web/src/__tests__/nestObservations.clienttest.ts
index 6d25be2b88..9cd990b228 100644
--- a/web/src/__tests__/nestObservations.clienttest.ts
+++ b/web/src/__tests__/nestObservations.clienttest.ts
@@ -1,5 +1,5 @@
// Mock shared dependencies
-jest.mock("@langfuse/shared", () => ({
+vi.mock("@langfuse/shared", () => ({
ObservationLevel: {
DEBUG: "DEBUG",
DEFAULT: "DEFAULT",
diff --git a/web/src/__tests__/pivot-table.clienttest.tsx b/web/src/__tests__/pivot-table.clienttest.tsx
index e6ddcf6b4f..600e458e78 100644
--- a/web/src/__tests__/pivot-table.clienttest.tsx
+++ b/web/src/__tests__/pivot-table.clienttest.tsx
@@ -9,13 +9,12 @@
* - Metric value formatting and display
* - Column header formatting
*
- * Uses Jest and React Testing Library for component testing.
+ * Uses Vitest and React Testing Library for component testing.
* This test focuses on component behavior rather than data transformation logic.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
-import "@testing-library/jest-dom";
import {
PivotTable,
diff --git a/web/src/__tests__/server/admin-access-webhook-middleware.servertest.ts b/web/src/__tests__/server/admin-access-webhook-middleware.servertest.ts
index 2375129fc2..ed4a750b50 100644
--- a/web/src/__tests__/server/admin-access-webhook-middleware.servertest.ts
+++ b/web/src/__tests__/server/admin-access-webhook-middleware.servertest.ts
@@ -1,14 +1,12 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import * as z from "zod";
import { env } from "@/src/env.mjs";
-jest.mock("@langfuse/shared/src/server", () => {
- const originalModule = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const originalModule = await vi.importActual("@langfuse/shared/src/server");
return {
...originalModule,
- getTraceById: jest.fn(),
+ getTraceById: vi.fn(),
};
});
@@ -76,12 +74,12 @@ const createTestCaller = (params: {
}) => {
const mockPrisma = {
project: {
- findFirst: jest.fn().mockResolvedValue({
+ findFirst: vi.fn().mockResolvedValue({
orgId: params.projectOrgId ?? "db-org-id",
}),
},
traceSession: {
- findFirst: jest.fn().mockResolvedValue(
+ findFirst: vi.fn().mockResolvedValue(
params.traceSession ?? {
public: false,
},
@@ -104,7 +102,7 @@ const createTestCaller = (params: {
};
describe("admin access webhook in tRPC authorization middleware", () => {
- const mockGetTraceById = jest.mocked(getTraceById);
+ const mockGetTraceById = vi.mocked(getTraceById);
const originalWebhook = env.LANGFUSE_ADMIN_ACCESS_WEBHOOK;
const originalRegion = env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION;
@@ -115,9 +113,9 @@ describe("admin access webhook in tRPC authorization middleware", () => {
beforeEach(() => {
resetAdminAccessWebhookCacheForTests();
- jest.restoreAllMocks();
- jest.clearAllMocks();
- jest.spyOn(globalThis, "fetch").mockResolvedValue({ ok: true } as Response);
+ vi.restoreAllMocks();
+ vi.clearAllMocks();
+ vi.spyOn(globalThis, "fetch").mockResolvedValue({ ok: true } as Response);
mockGetTraceById.mockResolvedValue({
id: "trace-id",
input: "{}",
@@ -151,7 +149,7 @@ describe("admin access webhook in tRPC authorization middleware", () => {
deletedAt: null,
},
});
- const fetchSpy = jest.mocked(globalThis.fetch);
+ const fetchSpy = vi.mocked(globalThis.fetch);
expect(fetchSpy).toHaveBeenCalledTimes(1);
const request = fetchSpy.mock.calls[0]?.[1] as RequestInit;
const payload = JSON.parse(String(request.body));
@@ -173,7 +171,7 @@ describe("admin access webhook in tRPC authorization middleware", () => {
projectId,
});
- const fetchSpy = jest.mocked(globalThis.fetch);
+ const fetchSpy = vi.mocked(globalThis.fetch);
expect(fetchSpy).toHaveBeenCalledTimes(1);
const request = fetchSpy.mock.calls[0]?.[1] as RequestInit;
const payload = JSON.parse(String(request.body));
@@ -205,7 +203,7 @@ describe("admin access webhook in tRPC authorization middleware", () => {
public: true,
},
});
- const fetchSpy = jest.mocked(globalThis.fetch);
+ const fetchSpy = vi.mocked(globalThis.fetch);
expect(fetchSpy).toHaveBeenCalledTimes(1);
const request = fetchSpy.mock.calls[0]?.[1] as RequestInit;
const payload = JSON.parse(String(request.body));
diff --git a/web/src/__tests__/server/annotation-queue-assignments-api.servertest.ts b/web/src/__tests__/server/annotation-queue-assignments-api.servertest.ts
index fca3584fc5..6051fa0bb6 100644
--- a/web/src/__tests__/server/annotation-queue-assignments-api.servertest.ts
+++ b/web/src/__tests__/server/annotation-queue-assignments-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/annotation-queues-api.servertest.ts b/web/src/__tests__/server/annotation-queues-api.servertest.ts
index d90434454b..866313d088 100644
--- a/web/src/__tests__/server/annotation-queues-api.servertest.ts
+++ b/web/src/__tests__/server/annotation-queues-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { prisma } from "@langfuse/shared/src/db";
import {
makeZodVerifiedAPICall,
diff --git a/web/src/__tests__/server/api-auth.servertest.ts b/web/src/__tests__/server/api-auth.servertest.ts
index f46b93c66d..014cacd6c6 100644
--- a/web/src/__tests__/server/api-auth.servertest.ts
+++ b/web/src/__tests__/server/api-auth.servertest.ts
@@ -534,7 +534,7 @@ describe("Authenticate API calls", () => {
// Mock prisma
const mockPrisma = {
apiKey: {
- findUnique: jest.fn(),
+ findUnique: vi.fn(),
},
};
@@ -596,7 +596,7 @@ describe("Authenticate API calls", () => {
// Mock prisma
const mockPrisma = {
apiKey: {
- findUnique: jest.fn(),
+ findUnique: vi.fn(),
},
};
diff --git a/web/src/__tests__/async/admin-access-webhook.servertest.ts b/web/src/__tests__/server/async/admin-access-webhook.servertest.ts
similarity index 85%
rename from web/src/__tests__/async/admin-access-webhook.servertest.ts
rename to web/src/__tests__/server/async/admin-access-webhook.servertest.ts
index fc322dc276..04804040d9 100644
--- a/web/src/__tests__/async/admin-access-webhook.servertest.ts
+++ b/web/src/__tests__/server/async/admin-access-webhook.servertest.ts
@@ -10,18 +10,18 @@ describe("sendAdminAccessWebhook", () => {
beforeEach(() => {
resetAdminAccessWebhookCacheForTests();
- jest.restoreAllMocks();
+ vi.restoreAllMocks();
});
afterEach(() => {
- jest.useRealTimers();
+ vi.useRealTimers();
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = originalWebhook;
(env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = originalRegion;
});
it("should not send when webhook is not configured", async () => {
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = undefined;
- const fetchSpy = jest
+ const fetchSpy = vi
.spyOn(globalThis, "fetch")
.mockResolvedValue({ ok: true } as Response);
@@ -36,7 +36,7 @@ describe("sendAdminAccessWebhook", () => {
it("should not send when email is missing", async () => {
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
- const fetchSpy = jest
+ const fetchSpy = vi
.spyOn(globalThis, "fetch")
.mockResolvedValue({ ok: true } as Response);
@@ -50,12 +50,12 @@ describe("sendAdminAccessWebhook", () => {
});
it("should send expected payload including project, org and region", async () => {
- jest.useFakeTimers();
- jest.setSystemTime(new Date("2026-02-19T19:39:37.000Z"));
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-02-19T19:39:37.000Z"));
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
(env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = "HIPAA";
- const fetchSpy = jest
+ const fetchSpy = vi
.spyOn(globalThis, "fetch")
.mockResolvedValue({ ok: true } as Response);
@@ -81,12 +81,12 @@ describe("sendAdminAccessWebhook", () => {
});
});
- it("should dedupe repeated sends within 60 seconds for same email/project/org", async () => {
- jest.useFakeTimers();
- jest.setSystemTime(new Date("2026-02-19T19:39:37.000Z"));
+ it("should dedupe repeated sends within 5 minutes for same email/project/org", async () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-02-19T19:39:37.000Z"));
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
- const fetchSpy = jest
+ const fetchSpy = vi
.spyOn(globalThis, "fetch")
.mockResolvedValue({ ok: true } as Response);
@@ -105,11 +105,11 @@ describe("sendAdminAccessWebhook", () => {
});
it("should send again after dedupe window has passed", async () => {
- jest.useFakeTimers();
- jest.setSystemTime(new Date("2026-02-19T19:39:37.000Z"));
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-02-19T19:39:37.000Z"));
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
- const fetchSpy = jest
+ const fetchSpy = vi
.spyOn(globalThis, "fetch")
.mockResolvedValue({ ok: true } as Response);
@@ -119,7 +119,7 @@ describe("sendAdminAccessWebhook", () => {
orgId: "org-1",
});
- jest.setSystemTime(new Date("2026-02-19T19:40:38.000Z"));
+ vi.setSystemTime(new Date("2026-02-19T19:44:38.000Z"));
await sendAdminAccessWebhook({
@@ -133,7 +133,7 @@ describe("sendAdminAccessWebhook", () => {
it("should not dedupe when email/project/org differ", async () => {
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
- const fetchSpy = jest
+ const fetchSpy = vi
.spyOn(globalThis, "fetch")
.mockResolvedValue({ ok: true } as Response);
@@ -154,9 +154,7 @@ describe("sendAdminAccessWebhook", () => {
it("should not throw when fetch rejects", async () => {
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
- jest
- .spyOn(globalThis, "fetch")
- .mockRejectedValue(new Error("network error"));
+ vi.spyOn(globalThis, "fetch").mockRejectedValue(new Error("network error"));
await expect(
sendAdminAccessWebhook({
@@ -170,7 +168,7 @@ describe("sendAdminAccessWebhook", () => {
it("should not throw when fetch returns non-ok response", async () => {
(env as any).LANGFUSE_ADMIN_ACCESS_WEBHOOK = "https://example.com/hook";
- jest.spyOn(globalThis, "fetch").mockResolvedValue({
+ vi.spyOn(globalThis, "fetch").mockResolvedValue({
ok: false,
status: 500,
statusText: "Internal Server Error",
diff --git a/web/src/__tests__/server/automations-trpc.servertest.ts b/web/src/__tests__/server/automations-trpc.servertest.ts
index 93092b25ec..e56a28d892 100644
--- a/web/src/__tests__/server/automations-trpc.servertest.ts
+++ b/web/src/__tests__/server/automations-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { appRouter } from "@/src/server/api/root";
import { createInnerTRPCContext } from "@/src/server/api/trpc";
import { prisma } from "@langfuse/shared/src/db";
diff --git a/web/src/__tests__/server/billingCycleHelpers.servertest.ts b/web/src/__tests__/server/billingCycleHelpers.servertest.ts
index 3609967550..7e4f6bef6a 100644
--- a/web/src/__tests__/server/billingCycleHelpers.servertest.ts
+++ b/web/src/__tests__/server/billingCycleHelpers.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
import {
getBillingCycleAnchor,
getBillingCycleStart,
diff --git a/web/src/__tests__/server/blob-storage-integration-api.servertest.ts b/web/src/__tests__/server/blob-storage-integration-api.servertest.ts
index eaff0d454d..d7fa2f96cc 100644
--- a/web/src/__tests__/server/blob-storage-integration-api.servertest.ts
+++ b/web/src/__tests__/server/blob-storage-integration-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/blob-storage-integration-status-api.servertest.ts b/web/src/__tests__/server/blob-storage-integration-status-api.servertest.ts
index 5abba012d6..8083339ebc 100644
--- a/web/src/__tests__/server/blob-storage-integration-status-api.servertest.ts
+++ b/web/src/__tests__/server/blob-storage-integration-status-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/comments-api.servertest.ts b/web/src/__tests__/server/comments-api.servertest.ts
index c0986cd981..32cf22ab6c 100644
--- a/web/src/__tests__/server/comments-api.servertest.ts
+++ b/web/src/__tests__/server/comments-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { makeZodVerifiedAPICall } from "@/src/__tests__/test-utils";
import {
GetCommentsV1Response,
diff --git a/web/src/__tests__/server/compileChatMessages.servertest.ts b/web/src/__tests__/server/compileChatMessages.servertest.ts
index 66f7725102..a9325b97ce 100644
--- a/web/src/__tests__/server/compileChatMessages.servertest.ts
+++ b/web/src/__tests__/server/compileChatMessages.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
ChatMessageType,
compileChatMessages,
diff --git a/web/src/__tests__/server/createDefaultSpendAlerts.servertest.ts b/web/src/__tests__/server/createDefaultSpendAlerts.servertest.ts
index 1f9b05567f..18b069ab98 100644
--- a/web/src/__tests__/server/createDefaultSpendAlerts.servertest.ts
+++ b/web/src/__tests__/server/createDefaultSpendAlerts.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
import { prisma } from "@langfuse/shared/src/db";
import { createOrgProjectAndApiKey } from "@langfuse/shared/src/server";
import { createDefaultSpendAlerts } from "@/src/ee/features/billing/server/stripeWebhookHandler";
diff --git a/web/src/__tests__/server/dashboard-widget-version.servertest.ts b/web/src/__tests__/server/dashboard-widget-version.servertest.ts
index 8e824e4b0b..88d510e002 100644
--- a/web/src/__tests__/server/dashboard-widget-version.servertest.ts
+++ b/web/src/__tests__/server/dashboard-widget-version.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { v4 as uuidv4 } from "uuid";
import { createOrgProjectAndApiKey } from "@langfuse/shared/src/server";
import { DashboardService } from "@langfuse/shared/src/server";
diff --git a/web/src/__tests__/server/datasets-api.servertest.ts b/web/src/__tests__/server/datasets-api.servertest.ts
index b48a4a5683..1951893588 100644
--- a/web/src/__tests__/server/datasets-api.servertest.ts
+++ b/web/src/__tests__/server/datasets-api.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
// Set environment variable before any imports to ensure it's picked up by env module
process.env.LANGFUSE_DATASET_SERVICE_READ_FROM_VERSIONED_IMPLEMENTATION =
"true";
diff --git a/web/src/__tests__/server/datasets-metrics.servertest.ts b/web/src/__tests__/server/datasets-metrics.servertest.ts
index 74dd7e485a..3bc1fce308 100644
--- a/web/src/__tests__/server/datasets-metrics.servertest.ts
+++ b/web/src/__tests__/server/datasets-metrics.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/datasets-schema-validation.servertest.ts b/web/src/__tests__/server/datasets-schema-validation.servertest.ts
index 29077ac172..c68cfd3f29 100644
--- a/web/src/__tests__/server/datasets-schema-validation.servertest.ts
+++ b/web/src/__tests__/server/datasets-schema-validation.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
import { prisma } from "@langfuse/shared/src/db";
import {
makeAPICall,
diff --git a/web/src/__tests__/server/eval-template-output-definition.servertest.ts b/web/src/__tests__/server/eval-template-output-definition.servertest.ts
index 7aec53d652..b503c637e1 100644
--- a/web/src/__tests__/server/eval-template-output-definition.servertest.ts
+++ b/web/src/__tests__/server/eval-template-output-definition.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { CreateEvalTemplateInputSchema } from "@/src/features/evals/server/router";
import {
createBooleanEvalOutputDefinition,
diff --git a/web/src/__tests__/server/evals-trpc.servertest.ts b/web/src/__tests__/server/evals-trpc.servertest.ts
index 58a6b98346..43b3cb29d8 100644
--- a/web/src/__tests__/server/evals-trpc.servertest.ts
+++ b/web/src/__tests__/server/evals-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { appRouter } from "@/src/server/api/root";
import { createInnerTRPCContext } from "@/src/server/api/trpc";
import { prisma } from "@langfuse/shared/src/db";
diff --git a/web/src/__tests__/server/execute-query-stream.servertest.ts b/web/src/__tests__/server/execute-query-stream.servertest.ts
index 0f4a8a047d..3069fe66de 100644
--- a/web/src/__tests__/server/execute-query-stream.servertest.ts
+++ b/web/src/__tests__/server/execute-query-stream.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
import { v4 } from "uuid";
import { createMocks } from "node-mocks-http";
import type { NextApiRequest, NextApiResponse } from "next";
@@ -12,15 +11,15 @@ import handler from "../../pages/api/dashboard/execute-query-stream";
// --- Auth mock (only thing we need to mock β€” no real session in tests) ---
-const mockGetServerAuthSession = jest.fn();
-jest.mock("../../server/auth", () => ({
+const mockGetServerAuthSession = vi.fn();
+vi.mock("../../server/auth", () => ({
getServerAuthSession: (...args: unknown[]) =>
mockGetServerAuthSession(...args),
}));
// Admin webhook β€” not relevant to streaming logic, just suppress side-effects
-const mockSendAdminAccessWebhook = jest.fn();
-jest.mock("../../server/adminAccessWebhook", () => ({
+const mockSendAdminAccessWebhook = vi.fn();
+vi.mock("../../server/adminAccessWebhook", () => ({
sendAdminAccessWebhook: (...args: unknown[]) =>
mockSendAdminAccessWebhook(...args),
}));
@@ -33,7 +32,7 @@ function createPostMocks(body: unknown) {
body,
});
// node-mocks-http doesn't implement flushHeaders
- res.flushHeaders = jest.fn();
+ res.flushHeaders = vi.fn();
return { req, res };
}
diff --git a/web/src/__tests__/server/experiments-versioning.servertest.ts b/web/src/__tests__/server/experiments-versioning.servertest.ts
index 0755eca81d..be83f54c6d 100644
--- a/web/src/__tests__/server/experiments-versioning.servertest.ts
+++ b/web/src/__tests__/server/experiments-versioning.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
// Set environment variables before imports to ensure VERSIONED mode
process.env.LANGFUSE_DATASET_SERVICE_READ_FROM_VERSIONED_IMPLEMENTATION =
"true";
diff --git a/web/src/__tests__/server/generateUserProjectRolesQuery.servertest.ts b/web/src/__tests__/server/generateUserProjectRolesQuery.servertest.ts
index 8bea15ece7..f73e056cab 100644
--- a/web/src/__tests__/server/generateUserProjectRolesQuery.servertest.ts
+++ b/web/src/__tests__/server/generateUserProjectRolesQuery.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { prisma } from "@langfuse/shared/src/db";
import { Prisma, type Role } from "@langfuse/shared";
import { v4 } from "uuid";
diff --git a/web/src/__tests__/server/ingestion-unit.servertest.ts b/web/src/__tests__/server/ingestion-unit.servertest.ts
index 983b92ba1b..7839b482bd 100644
--- a/web/src/__tests__/server/ingestion-unit.servertest.ts
+++ b/web/src/__tests__/server/ingestion-unit.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { createMocks } from "node-mocks-http";
import handler from "@/src/pages/api/public/ingestion";
import { type NextApiResponse, type NextApiRequest } from "next";
@@ -43,15 +41,15 @@ Timed out fetching a new connection from the connection pool. More info: (Curre
meta: { modelName: 'ApiKey', connection_limit: 1, timeout: 10 }
*/
-jest.mock("@langfuse/shared/src/db", () => {
- const originalModule = jest.requireActual("@langfuse/shared/src/db");
+vi.mock("@langfuse/shared/src/db", async () => {
+ const originalModule = await vi.importActual("@langfuse/shared/src/db");
// Create a mock for PrismaClient
const mockPrismaClient = {
apiKey: {
- findMany: jest.fn(),
- findFirst: jest.fn(),
- findUnique: jest.fn(() => {
+ findMany: vi.fn(),
+ findFirst: vi.fn(),
+ findUnique: vi.fn(() => {
throw new Prisma.PrismaClientKnownRequestError(
"Timed out fetching a new connection from the connection pool. More info: (Current connection pool timeout: 10, connection limit: 1)",
{
@@ -61,18 +59,18 @@ jest.mock("@langfuse/shared/src/db", () => {
},
);
}),
- findUniqueOrThrow: jest.fn(),
- findFirstOrThrow: jest.fn(),
- create: jest.fn(),
- createMany: jest.fn(),
- delete: jest.fn(),
- update: jest.fn(),
- updateMany: jest.fn(),
- upsert: jest.fn(),
- deleteMany: jest.fn(),
- count: jest.fn(),
- aggregate: jest.fn(),
- groupBy: jest.fn(),
+ findUniqueOrThrow: vi.fn(),
+ findFirstOrThrow: vi.fn(),
+ create: vi.fn(),
+ createMany: vi.fn(),
+ delete: vi.fn(),
+ update: vi.fn(),
+ updateMany: vi.fn(),
+ upsert: vi.fn(),
+ deleteMany: vi.fn(),
+ count: vi.fn(),
+ aggregate: vi.fn(),
+ groupBy: vi.fn(),
},
};
diff --git a/web/src/__tests__/server/llm-api-key.servertest.ts b/web/src/__tests__/server/llm-api-key.servertest.ts
index 8c6ec2b7b7..b09457898d 100644
--- a/web/src/__tests__/server/llm-api-key.servertest.ts
+++ b/web/src/__tests__/server/llm-api-key.servertest.ts
@@ -1,10 +1,8 @@
-/** @jest-environment node */
-
-jest.mock("@langfuse/shared/src/server", () => {
- const actual = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const actual = await vi.importActual("@langfuse/shared/src/server");
return {
...actual,
- fetchLLMCompletion: jest.fn(),
+ fetchLLMCompletion: vi.fn(),
};
});
@@ -21,7 +19,7 @@ import {
fetchLLMCompletion,
} from "@langfuse/shared/src/server";
-const mockFetchLLMCompletion = jest.mocked(fetchLLMCompletion);
+const mockFetchLLMCompletion = vi.mocked(fetchLLMCompletion);
describe("llmApiKey.all RPC", () => {
let projectId: string;
diff --git a/web/src/__tests__/server/llm-connections-api.servertest.ts b/web/src/__tests__/server/llm-connections-api.servertest.ts
index b4447d26fc..1c9039146f 100644
--- a/web/src/__tests__/server/llm-connections-api.servertest.ts
+++ b/web/src/__tests__/server/llm-connections-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { prisma } from "@langfuse/shared/src/db";
import {
makeAPICall,
diff --git a/web/src/__tests__/server/mcp-auth.servertest.ts b/web/src/__tests__/server/mcp-auth.servertest.ts
index 287f14ad45..080161f6e2 100644
--- a/web/src/__tests__/server/mcp-auth.servertest.ts
+++ b/web/src/__tests__/server/mcp-auth.servertest.ts
@@ -1,15 +1,13 @@
-/** @jest-environment node */
-
// Mock queue operations to avoid Redis dependency in tests
-jest.mock("@langfuse/shared/src/server", () => {
- const actual = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const actual = await vi.importActual("@langfuse/shared/src/server");
return {
...actual,
// Mock queue getInstance to return a no-op queue
EventPropagationQueue: {
getInstance: () => ({
- add: jest.fn().mockResolvedValue(undefined),
- disconnect: jest.fn(),
+ add: vi.fn().mockResolvedValue(undefined),
+ disconnect: vi.fn(),
}),
},
};
diff --git a/web/src/__tests__/server/mcp-error-formatting.servertest.ts b/web/src/__tests__/server/mcp-error-formatting.servertest.ts
index 0f28899a80..a8a2e64695 100644
--- a/web/src/__tests__/server/mcp-error-formatting.servertest.ts
+++ b/web/src/__tests__/server/mcp-error-formatting.servertest.ts
@@ -1,15 +1,13 @@
-/** @jest-environment node */
-
// Mock queue operations to avoid Redis dependency in tests
-jest.mock("@langfuse/shared/src/server", () => {
- const actual = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const actual = await vi.importActual("@langfuse/shared/src/server");
return {
...actual,
// Mock queue getInstance to return a no-op queue
EventPropagationQueue: {
getInstance: () => ({
- add: jest.fn().mockResolvedValue(undefined),
- disconnect: jest.fn(),
+ add: vi.fn().mockResolvedValue(undefined),
+ disconnect: vi.fn(),
}),
},
};
diff --git a/web/src/__tests__/server/mcp-tools-read.servertest.ts b/web/src/__tests__/server/mcp-tools-read.servertest.ts
index 7c007f0859..82d144915b 100644
--- a/web/src/__tests__/server/mcp-tools-read.servertest.ts
+++ b/web/src/__tests__/server/mcp-tools-read.servertest.ts
@@ -1,15 +1,13 @@
-/** @jest-environment node */
-
// Mock queue operations to avoid Redis dependency in tests
-jest.mock("@langfuse/shared/src/server", () => {
- const actual = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const actual = await vi.importActual("@langfuse/shared/src/server");
return {
...actual,
// Mock queue getInstance to return a no-op queue
EventPropagationQueue: {
getInstance: () => ({
- add: jest.fn().mockResolvedValue(undefined),
- disconnect: jest.fn(),
+ add: vi.fn().mockResolvedValue(undefined),
+ disconnect: vi.fn(),
}),
},
};
diff --git a/web/src/__tests__/server/mcp-tools-write.servertest.ts b/web/src/__tests__/server/mcp-tools-write.servertest.ts
index e708ad13fe..78b3be8210 100644
--- a/web/src/__tests__/server/mcp-tools-write.servertest.ts
+++ b/web/src/__tests__/server/mcp-tools-write.servertest.ts
@@ -1,21 +1,19 @@
-/** @jest-environment node */
-
// Mock queue operations to avoid Redis dependency in tests
-jest.mock("@langfuse/shared/src/server", () => {
- const actual = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const actual = await vi.importActual("@langfuse/shared/src/server");
return {
...actual,
// Mock queue getInstance to return a no-op queue
EventPropagationQueue: {
getInstance: () => ({
- add: jest.fn().mockResolvedValue(undefined),
- disconnect: jest.fn(),
+ add: vi.fn().mockResolvedValue(undefined),
+ disconnect: vi.fn(),
}),
},
EntityChangeQueue: {
getInstance: () => ({
- add: jest.fn().mockResolvedValue(undefined),
- disconnect: jest.fn(),
+ add: vi.fn().mockResolvedValue(undefined),
+ disconnect: vi.fn(),
}),
},
};
diff --git a/web/src/__tests__/server/members-trpc.servertest.ts b/web/src/__tests__/server/members-trpc.servertest.ts
index 3b6f93866e..6d8faef1d7 100644
--- a/web/src/__tests__/server/members-trpc.servertest.ts
+++ b/web/src/__tests__/server/members-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { appRouter } from "@/src/server/api/root";
import { createInnerTRPCContext } from "@/src/server/api/trpc";
import { prisma } from "@langfuse/shared/src/db";
diff --git a/web/src/__tests__/server/memberships-api.servertest.ts b/web/src/__tests__/server/memberships-api.servertest.ts
index 8c4c1c3164..7ca2e7fea7 100644
--- a/web/src/__tests__/server/memberships-api.servertest.ts
+++ b/web/src/__tests__/server/memberships-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/model-definitions.servertest.ts b/web/src/__tests__/server/model-definitions.servertest.ts
index 968cdb3d01..990d6fa9f2 100644
--- a/web/src/__tests__/server/model-definitions.servertest.ts
+++ b/web/src/__tests__/server/model-definitions.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { prisma } from "@langfuse/shared/src/db";
import {
makeAPICall,
diff --git a/web/src/__tests__/server/model-pricing-tiers.servertest.ts b/web/src/__tests__/server/model-pricing-tiers.servertest.ts
index b17cec5123..475d5a6961 100644
--- a/web/src/__tests__/server/model-pricing-tiers.servertest.ts
+++ b/web/src/__tests__/server/model-pricing-tiers.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { randomUUID } from "crypto";
import { prisma } from "@langfuse/shared/src/db";
import {
diff --git a/web/src/__tests__/server/observations-comment-filter.servertest.ts b/web/src/__tests__/server/observations-comment-filter.servertest.ts
index a797d7354a..d2bcbfa912 100644
--- a/web/src/__tests__/server/observations-comment-filter.servertest.ts
+++ b/web/src/__tests__/server/observations-comment-filter.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/observations-trpc.servertest.ts b/web/src/__tests__/server/observations-trpc.servertest.ts
index 67398a50da..5c5fc5a673 100644
--- a/web/src/__tests__/server/observations-trpc.servertest.ts
+++ b/web/src/__tests__/server/observations-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/organizations-api-key-trpc.servertest.ts b/web/src/__tests__/server/organizations-api-key-trpc.servertest.ts
index b7bef1d98d..8693269e85 100644
--- a/web/src/__tests__/server/organizations-api-key-trpc.servertest.ts
+++ b/web/src/__tests__/server/organizations-api-key-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/organizations-api.servertest.ts b/web/src/__tests__/server/organizations-api.servertest.ts
index 48e7573e5e..9740cce152 100644
--- a/web/src/__tests__/server/organizations-api.servertest.ts
+++ b/web/src/__tests__/server/organizations-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/posthog-integration.servertest.ts b/web/src/__tests__/server/posthog-integration.servertest.ts
index be3749ce96..c10eee45b0 100644
--- a/web/src/__tests__/server/posthog-integration.servertest.ts
+++ b/web/src/__tests__/server/posthog-integration.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/projects-api.servertest.ts b/web/src/__tests__/server/projects-api.servertest.ts
index 8a9081cec9..6bd27a9a50 100644
--- a/web/src/__tests__/server/projects-api.servertest.ts
+++ b/web/src/__tests__/server/projects-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/promptCache.servertest.ts b/web/src/__tests__/server/promptCache.servertest.ts
index eaf270574b..af3012e004 100644
--- a/web/src/__tests__/server/promptCache.servertest.ts
+++ b/web/src/__tests__/server/promptCache.servertest.ts
@@ -1,3 +1,4 @@
+import type { Mock, Mocked } from "vitest";
import { type PrismaClient, type Prompt } from "@prisma/client";
import { PromptService, type redis } from "@langfuse/shared/src/server"; // Adjust the import path as needed
@@ -5,9 +6,9 @@ type Redis = NonNullable<typeof redis>;
describe("PromptService", () => {
let promptService: PromptService;
- let mockPrisma: jest.Mocked<PrismaClient>;
- let mockRedis: jest.Mocked<Redis>;
- let mockMetricIncrementer: jest.Mock;
+ let mockPrisma: Mocked<PrismaClient>;
+ let mockRedis: Mocked<Redis>;
+ let mockMetricIncrementer: Mock;
const mockPrompt: Omit<Prompt, "updatedAt" | "createdAt"> & {
resolutionGraph: null;
@@ -30,20 +31,20 @@ describe("PromptService", () => {
beforeEach(() => {
mockPrisma = {
prompt: {
- findFirst: jest.fn(),
+ findFirst: vi.fn(),
},
promptDependency: {
- findMany: jest.fn().mockResolvedValue([]),
+ findMany: vi.fn().mockResolvedValue([]),
},
- } as unknown as jest.Mocked<PrismaClient>;
+ } as unknown as Mocked<PrismaClient>;
mockRedis = {
- get: jest.fn().mockResolvedValue("epoch-1"),
- set: jest.fn(),
- del: jest.fn(),
- } as unknown as jest.Mocked<Redis>;
+ get: vi.fn().mockResolvedValue("epoch-1"),
+ set: vi.fn(),
+ del: vi.fn(),
+ } as unknown as Mocked<Redis>;
- mockMetricIncrementer = jest.fn();
+ mockMetricIncrementer = vi.fn();
promptService = new PromptService(
mockPrisma,
diff --git a/web/src/__tests__/server/prompts.v1.servertest.ts b/web/src/__tests__/server/prompts.v1.servertest.ts
index c51a7b23a0..aa6146660c 100644
--- a/web/src/__tests__/server/prompts.v1.servertest.ts
+++ b/web/src/__tests__/server/prompts.v1.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { prisma } from "@langfuse/shared/src/db";
import { makeAPICall } from "@/src/__tests__/test-utils";
import { v4 as uuidv4, v4 } from "uuid";
diff --git a/web/src/__tests__/server/prompts.v2.servertest.ts b/web/src/__tests__/server/prompts.v2.servertest.ts
index 5007423464..1a20d4f981 100644
--- a/web/src/__tests__/server/prompts.v2.servertest.ts
+++ b/web/src/__tests__/server/prompts.v2.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { prisma } from "@langfuse/shared/src/db";
import { disconnectQueues, makeAPICall } from "@/src/__tests__/test-utils";
import { v4 as uuidv4, v4 } from "uuid";
diff --git a/web/src/__tests__/server/queryBuilderSQLI.servertest.ts b/web/src/__tests__/server/queryBuilderSQLI.servertest.ts
index 20e4baebe8..8e712ea789 100644
--- a/web/src/__tests__/server/queryBuilderSQLI.servertest.ts
+++ b/web/src/__tests__/server/queryBuilderSQLI.servertest.ts
@@ -21,10 +21,10 @@ describe("QueryBuilder SQL Injection Tests", () => {
// Create a mock ClickHouse client for testing
const mockClickhouseClient = {
- query: jest.fn().mockImplementation(({ query, query_params }) => {
+ query: vi.fn().mockImplementation(({ query, query_params }) => {
// Return the query and params for inspection in tests
return Promise.resolve({
- json: jest.fn().mockReturnValue({
+ json: vi.fn().mockReturnValue({
data: [],
query,
params: query_params,
@@ -40,7 +40,7 @@ describe("QueryBuilder SQL Injection Tests", () => {
};
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
});
describe("SQL Injection via View Parameter", () => {
@@ -579,7 +579,7 @@ describe("QueryBuilder SQL Injection Tests", () => {
it("should safely handle malicious query parameters through executeQuery", async () => {
// Comment: This tests the integration with the dashboard router's executeQuery function
// to ensure SQL injection protection works end-to-end
- jest.spyOn(console, "error").mockImplementation(() => {});
+ vi.spyOn(console, "error").mockImplementation(() => {});
const maliciousQuery: QueryType = {
view: "traces",
diff --git a/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts b/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts
index a6a924f73c..8195e82fbd 100644
--- a/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts
+++ b/web/src/__tests__/server/repositories/clickhouse-insert-strings.servertest.ts
@@ -16,7 +16,7 @@ const maybeIt = (name: string, testFn: () => Promise<void>): void => {
describe("ClickHouse insert string edge cases", () => {
it("should pass", () => {
- // Apparently each jest file needs at least one executed test and cannot have everything skipped
+ // Apparently each test file needs at least one executed test and cannot have everything skipped
expect(true).toBe(true);
});
diff --git a/web/src/__tests__/server/repositories/dataset-items-repository.servertest.ts b/web/src/__tests__/server/repositories/dataset-items-repository.servertest.ts
index de7abf3fcd..e20cd0c808 100644
--- a/web/src/__tests__/server/repositories/dataset-items-repository.servertest.ts
+++ b/web/src/__tests__/server/repositories/dataset-items-repository.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
// Set environment variables before any imports to ensure VERSIONED mode
process.env.LANGFUSE_DATASET_SERVICE_READ_FROM_VERSIONED_IMPLEMENTATION =
"true";
diff --git a/web/src/__tests__/server/scim-api.servertest.ts b/web/src/__tests__/server/scim-api.servertest.ts
index 5d2ca6ed89..d2d18d9ecd 100644
--- a/web/src/__tests__/server/scim-api.servertest.ts
+++ b/web/src/__tests__/server/scim-api.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeZodVerifiedAPICall,
makeAPICall,
diff --git a/web/src/__tests__/server/score-comparison-analytics.servertest.ts b/web/src/__tests__/server/score-comparison-analytics.servertest.ts
index f2c095747b..aff5322d43 100644
--- a/web/src/__tests__/server/score-comparison-analytics.servertest.ts
+++ b/web/src/__tests__/server/score-comparison-analytics.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/score-configs.servertest.ts b/web/src/__tests__/server/score-configs.servertest.ts
index 5f03d22eb4..694f798ea5 100644
--- a/web/src/__tests__/server/score-configs.servertest.ts
+++ b/web/src/__tests__/server/score-configs.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
makeAPICall,
makeZodVerifiedAPICall,
diff --git a/web/src/__tests__/server/scores-trpc.servertest.ts b/web/src/__tests__/server/scores-trpc.servertest.ts
index ec32d35ce4..83f44a5ce8 100644
--- a/web/src/__tests__/server/scores-trpc.servertest.ts
+++ b/web/src/__tests__/server/scores-trpc.servertest.ts
@@ -1,19 +1,17 @@
-/** @jest-environment node */
+const mockAddScoreDelete = vi.fn();
+const mockAddBatchAction = vi.fn();
-const mockAddScoreDelete = jest.fn();
-const mockAddBatchAction = jest.fn();
-
-jest.mock("@langfuse/shared/src/server", () => {
- const originalModule = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const originalModule = await vi.importActual("@langfuse/shared/src/server");
return {
...originalModule,
ScoreDeleteQueue: {
- getInstance: jest.fn(() => ({
+ getInstance: vi.fn(() => ({
add: mockAddScoreDelete,
})),
},
BatchActionQueue: {
- getInstance: jest.fn(() => ({
+ getInstance: vi.fn(() => ({
add: mockAddBatchAction,
})),
},
diff --git a/web/src/__tests__/server/sessions-comment-filter.servertest.ts b/web/src/__tests__/server/sessions-comment-filter.servertest.ts
index ae9aa5a649..6092110826 100644
--- a/web/src/__tests__/server/sessions-comment-filter.servertest.ts
+++ b/web/src/__tests__/server/sessions-comment-filter.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/sessions-trpc.servertest.ts b/web/src/__tests__/server/sessions-trpc.servertest.ts
index a600535452..d36b5c7403 100644
--- a/web/src/__tests__/server/sessions-trpc.servertest.ts
+++ b/web/src/__tests__/server/sessions-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/sessions.servertest.ts b/web/src/__tests__/server/sessions.servertest.ts
index 46f275b649..92565cd326 100644
--- a/web/src/__tests__/server/sessions.servertest.ts
+++ b/web/src/__tests__/server/sessions.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import { makeZodVerifiedAPICall } from "@/src/__tests__/test-utils";
import { PostTracesV1Response } from "@/src/features/public-api/types/traces";
import { prisma } from "@langfuse/shared/src/db";
diff --git a/web/src/__tests__/server/slack-integration.servertest.ts b/web/src/__tests__/server/slack-integration.servertest.ts
index c6c78c9b6c..ffcc5787fd 100644
--- a/web/src/__tests__/server/slack-integration.servertest.ts
+++ b/web/src/__tests__/server/slack-integration.servertest.ts
@@ -1,3 +1,4 @@
+import type { Mock } from "vitest";
import { prisma } from "@langfuse/shared/src/db";
import type { Session } from "next-auth";
import { encrypt } from "@langfuse/shared/encryption";
@@ -7,12 +8,12 @@ import { createOrgProjectAndApiKey } from "@langfuse/shared/src/server";
import { TRPCError } from "@trpc/server";
// Mock SlackService
-jest.mock("@langfuse/shared/src/server", () => {
- const actual = jest.requireActual("@langfuse/shared/src/server");
+vi.mock("@langfuse/shared/src/server", async () => {
+ const actual = await vi.importActual("@langfuse/shared/src/server");
return {
...actual,
SlackService: {
- getInstance: jest.fn(),
+ getInstance: vi.fn(),
},
};
});
@@ -76,16 +77,16 @@ describe("Slack Integration", () => {
// Create mock service instance
mockSlackService = {
- getWebClientForProject: jest.fn(),
- sendMessage: jest.fn(),
- getChannels: jest.fn(),
- getChannelInfo: jest.fn(),
- validateClient: jest.fn(),
- deleteIntegration: jest.fn(),
+ getWebClientForProject: vi.fn(),
+ sendMessage: vi.fn(),
+ getChannels: vi.fn(),
+ getChannelInfo: vi.fn(),
+ validateClient: vi.fn(),
+ deleteIntegration: vi.fn(),
};
// Setup the getInstance mock to return our mock service
- (SlackService.getInstance as jest.Mock).mockReturnValue(mockSlackService);
+ (SlackService.getInstance as Mock).mockReturnValue(mockSlackService);
});
afterAll(async () => {
@@ -267,7 +268,7 @@ describe("Slack Integration", () => {
describe("sendTestMessage", () => {
it("should send test message successfully", async () => {
- const mockClient = { auth: { test: jest.fn() } };
+ const mockClient = { auth: { test: vi.fn() } };
mockSlackService.getWebClientForProject.mockResolvedValue(mockClient);
mockSlackService.sendMessage.mockResolvedValue({
messageTs: "1234567890.123456",
@@ -312,7 +313,7 @@ describe("Slack Integration", () => {
});
it("should resolve channel info for manually-typed channel names", async () => {
- const mockClient = { auth: { test: jest.fn() } };
+ const mockClient = { auth: { test: vi.fn() } };
mockSlackService.getWebClientForProject.mockResolvedValue(mockClient);
mockSlackService.sendMessage.mockResolvedValue({
messageTs: "1234567890.123456",
@@ -377,7 +378,7 @@ describe("Slack Integration", () => {
});
it("should create audit log entry", async () => {
- const mockClient = { auth: { test: jest.fn() } };
+ const mockClient = { auth: { test: vi.fn() } };
mockSlackService.getWebClientForProject.mockResolvedValue(mockClient);
mockSlackService.sendMessage.mockResolvedValue({
messageTs: "1234567890.123456",
diff --git a/web/src/__tests__/server/traces-comment-filter.servertest.ts b/web/src/__tests__/server/traces-comment-filter.servertest.ts
index 63a3554bfe..c661da5f96 100644
--- a/web/src/__tests__/server/traces-comment-filter.servertest.ts
+++ b/web/src/__tests__/server/traces-comment-filter.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/traces-trpc.servertest.ts b/web/src/__tests__/server/traces-trpc.servertest.ts
index 3f95b82a79..1ce0dfa61a 100644
--- a/web/src/__tests__/server/traces-trpc.servertest.ts
+++ b/web/src/__tests__/server/traces-trpc.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import type { Session } from "next-auth";
import { prisma } from "@langfuse/shared/src/db";
import { appRouter } from "@/src/server/api/root";
diff --git a/web/src/__tests__/server/validate-config-against-body.servertest.ts b/web/src/__tests__/server/validate-config-against-body.servertest.ts
index 2f1c5c85c1..2883576942 100644
--- a/web/src/__tests__/server/validate-config-against-body.servertest.ts
+++ b/web/src/__tests__/server/validate-config-against-body.servertest.ts
@@ -1,5 +1,3 @@
-/** @jest-environment node */
-
import {
validateConfigAgainstBody,
type ScoreConfigDomain,
diff --git a/web/src/__tests__/server/withMiddlewares.servertest.ts b/web/src/__tests__/server/withMiddlewares.servertest.ts
index d4df2d993f..a6b98b8ca1 100644
--- a/web/src/__tests__/server/withMiddlewares.servertest.ts
+++ b/web/src/__tests__/server/withMiddlewares.servertest.ts
@@ -1,4 +1,3 @@
-/** @jest-environment node */
import type { NextApiRequest, NextApiResponse } from "next";
import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";
import {
@@ -17,20 +16,20 @@ import { z } from "zod";
import { Prisma } from "@prisma/client";
// Mock the logger and traceException
-jest.mock("@langfuse/shared/src/server", () => ({
- ...jest.requireActual("@langfuse/shared/src/server"),
+vi.mock("@langfuse/shared/src/server", async () => ({
+ ...(await vi.importActual("@langfuse/shared/src/server")),
logger: {
- info: jest.fn(),
- warn: jest.fn(),
- error: jest.fn(),
- debug: jest.fn(),
+ info: vi.fn(),
+ warn: vi.fn(),
+ error: vi.fn(),
+ debug: vi.fn(),
},
- traceException: jest.fn(),
+ traceException: vi.fn(),
}));
describe("withMiddlewares error handling", () => {
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
});
describe("BaseError handling", () => {
diff --git a/web/src/__tests__/sse-dashboard-query.clienttest.ts b/web/src/__tests__/sse-dashboard-query.clienttest.ts
index dbdeb6e2e6..aa10a14c14 100644
--- a/web/src/__tests__/sse-dashboard-query.clienttest.ts
+++ b/web/src/__tests__/sse-dashboard-query.clienttest.ts
@@ -149,7 +149,7 @@ describe("useSSEDashboardQuery", () => {
let index = 0;
return {
- read: jest.fn().mockImplementation(async () => {
+ read: vi.fn().mockImplementation(async () => {
if (index < chunks.length) {
return {
done: false,
@@ -184,13 +184,13 @@ describe("useSSEDashboardQuery", () => {
afterEach(() => {
global.fetch = originalFetch;
global.TextDecoder = originalTextDecoder;
- jest.restoreAllMocks();
+ vi.restoreAllMocks();
});
it("preserves successful state when disabled after the stream completes", async () => {
const encoder = new TextEncoder();
- global.fetch = jest.fn().mockImplementation(async () => ({
+ global.fetch = vi.fn().mockImplementation(async () => ({
ok: true,
body: {
getReader: () =>
@@ -236,7 +236,7 @@ describe("useSSEDashboardQuery", () => {
const encoder = new TextEncoder();
let releaseSecondResponse: (() => void) | null = null;
- global.fetch = jest
+ global.fetch = vi
.fn()
.mockImplementationOnce(async () => ({
ok: true,
@@ -263,7 +263,7 @@ describe("useSSEDashboardQuery", () => {
});
return {
- read: jest.fn().mockImplementation(async () => {
+ read: vi.fn().mockImplementation(async () => {
if (!released) {
await waitForRelease;
}
diff --git a/web/src/__tests__/statistics-utils.clienttest.ts b/web/src/__tests__/statistics-utils.clienttest.ts
index 48e38e7dfe..d08de1b362 100644
--- a/web/src/__tests__/statistics-utils.clienttest.ts
+++ b/web/src/__tests__/statistics-utils.clienttest.ts
@@ -1,6 +1,4 @@
-/**
- * @jest-environment node
- */
+// @vitest-environment node
import {
calculateCohensKappa,
diff --git a/web/src/__tests__/vitest-global-teardown.ts b/web/src/__tests__/vitest-global-teardown.ts
new file mode 100644
index 0000000000..65611c84f9
--- /dev/null
+++ b/web/src/__tests__/vitest-global-teardown.ts
@@ -0,0 +1,5 @@
+import teardownFn from "./teardown";
+
+export async function teardown() {
+ await teardownFn();
+}
diff --git a/web/src/components/ChatMessages/messageSearch/controller.clienttest.ts b/web/src/components/ChatMessages/messageSearch/controller.clienttest.ts
index 6b812eb979..28e3653de6 100644
--- a/web/src/components/ChatMessages/messageSearch/controller.clienttest.ts
+++ b/web/src/components/ChatMessages/messageSearch/controller.clienttest.ts
@@ -6,20 +6,20 @@ import {
import { createMessageSearchController } from "./controller";
-jest.mock("../../editor", () => ({
- applyCodeMirrorSearchQuery: jest.fn(),
- setActiveSearchMarkCodeMirrorRange: jest.fn(),
- unsetActiveSearchMarkCodeMirrorRange: jest.fn(),
+vi.mock("../../editor", () => ({
+ applyCodeMirrorSearchQuery: vi.fn(),
+ setActiveSearchMarkCodeMirrorRange: vi.fn(),
+ unsetActiveSearchMarkCodeMirrorRange: vi.fn(),
}));
describe("message search controller", () => {
beforeEach(() => {
- jest.useFakeTimers();
+ vi.useFakeTimers();
});
afterEach(() => {
- jest.runOnlyPendingTimers();
- jest.useRealTimers();
+ vi.runOnlyPendingTimers();
+ vi.useRealTimers();
});
const commitQuery = (
@@ -27,7 +27,7 @@ describe("message search controller", () => {
query: string,
) => {
controller.setQueryInput(query);
- jest.runAllTimers();
+ vi.runAllTimers();
return controller.getSnapshot().matches;
};
@@ -175,7 +175,7 @@ describe("message search controller", () => {
]);
controller.setQueryInput(" ");
- jest.runAllTimers();
+ vi.runAllTimers();
expect(controller.getSnapshot().queryInput).toBe(" ");
expect(controller.getSnapshot().query).toBe(" ");
@@ -211,8 +211,8 @@ describe("message search controller", () => {
expect(commitQuery(controller, "foo")).toHaveLength(1);
const activeMatchBefore = controller.getSnapshot().activeMatch;
- jest.mocked(applyCodeMirrorSearchQuery).mockClear();
- jest.mocked(setActiveSearchMarkCodeMirrorRange).mockClear();
+ vi.mocked(applyCodeMirrorSearchQuery).mockClear();
+ vi.mocked(setActiveSearchMarkCodeMirrorRange).mockClear();
controller.registerPageMessages("page-1", [
{
@@ -244,8 +244,8 @@ describe("message search controller", () => {
it("does not scroll the active match during streaming updates", () => {
const controller = createMessageSearchController(["page-1"]);
const editorRef = { current: null };
- const pageScrollIntoView = jest.fn();
- const rowScrollIntoView = jest.fn();
+ const pageScrollIntoView = vi.fn();
+ const rowScrollIntoView = vi.fn();
controller.registerPageTarget("page-1", {
pageRef: {
@@ -283,8 +283,8 @@ describe("message search controller", () => {
pageScrollIntoView.mockClear();
rowScrollIntoView.mockClear();
- jest.mocked(applyCodeMirrorSearchQuery).mockClear();
- jest.mocked(setActiveSearchMarkCodeMirrorRange).mockClear();
+ vi.mocked(applyCodeMirrorSearchQuery).mockClear();
+ vi.mocked(setActiveSearchMarkCodeMirrorRange).mockClear();
controller.registerPageMessages("page-1", [
{
diff --git a/web/src/components/nav/sidebar-notifications.clienttest.tsx b/web/src/components/nav/sidebar-notifications.clienttest.tsx
index 01325f994f..ab51ba693e 100644
--- a/web/src/components/nav/sidebar-notifications.clienttest.tsx
+++ b/web/src/components/nav/sidebar-notifications.clienttest.tsx
@@ -1,9 +1,9 @@
import { render, screen } from "@testing-library/react";
import { SidebarNotifications } from "./sidebar-notifications";
-jest.mock("../useLocalStorage", () => ({
+vi.mock("../useLocalStorage", () => ({
__esModule: true,
- default: () => [[], jest.fn()],
+ default: () => [[], vi.fn()],
}));
describe("SidebarNotifications", () => {
diff --git a/web/src/components/trace2/components/TraceLogView/log-view-flattening.clienttest.ts b/web/src/components/trace2/components/TraceLogView/log-view-flattening.clienttest.ts
index 3c2ff5cfe4..86297eec35 100644
--- a/web/src/components/trace2/components/TraceLogView/log-view-flattening.clienttest.ts
+++ b/web/src/components/trace2/components/TraceLogView/log-view-flattening.clienttest.ts
@@ -1,8 +1,5 @@
-/**
- * Tests for log-view-flattening.ts
- *
- * @jest-environment jsdom
- */
+// @vitest-environment jsdom
+// Tests for log-view-flattening.ts
import {
flattenChronological,
diff --git a/web/src/components/trace2/components/TraceTimeline/timeline-calculations.clienttest.ts b/web/src/components/trace2/components/TraceTimeline/timeline-calculations.clienttest.ts
index f7b3e47584..92f16cfca2 100644
--- a/web/src/components/trace2/components/TraceTimeline/timeline-calculations.clienttest.ts
+++ b/web/src/components/trace2/components/TraceTimeline/timeline-calculations.clienttest.ts
@@ -1,6 +1,4 @@
-/**
- * @jest-environment jsdom
- */
+// @vitest-environment jsdom
import {
calculateTimelineOffset,
diff --git a/web/src/components/ui/AdvancedJsonViewer/utils/treeNavigation.clienttest.ts b/web/src/components/ui/AdvancedJsonViewer/utils/treeNavigation.clienttest.ts
index d31058de22..ccf24860de 100644
--- a/web/src/components/ui/AdvancedJsonViewer/utils/treeNavigation.clienttest.ts
+++ b/web/src/components/ui/AdvancedJsonViewer/utils/treeNavigation.clienttest.ts
@@ -1,6 +1,4 @@
-/**
- * @jest-environment jsdom
- */
+// @vitest-environment jsdom
import { buildTreeFromJSON } from "./treeStructure";
import {
@@ -368,7 +366,7 @@ describe("isNodeVisible - Integration Tests", () => {
});
describe("getNodeByIndex after expansion changes", () => {
- it("CRITICAL: should return valid nodes for ALL indexes after collapse", () => {
+ it("CRITICAL: should return valid nodes for ALL indexes after collapse", async () => {
// This test catches the bug where getNodeByIndex returns null for valid indexes
const data = {
items: [
@@ -399,7 +397,7 @@ describe("getNodeByIndex after expansion changes", () => {
expect(item1Node).toBeDefined();
// Import toggleNodeExpansion
- const { toggleNodeExpansion } = require("./treeExpansion");
+ const { toggleNodeExpansion } = await import("./treeExpansion");
toggleNodeExpansion(tree, item1Node!.id);
// Get new row count after collapse
@@ -419,7 +417,7 @@ describe("getNodeByIndex after expansion changes", () => {
expect(failedIndexes.length).toBe(0);
});
- it("CRITICAL: should handle multiple sequential collapses correctly", () => {
+ it("CRITICAL: should handle multiple sequential collapses correctly", async () => {
const data = [
{ type: "A", items: [1, 2, 3] },
{ type: "B", items: [4, 5, 6] },
@@ -431,7 +429,7 @@ describe("getNodeByIndex after expansion changes", () => {
initialExpansion: true,
});
- const { toggleNodeExpansion } = require("./treeExpansion");
+ const { toggleNodeExpansion } = await import("./treeExpansion");
// Collapse root.0
toggleNodeExpansion(tree, "root.0");
@@ -473,7 +471,7 @@ describe("getNodeByIndex after expansion changes", () => {
expect(failedIndexes).toEqual([]);
});
- it("CRITICAL: should handle expand after collapse correctly", () => {
+ it("CRITICAL: should handle expand after collapse correctly", async () => {
const data = { a: [1, 2, 3], b: [4, 5, 6] };
const tree = buildTreeFromJSON(data, {
@@ -481,7 +479,7 @@ describe("getNodeByIndex after expansion changes", () => {
initialExpansion: true,
});
- const { toggleNodeExpansion } = require("./treeExpansion");
+ const { toggleNodeExpansion } = await import("./treeExpansion");
// Collapse a
toggleNodeExpansion(tree, "root.a");
diff --git a/web/src/features/experiments/hooks/useExperimentResultsState.clienttest.tsx b/web/src/features/experiments/hooks/useExperimentResultsState.clienttest.tsx
index 8432905037..474d3e9fca 100644
--- a/web/src/features/experiments/hooks/useExperimentResultsState.clienttest.tsx
+++ b/web/src/features/experiments/hooks/useExperimentResultsState.clienttest.tsx
@@ -3,7 +3,7 @@ import { useExperimentResultsState } from "./useExperimentResultsState";
const queryParamStore = new Map<string, unknown>();
-jest.mock("use-query-params", () => {
+vi.mock("use-query-params", () => {
const React = require("react");
return {
diff --git a/web/src/features/filters/savedViewImplicitEnvironmentRegression.clienttest.tsx b/web/src/features/filters/savedViewImplicitEnvironmentRegression.clienttest.tsx
index 98a29e9856..87a22738f1 100644
--- a/web/src/features/filters/savedViewImplicitEnvironmentRegression.clienttest.tsx
+++ b/web/src/features/filters/savedViewImplicitEnvironmentRegression.clienttest.tsx
@@ -12,10 +12,10 @@ import { DEFAULT_SIDEBAR_HIDDEN_ENVIRONMENTS } from "./constants/internal-enviro
import type { FilterConfig } from "./lib/filter-config";
import { useTableViewManager } from "../../components/table/table-view-presets/hooks/useTableViewManager";
-const mockUseRouter = jest.fn();
-const mockCapture = jest.fn();
-const mockGetDefaultUseQuery = jest.fn();
-const mockGetByIdUseQuery = jest.fn();
+const mockUseRouter = vi.fn();
+const mockCapture = vi.fn();
+const mockGetDefaultUseQuery = vi.fn();
+const mockGetByIdUseQuery = vi.fn();
const queryParamStore = new Map<string, unknown>();
@@ -32,24 +32,24 @@ const hasDefaultValue = (value: unknown): value is { __default: unknown } =>
const isMockViewQueryResult = (value: unknown): value is MockViewQueryResult =>
typeof value === "object" && value !== null;
-jest.mock("next/router", () => ({
+vi.mock("next/router", () => ({
useRouter: () => mockUseRouter(),
}));
-jest.mock("posthog-js/react", () => ({
+vi.mock("posthog-js/react", () => ({
usePostHog: () => ({
capture: mockCapture,
}),
}));
-jest.mock(
+vi.mock(
"../../components/table/table-view-presets/components/data-table-view-presets-drawer",
() => ({
isSystemPresetId: () => false,
}),
);
-jest.mock("../../utils/api", () => ({
+vi.mock("../../utils/api", () => ({
api: {
TableViewPresets: {
getDefault: {
@@ -76,9 +76,9 @@ jest.mock("../../utils/api", () => ({
},
}));
-jest.mock("use-query-params", () => {
+vi.mock("use-query-params", async () => {
const React = require("react");
- const actual = jest.requireActual("use-query-params");
+ const actual = await vi.importActual("use-query-params");
const StringParam = { __type: "string" } as const;
const withDefault = (param: unknown, defaultValue: unknown) => ({
@@ -259,7 +259,7 @@ describe("Saved view restore with implicit environment defaults", () => {
let savedViewFilters: FilterState;
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
sessionStorage.clear();
queryParamStore.clear();
savedViewFilters = OLD_SAVED_VIEW_FILTERS;
diff --git a/web/src/features/filters/sidebarFilterSessionPersistence.clienttest.tsx b/web/src/features/filters/sidebarFilterSessionPersistence.clienttest.tsx
index a439dc7bc4..ca2befabfa 100644
--- a/web/src/features/filters/sidebarFilterSessionPersistence.clienttest.tsx
+++ b/web/src/features/filters/sidebarFilterSessionPersistence.clienttest.tsx
@@ -7,9 +7,9 @@ import { buildSidebarFilterQueryStorageKey } from "./lib/persistedSidebarFilterQ
const queryParamStore = new Map<string, unknown>();
-jest.mock("use-query-params", () => {
+vi.mock("use-query-params", async () => {
const React = require("react");
- const actual = jest.requireActual("use-query-params");
+ const actual = await vi.importActual("use-query-params");
return {
...actual,
diff --git a/web/src/features/orderBy/hooks/useOrderByState.clienttest.tsx b/web/src/features/orderBy/hooks/useOrderByState.clienttest.tsx
index 97c5d48c1e..df171b4d69 100644
--- a/web/src/features/orderBy/hooks/useOrderByState.clienttest.tsx
+++ b/web/src/features/orderBy/hooks/useOrderByState.clienttest.tsx
@@ -1,3 +1,4 @@
+import type { Mock } from "vitest";
import { cleanup, render } from "@testing-library/react";
import { TestRouter } from "@/src/__tests__/fixtures/TestRouter";
@@ -9,8 +10,8 @@ import { QueryParamProvider } from "use-query-params";
afterEach(cleanup);
-jest.mock("next/router", () => ({
- useRouter: jest.fn(),
+vi.mock("next/router", () => ({
+ useRouter: vi.fn(),
}));
// The test for the useOrderByState hook
@@ -26,7 +27,7 @@ describe.skip("useOrderByState hook", () => {
});
beforeEach(() => {
- jest.resetAllMocks();
+ vi.resetAllMocks();
locationMock = new LocationMock("https://langfuse.com");
testRouter = new TestRouter(locationMock);
Object.defineProperty(window, "location", {
@@ -35,7 +36,7 @@ describe.skip("useOrderByState hook", () => {
configurable: true,
});
- (useRouter as jest.Mock).mockReturnValue(testRouter);
+ (useRouter as Mock).mockReturnValue(testRouter);
});
test("orderBy takes the default value if no url param is given", () => {
diff --git a/web/src/features/score-analytics/hooks/useScoreAnalyticsQuery.clienttest.tsx b/web/src/features/score-analytics/hooks/useScoreAnalyticsQuery.clienttest.tsx
index 92f5e3ea26..8fd6db6b43 100644
--- a/web/src/features/score-analytics/hooks/useScoreAnalyticsQuery.clienttest.tsx
+++ b/web/src/features/score-analytics/hooks/useScoreAnalyticsQuery.clienttest.tsx
@@ -1,19 +1,20 @@
+import type { Mock } from "vitest";
import { render, screen } from "@testing-library/react";
import { api } from "../../../utils/api";
import { useScoreAnalyticsQuery } from "./useScoreAnalyticsQuery";
-jest.mock("../../../utils/api", () => ({
+vi.mock("../../../utils/api", () => ({
api: {
scoreAnalytics: {
getScoreComparisonAnalytics: {
- useQuery: jest.fn(),
+ useQuery: vi.fn(),
},
},
},
}));
const mockedUseQuery = api.scoreAnalytics.getScoreComparisonAnalytics
- .useQuery as jest.Mock;
+ .useQuery as Mock;
function ScoreAnalyticsProbe({
includeScore2 = false,
diff --git a/web/src/hooks/useCopyToClipboard.clienttest.ts b/web/src/hooks/useCopyToClipboard.clienttest.ts
index 2b0cde40d1..1226553bf1 100644
--- a/web/src/hooks/useCopyToClipboard.clienttest.ts
+++ b/web/src/hooks/useCopyToClipboard.clienttest.ts
@@ -5,18 +5,18 @@ describe("useCopyToClipboard", () => {
const originalClipboard = navigator.clipboard;
beforeEach(() => {
- jest.useFakeTimers();
+ vi.useFakeTimers();
Object.defineProperty(navigator, "clipboard", {
configurable: true,
value: {
- writeText: jest.fn().mockResolvedValue(undefined),
+ writeText: vi.fn().mockResolvedValue(undefined),
},
});
});
afterEach(() => {
- jest.runOnlyPendingTimers();
- jest.useRealTimers();
+ vi.runOnlyPendingTimers();
+ vi.useRealTimers();
Object.defineProperty(navigator, "clipboard", {
configurable: true,
value: originalClipboard,
@@ -37,13 +37,13 @@ describe("useCopyToClipboard", () => {
expect(result.current.isCopied).toBe(true);
act(() => {
- jest.advanceTimersByTime(499);
+ vi.advanceTimersByTime(499);
});
expect(result.current.isCopied).toBe(true);
act(() => {
- jest.advanceTimersByTime(1);
+ vi.advanceTimersByTime(1);
});
expect(result.current.isCopied).toBe(false);
@@ -74,13 +74,13 @@ describe("useCopyToClipboard", () => {
expect(result.current.isCopied).toBe(true);
act(() => {
- jest.advanceTimersByTime(499);
+ vi.advanceTimersByTime(499);
});
expect(result.current.isCopied).toBe(true);
act(() => {
- jest.advanceTimersByTime(1);
+ vi.advanceTimersByTime(1);
});
expect(result.current.isCopied).toBe(false);
diff --git a/web/src/utils/chatml/jumptoplayground.clienttest.ts b/web/src/utils/chatml/jumptoplayground.clienttest.ts
index 84a9759947..1a59c4357e 100644
--- a/web/src/utils/chatml/jumptoplayground.clienttest.ts
+++ b/web/src/utils/chatml/jumptoplayground.clienttest.ts
@@ -1,7 +1,7 @@
// Mock the problematic @langfuse/shared import before importing our functions
-jest.mock("@langfuse/shared", () => {
- const actual = jest.requireActual("@langfuse/shared");
- const { z } = require("zod");
+vi.mock("@langfuse/shared", async () => {
+ const actual = await vi.importActual("@langfuse/shared");
+ const { z } = (await vi.importActual("zod")) as any;
const OpenAITextContentPart = z.object({
type: z.literal("text"),
diff --git a/web/tsconfig.json b/web/tsconfig.json
index df17557e73..6df7e70241 100644
--- a/web/tsconfig.json
+++ b/web/tsconfig.json
@@ -14,7 +14,8 @@
"./*"
]
},
- "strictNullChecks": true
+ "strictNullChecks": true,
+ "types": ["node", "vitest/globals", "@testing-library/jest-dom"]
},
"exclude": [
"node_modules",
diff --git a/web/vitest.config.mts b/web/vitest.config.mts
new file mode 100644
index 0000000000..cd2786b1b4
--- /dev/null
+++ b/web/vitest.config.mts
@@ -0,0 +1,51 @@
+import { defineConfig } from "vitest/config";
+import react from "@vitejs/plugin-react";
+import tsconfigPaths from "vite-tsconfig-paths";
+
+export default defineConfig({
+ plugins: [tsconfigPaths(), react()],
+ test: {
+ globals: true,
+ testTimeout: 30_000,
+ server: {
+ deps: {
+ inline: [/@langfuse\//],
+ },
+ },
+ projects: [
+ {
+ extends: true,
+ test: {
+ name: "client",
+ include: ["src/**/*.clienttest.{ts,tsx}"],
+ environment: "jsdom",
+ setupFiles: ["@testing-library/jest-dom/vitest"],
+ },
+ },
+ {
+ extends: true,
+ test: {
+ name: "server",
+ include: ["src/**/server/**/*.servertest.{ts,tsx}"],
+ exclude: ["src/__e2e__/**"],
+ environment: "node",
+ setupFiles: ["./src/__tests__/after-teardown.ts"],
+ globalSetup: ["./src/__tests__/vitest-global-teardown.ts"],
+ maxWorkers: 1,
+ },
+ },
+ {
+ extends: true,
+ test: {
+ name: "e2e-server",
+ include: ["src/**/*.servertest.{ts,tsx}"],
+ exclude: ["src/__tests__/**"],
+ environment: "node",
+ setupFiles: ["./src/__tests__/after-teardown.ts"],
+ globalSetup: ["./src/__tests__/vitest-global-teardown.ts"],
+ maxWorkers: 1,
+ },
+ },
+ ],
+ },
+});