Files
jackwener__opencli/vitest.config.ts
jakevin dba93c2739 fix(test): limit default e2e to bilibili/zhihu/v2ex, gate extended browser tests (#423)
Split browser-public.test.ts: core sites (bilibili, zhihu, v2ex) run
by default; all other 20+ site tests moved to browser-public-extended
and gated behind OPENCLI_E2E=1 to prevent AI agents from launching
dozens of browser instances.
2026-03-25 16:13:45 +08:00

54 lines
1.4 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/bilibili/**/*.test.ts',
'src/clis/zhihu/**/*.test.ts',
'src/clis/v2ex/**/*.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 },
},
},
],
},
});