Files
copilotkit__copilotkit/packages/angular/vitest.config.mts
Claude 5508b163d3 feat(angular): add Threads API (useThreads parity)
Port the React useThreads hook to an Angular signal-based service.
injectThreadStore() returns a ThreadStoreSignal exposing reactive
signals (threads, isLoading, error, hasMoreThreads,
isFetchingMoreThreads) plus mutation methods (renameThread,
archiveThread, deleteThread, fetchMoreThreads). Wires the same
ɵcreateThreadStore from @copilotkit/core that React uses, registers
with CopilotKitCore so threads stay scoped per agentId, and waits for
runtimeConnectionStatus=Connected before dispatching context to avoid
a redundant fetch.

Behavioral tests mirror the React suite (initial fetch + WebSocket
subscribe, fetch failure surfaces in error, runtimeUrl=undefined
short-circuits, realtime metadata events update local state, mutation
contracts, pagination, store registration, pre-Connected isLoading
synthesis, agentId signal switching).

Adds phoenix + @types/phoenix as devDependencies and inlines
@copilotkit/* in vitest server.deps so vi.mock("phoenix") intercepts
the bundled core imports (mirrors react-core's vitest config).

https://claude.ai/code/session_01B1zJ4kMRgLuN1r5T3iiGbZ
2026-05-05 03:42:53 +00:00

55 lines
1.5 KiB
TypeScript

/// <reference types="vitest" />
import { defineConfig } from "vite";
import angular from "@analogjs/vite-plugin-angular";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const __dirname = dirname(fileURLToPath(import.meta.url));
const r = (...p: string[]) => resolve(__dirname, ...p);
export default defineConfig(({ mode }) => ({
plugins: [angular()],
resolve: {
dedupe: [
"@angular/core",
"@angular/common",
"@angular/platform-browser",
"@angular/platform-browser-dynamic",
"@angular/compiler",
"@angular/core/testing",
],
},
test: {
globals: true,
environment: "jsdom",
setupFiles: [r("src/test-setup.ts")], // Use absolute path
include: ["src/**/*.{spec,test}.{ts,tsx}"],
pool: "threads",
poolOptions: { threads: { singleThread: true } },
reporters: [["default", { summary: false }]],
silent: true,
// Inline @copilotkit/* so vi.mock("phoenix") intercepts the bundled
// imports inside @copilotkit/core's dist (mirrors react-core's config).
server: {
deps: {
inline: [/^@copilotkit/],
},
},
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
exclude: [
"node_modules/",
"dist/",
"*.config.*",
"src/test-setup.ts",
"src/index.ts",
"src/public-api.ts",
],
},
},
define: {
"import.meta.vitest": mode !== "production",
},
}));