learning_ai_common_plat/dashboards/admin-web/vitest.config.ts
saravanakumardb1 b4e450d68a feat(admin-web): add @bytelyst/command-palette (Cmd-K) to dashboard (UX-3)
- Mount CommandRegistryProvider in (dashboard)/layout.tsx and a CommandMenu
  that binds the global Cmd-K / Ctrl-K hotkey (useCommandPalette) and lazy-loads
  the dialog via next/dynamic (own chunk; dynamic target is a local re-export
  command-palette-dialog.tsx because the package declares only an `import`
  export condition).
- src/lib/admin-commands.ts: pure builder for 21 navigate-mode commands across
  the major surfaces (Users, Subscriptions, Licenses, Billing, Usage,
  Broadcasts, Flags, Experiments, Audit, Ops, …) plus theme-toggle and sign-out
  actions wired to the existing auth/theme contexts; onNavigate -> router.push.
- @bytelyst/command-palette added as workspace:* (importer-only lockfile change;
  --frozen-lockfile clean).
- vitest.config: inline command-palette + dedupe react for the interaction test.

Tests: pure command-set assertions + a happy-dom Cmd-K/Ctrl-K interaction test
(react-dom/client + act, no new deps).

Verify: typecheck+lint+build green (123 routes); vitest 19 files / 165 tests
(+6); format:check no new failures; e2e 11 passed / 80 failed (unchanged vs
UX-1 baseline — environmental, no backend).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-05-29 13:58:49 -07:00

49 lines
1.3 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import path from 'path';
export default defineConfig({
test: {
environment: 'node',
globals: true,
exclude: ['e2e/**', 'node_modules/**'],
// Inline the workspace SVG-chart packages so Vitest transforms them and
// resolves their `react` import through the dedupe below. Without this the
// chart dist (linked from a sibling repo's pnpm store) loads a second
// physical React copy and `renderToStaticMarkup` throws "Invalid hook call".
// The real Next/webpack build already dedupes these to admin-web's React.
server: {
deps: {
inline: [/@bytelyst\/(charts|data-viz|command-palette)/],
},
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/**',
'.next/**',
'coverage/**',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.config.*',
'**/e2e/**',
],
thresholds: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
// Force a single physical React/React-DOM copy for SSR chart render tests.
dedupe: ['react', 'react-dom'],
},
});