node:http server that serves the console build and a /api/* the console accepts: its own login and session (clusterInitialized, the servers as nodes, hub flag, Dashboard and Logs only), node=<id> forwarded with that server's token, no node or cluster merged (stats, top lists, query logs, apps), every write refused with 403, a short response cache, and an unreachable server reported as hubWarnings. The dev mock takes --port and --scale so two of them differ. Vitest skips .claude/ worktrees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { configDefaults, defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
/* The build injects this from package.json (see vite.config.ts). The tests run
|
|
through a different config, so it has to be injected here as well or anything
|
|
that reports the console's own version throws. */
|
|
const version = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: { alias: { '@': new URL('./src', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1') } },
|
|
define: { __CONSOLE_VERSION__: JSON.stringify(version) },
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
/* jsdom with ReUI's popovers is slow on a shared CI runner: a test that opens three
|
|
menus in a row took more than the default 5 s there while taking about one here. */
|
|
testTimeout: 20000,
|
|
hookTimeout: 20000,
|
|
/* Git worktrees of other sessions live under `.claude/`: their copies of the
|
|
tests are not this checkout's. */
|
|
exclude: [...configDefaults.exclude, '.claude/**'],
|
|
},
|
|
})
|