diff --git a/bun.lock b/bun.lock index b46c485..f749bec 100644 --- a/bun.lock +++ b/bun.lock @@ -249,7 +249,7 @@ }, "devDependencies": { "@cyrus/typescript": "workspace:*", - "@types/bun": "catalog:", + "vitest": "catalog:", }, }, "shared/constants": { @@ -259,6 +259,7 @@ "@cyrus/typescript": "workspace:*", "@types/bun": "catalog:", "typescript": "catalog:", + "vitest": "catalog:", }, }, "shared/database": { @@ -280,6 +281,7 @@ "@tursodatabase/database": "^0.6.1", "@types/bun": "catalog:", "typescript": "catalog:", + "vitest": "catalog:", }, }, "shared/errors": { @@ -360,6 +362,7 @@ "devDependencies": { "@cyrus/typescript": "workspace:*", "@types/bun": "catalog:", + "vitest": "catalog:", }, }, "shared/styles": { @@ -381,6 +384,7 @@ "@cyrus/typescript": "workspace:*", "@types/bun": "catalog:", "typescript": "catalog:", + "vitest": "catalog:", }, }, "tests/e2e": { diff --git a/shared/connections/package.json b/shared/connections/package.json index e3ac4ed..97ddcba 100644 --- a/shared/connections/package.json +++ b/shared/connections/package.json @@ -8,7 +8,7 @@ "./rtc/worker": "./src/rtc/worker/index.ts" }, "scripts": { - "test:unit": "bun test" + "test:unit": "vitest run" }, "dependencies": { "@cyrus/errors": "workspace:*", @@ -24,6 +24,6 @@ }, "devDependencies": { "@cyrus/typescript": "workspace:*", - "@types/bun": "catalog:" + "vitest": "catalog:" } } diff --git a/shared/connections/src/rtc/peer.test.ts b/shared/connections/src/rtc/peer.test.ts index 8c7298f..46a5607 100644 --- a/shared/connections/src/rtc/peer.test.ts +++ b/shared/connections/src/rtc/peer.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, test } from "bun:test"; import type { ServerEvent } from "@cyrus/schemas/signaling"; +import { describe, expect, test } from "vitest"; import { createSignalingEvents } from "./peer"; async function* eventStream(events: ServerEvent[]) { diff --git a/shared/connections/src/rtc/session.test.ts b/shared/connections/src/rtc/session.test.ts index bcfd106..abb131e 100644 --- a/shared/connections/src/rtc/session.test.ts +++ b/shared/connections/src/rtc/session.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { normalizeHost } from "./session"; describe("normalizeHost", () => { diff --git a/shared/connections/src/rtc/webrtc-nightly.test.ts b/shared/connections/src/rtc/webrtc-nightly.test.ts index 1619d30..c1d8b4b 100644 --- a/shared/connections/src/rtc/webrtc-nightly.test.ts +++ b/shared/connections/src/rtc/webrtc-nightly.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, test } from "bun:test"; import { RTCPeerConnection as NodeRTCPeerConnection } from "node-datachannel/polyfill"; +import { describe, expect, test } from "vitest"; const nightlyDescribe = process.env.CYRUS_NIGHTLY_WEBRTC === "1" ? describe : describe.skip; diff --git a/shared/connections/tsconfig.json b/shared/connections/tsconfig.json index 542570d..314522d 100644 --- a/shared/connections/tsconfig.json +++ b/shared/connections/tsconfig.json @@ -6,6 +6,6 @@ "types": [], "strictNullChecks": true }, - "include": ["src/**/*.ts", "src/**/*.tsx"], + "include": ["src/**/*.ts", "src/**/*.tsx", "vitest.config.ts"], "exclude": ["node_modules"] } diff --git a/shared/connections/vitest.config.ts b/shared/connections/vitest.config.ts new file mode 100644 index 0000000..cfbd4c3 --- /dev/null +++ b/shared/connections/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + include: ["src/**/*.test.ts"], + }, +}); diff --git a/shared/constants/package.json b/shared/constants/package.json index 7a04118..70c714c 100644 --- a/shared/constants/package.json +++ b/shared/constants/package.json @@ -8,11 +8,12 @@ }, "scripts": { "check:types": "tsc --noEmit", - "test:unit": "bun test" + "test:unit": "vitest run" }, "devDependencies": { "@cyrus/typescript": "workspace:*", "@types/bun": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "vitest": "catalog:" } } diff --git a/shared/constants/src/operation-keys.test.ts b/shared/constants/src/operation-keys.test.ts index 01e6067..5340587 100644 --- a/shared/constants/src/operation-keys.test.ts +++ b/shared/constants/src/operation-keys.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { AUTH_OPERATION_KEYS, RTC_OPERATION_KEYS, diff --git a/shared/constants/tsconfig.json b/shared/constants/tsconfig.json index 449b871..1d89f84 100644 --- a/shared/constants/tsconfig.json +++ b/shared/constants/tsconfig.json @@ -4,6 +4,6 @@ "types": ["bun"], "strictNullChecks": true }, - "include": ["src/**/*.ts"], + "include": ["src/**/*.ts", "vitest.config.ts"], "exclude": ["node_modules"] } diff --git a/shared/constants/vitest.config.ts b/shared/constants/vitest.config.ts new file mode 100644 index 0000000..cfbd4c3 --- /dev/null +++ b/shared/constants/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + include: ["src/**/*.test.ts"], + }, +}); diff --git a/shared/database/__tests__/integration/repositories.test.ts b/shared/database/__tests__/integration/repositories.test.ts index 0410d3d..d600dc6 100644 --- a/shared/database/__tests__/integration/repositories.test.ts +++ b/shared/database/__tests__/integration/repositories.test.ts @@ -1,4 +1,3 @@ -import { describe, expect, test } from "bun:test"; import { appendConversation, getConversations, @@ -16,6 +15,7 @@ import { renameThread, threadNameFromPrompt, } from "@cyrus/database/repositories/threads"; +import { describe, expect, test } from "vitest"; import { withTempDatabase } from "../helpers/turso"; describe("database repositories", () => { diff --git a/shared/database/package.json b/shared/database/package.json index b694a0b..3734600 100644 --- a/shared/database/package.json +++ b/shared/database/package.json @@ -10,7 +10,8 @@ "check:types": "tsc --noEmit", "db:push": "dotenvx run -- drizzle-kit push", "db:studio": "dotenvx run -- drizzle-kit studio", - "test:integration": "bun test __tests__/integration" + "test:unit": "vitest run src", + "test:integration": "vitest run __tests__/integration" }, "dependencies": { "@cyrus/errors": "workspace:*", @@ -27,6 +28,7 @@ "@cyrus/typescript": "workspace:*", "@tursodatabase/database": "^0.6.1", "@types/bun": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "vitest": "catalog:" } } diff --git a/shared/database/src/utils/repo.test.ts b/shared/database/src/utils/repo.test.ts index 49e85a6..0848eb1 100644 --- a/shared/database/src/utils/repo.test.ts +++ b/shared/database/src/utils/repo.test.ts @@ -1,4 +1,3 @@ -import { describe, expect, test } from "bun:test"; import { notFound, persistFailed, @@ -7,6 +6,7 @@ import { RepositoryPersistFailedError, } from "@cyrus/errors/repository"; import { DrizzleQueryError } from "drizzle-orm"; +import { describe, expect, test } from "vitest"; import { z } from "zod"; import { fromDrizzleFailure, diff --git a/shared/database/tsconfig.json b/shared/database/tsconfig.json index 3d4b31e..ca2dc6a 100644 --- a/shared/database/tsconfig.json +++ b/shared/database/tsconfig.json @@ -6,6 +6,11 @@ "types": ["bun"], "strictNullChecks": true }, - "include": ["src/**/*.ts", "src/**/*.tsx", "__tests__/**/*.ts"], + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "__tests__/**/*.ts", + "vitest.config.ts" + ], "exclude": ["node_modules"] } diff --git a/shared/database/vitest.config.ts b/shared/database/vitest.config.ts new file mode 100644 index 0000000..6e8ef85 --- /dev/null +++ b/shared/database/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + include: ["src/**/*.test.ts", "__tests__/integration/**/*.test.ts"], + }, +}); diff --git a/shared/schemas/package.json b/shared/schemas/package.json index 5651cad..5170690 100644 --- a/shared/schemas/package.json +++ b/shared/schemas/package.json @@ -10,13 +10,14 @@ "./signaling": "./src/signaling.ts" }, "scripts": { - "test:unit": "bun test" + "test:unit": "vitest run" }, "dependencies": { "zod": "catalog:" }, "devDependencies": { "@cyrus/typescript": "workspace:*", - "@types/bun": "catalog:" + "@types/bun": "catalog:", + "vitest": "catalog:" } } diff --git a/shared/schemas/src/rtc/agents.test.ts b/shared/schemas/src/rtc/agents.test.ts index fda9cd6..7b11978 100644 --- a/shared/schemas/src/rtc/agents.test.ts +++ b/shared/schemas/src/rtc/agents.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { ListAgentsOutputSchema } from "./agents"; describe("ListAgentsOutputSchema", () => { diff --git a/shared/schemas/src/rtc/chat.test.ts b/shared/schemas/src/rtc/chat.test.ts index e0edc1c..9ffa3b4 100644 --- a/shared/schemas/src/rtc/chat.test.ts +++ b/shared/schemas/src/rtc/chat.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { AgentEventSchema, ChatChunkSchema, diff --git a/shared/schemas/src/rtc/threads.test.ts b/shared/schemas/src/rtc/threads.test.ts index 0aab2b7..f37e1bf 100644 --- a/shared/schemas/src/rtc/threads.test.ts +++ b/shared/schemas/src/rtc/threads.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { ConversationEntrySchema, RenameThreadInputSchema, diff --git a/shared/schemas/src/signaling.test.ts b/shared/schemas/src/signaling.test.ts index 9b2dee1..25ca942 100644 --- a/shared/schemas/src/signaling.test.ts +++ b/shared/schemas/src/signaling.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { DeviceInfoSchema, DeviceRoleSchema, diff --git a/shared/schemas/tsconfig.json b/shared/schemas/tsconfig.json index 4716ed9..a38e411 100644 --- a/shared/schemas/tsconfig.json +++ b/shared/schemas/tsconfig.json @@ -6,6 +6,6 @@ "types": ["bun"], "strictNullChecks": true }, - "include": ["src/**/*.ts", "src/**/*.tsx"], + "include": ["src/**/*.ts", "src/**/*.tsx", "vitest.config.ts"], "exclude": ["node_modules"] } diff --git a/shared/schemas/vitest.config.ts b/shared/schemas/vitest.config.ts new file mode 100644 index 0000000..cfbd4c3 --- /dev/null +++ b/shared/schemas/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + include: ["src/**/*.test.ts"], + }, +}); diff --git a/shared/utils/package.json b/shared/utils/package.json index 770d75d..a17e09d 100644 --- a/shared/utils/package.json +++ b/shared/utils/package.json @@ -7,7 +7,7 @@ "./*": "./src/*.ts" }, "scripts": { - "test:unit": "bun test" + "test:unit": "vitest run" }, "dependencies": { "@cyrus/errors": "workspace:*", @@ -20,6 +20,7 @@ "devDependencies": { "@cyrus/typescript": "workspace:*", "@types/bun": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "vitest": "catalog:" } } diff --git a/shared/utils/src/conversations/fold.test.ts b/shared/utils/src/conversations/fold.test.ts index 1a092aa..14853d5 100644 --- a/shared/utils/src/conversations/fold.test.ts +++ b/shared/utils/src/conversations/fold.test.ts @@ -1,6 +1,6 @@ -import { describe, expect, test } from "bun:test"; import type { AgentEvent } from "@cyrus/schemas/rtc/chat"; import type { ConversationEntry } from "@cyrus/schemas/rtc/threads"; +import { describe, expect, test } from "vitest"; import { fold } from "./fold"; function entry( diff --git a/shared/utils/src/conversations/thread-feed.test.ts b/shared/utils/src/conversations/thread-feed.test.ts index 53d5b6b..614f85c 100644 --- a/shared/utils/src/conversations/thread-feed.test.ts +++ b/shared/utils/src/conversations/thread-feed.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { deriveFeed } from "./thread-feed"; describe("deriveFeed", () => { diff --git a/shared/utils/src/conversations/turn-waiters.test.ts b/shared/utils/src/conversations/turn-waiters.test.ts index 718d7b2..cef35e6 100644 --- a/shared/utils/src/conversations/turn-waiters.test.ts +++ b/shared/utils/src/conversations/turn-waiters.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, test } from "bun:test"; import { isTurnInterruptedError, turnWaitFailed } from "@cyrus/errors/turn"; +import { describe, expect, test } from "vitest"; import { rejectTurnWaiter, settleTurnWaiter, diff --git a/shared/utils/src/identity.test.ts b/shared/utils/src/identity.test.ts index 9749507..530a825 100644 --- a/shared/utils/src/identity.test.ts +++ b/shared/utils/src/identity.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { generateName, randomId } from "./identity"; const UUID_PATTERN = diff --git a/shared/utils/src/path.test.ts b/shared/utils/src/path.test.ts index 0314412..3f695c6 100644 --- a/shared/utils/src/path.test.ts +++ b/shared/utils/src/path.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { appendBrowsePathSegment, canNavigateUp, diff --git a/shared/utils/src/timer.test.ts b/shared/utils/src/timer.test.ts index 3035fe2..35cb0c5 100644 --- a/shared/utils/src/timer.test.ts +++ b/shared/utils/src/timer.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test"; +import { describe, expect, test } from "vitest"; import { formatElapsedTimer, formatElapsedTimerNow } from "./timer"; describe("timer helpers", () => { diff --git a/shared/utils/tsconfig.json b/shared/utils/tsconfig.json index 4716ed9..a38e411 100644 --- a/shared/utils/tsconfig.json +++ b/shared/utils/tsconfig.json @@ -6,6 +6,6 @@ "types": ["bun"], "strictNullChecks": true }, - "include": ["src/**/*.ts", "src/**/*.tsx"], + "include": ["src/**/*.ts", "src/**/*.tsx", "vitest.config.ts"], "exclude": ["node_modules"] } diff --git a/shared/utils/vitest.config.ts b/shared/utils/vitest.config.ts new file mode 100644 index 0000000..cfbd4c3 --- /dev/null +++ b/shared/utils/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + include: ["src/**/*.test.ts"], + }, +}); diff --git a/vitest.config.ts b/vitest.config.ts index f16d0d4..de9ab8e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,8 +5,13 @@ export default defineConfig({ projects: [ "apps/web/vitest.config.ts", "apps/server/vitest.config.ts", + "shared/connections/vitest.config.ts", + "shared/constants/vitest.config.ts", + "shared/database/vitest.config.ts", "shared/hooks/vitest.config.ts", "shared/providers/vitest.config.ts", + "shared/schemas/vitest.config.ts", + "shared/utils/vitest.config.ts", ], coverage: { provider: "istanbul",