Files
jackwener__opencli/vitest.config.ts
jakevin 555626f409 feat: replace tabId with targetId as cross-layer page identity (#899)
Use Chrome CDP targetId (UUID) as the canonical page identity across
all layers (extension → daemon → CLI), demoting tabId to an
extension-internal routing detail.

- Add extension/src/identity.ts: bidirectional targetId ↔ tabId mapping
  with lazy refresh via chrome.debugger.getTargets()
- Update protocol: Command.page and Result.page carry targetId
- Update background.ts: resolveCommandTabId() and pageScopedResult()
  helpers; all page-scoped handlers return targetId
- Add sendCommandFull() to daemon-client for responses with page identity
- Update Page class: _page stores targetId, goto/selectTab extract it
- Update record.ts: injectedPages tracks by targetId
- Add extension tests to vitest config and CI test scripts
2026-04-09 12:26:32 +08:00

58 lines
1.5 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: ['clis/**/*.test.ts'],
sequence: { groupOrder: 0 },
},
},
{
test: {
name: 'extension',
include: ['extension/src/**/*.test.ts'],
sequence: { groupOrder: 0 },
},
},
{
test: {
name: 'adapter',
include: ['clis/**/*.test.ts'],
sequence: { groupOrder: 1 },
},
},
{
test: {
name: 'e2e',
include: [
'tests/e2e/browser-public.test.ts',
'tests/e2e/band-auth.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 },
},
},
],
},
});