Files
jackwener__opencli/vitest.config.ts
jakevin 0f3021a086 fix: relax extension version check, enable all adapter tests (#520)
* feat: zero onboarding, extension version check, and update notifier

- Fail-fast guard in execution.ts: when daemon is running but extension
  is not connected, immediately surface a setup guide instead of waiting
  for the 30s connect timeout

- Extension version handshake: extension sends `hello` with its version
  on WebSocket connect; daemon stores it and exposes via /status; CLI
  warns on mismatch in both execution path and `opencli doctor`

- `opencli doctor` now shows extension version inline and reports
  version mismatch as an actionable issue

- Non-blocking npm update checker: registers a process exit hook so the
  update notice appears after command output (same pattern as npm/gh/yarn);
  background fetch writes to ~/.opencli/update-check.json for next run

- postinstall: print Browser Bridge setup instructions after shell
  completion install for first-time global install users

Bug fixes caught in review:
- discover.ts: add AbortController timeout to checkDaemonStatus() fetch,
  move clearTimeout after res.json() to cover body streaming
- daemon.ts: clear extensionVersion and reject pending requests in
  ws.on('error') handler, not just ws.on('close')
- update-check.ts: skip update notice when process exits with non-zero
  code; read cache once at module load to avoid double disk I/O;
  guard isNewer() against NaN from pre-release version strings

* fix: relax extension version check to major-only in doctor, remove from hot path

* test: enable all adapter tests via wildcard glob, fix apple-podcasts url field

* fix: clearTimeout in finally block, reset extensionVersion on reconnect, fix e2e regex
2026-03-28 00:08:10 +08:00

50 lines
1.3 KiB
TypeScript

import { defineConfig } from 'vitest/config';
const includeExtendedE2e = process.env.OPENCLI_E2E === '1';
export default defineConfig({
test: {
projects: [
{
test: {
name: 'unit',
include: ['src/**/*.test.ts'],
exclude: ['src/clis/**/*.test.ts'],
sequence: { groupOrder: 0 },
},
},
{
test: {
name: 'adapter',
include: ['src/clis/**/*.test.ts'],
sequence: { groupOrder: 1 },
},
},
{
test: {
name: 'e2e',
include: [
'tests/e2e/browser-public.test.ts',
'tests/e2e/public-commands.test.ts',
'tests/e2e/management.test.ts',
'tests/e2e/output-formats.test.ts',
'tests/e2e/plugin-management.test.ts',
// Extended browser tests (20+ sites) — opt-in only:
// OPENCLI_E2E=1 npx vitest run
...(includeExtendedE2e ? ['tests/e2e/browser-public-extended.test.ts', 'tests/e2e/browser-auth.test.ts'] : []),
],
maxWorkers: 2,
sequence: { groupOrder: 2 },
},
},
{
test: {
name: 'smoke',
include: ['tests/smoke/**/*.test.ts'],
sequence: { groupOrder: 3 },
},
},
],
},
});