Files
jackwener__opencli/vitest.config.ts
AstroHan 3a7a5e135b fix(grok): preserve conversation across repeated ask calls (#332)
* fix(grok): preserve conversation across repeated ask calls (#330)

The adapter unconditionally navigated to grok.com/ on every invocation,
destroying the existing conversation URL even when --new was not passed.
Since the browser daemon already reuses the same Chrome tab, skipping
navigation lets the tab stay on the current chat thread.

- Only navigate to grok.com/ when --new is true or tab is not on grok.com
- Add tryStartFreshChat to the default path's --new branch (was dead code)
- Add isOnGrok helper with hostname-based domain matching
- Add unit tests for isOnGrok

* test(grok): add adapter to vitest project config

---------

Co-authored-by: jackwener <jakevingoo@gmail.com>
2026-03-24 19:19:40 +08:00

46 lines
1.0 KiB
TypeScript

import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
projects: [
{
test: {
name: 'unit',
include: ['src/**/*.test.ts'],
exclude: ['src/clis/**/*.test.ts'],
// Run unit tests before e2e tests to avoid project-level contention in CI.
sequence: {
groupOrder: 0,
},
},
},
{
test: {
name: 'adapter',
include: [
'src/clis/zhihu/**/*.test.ts',
'src/clis/twitter/**/*.test.ts',
'src/clis/reddit/**/*.test.ts',
'src/clis/bilibili/**/*.test.ts',
'src/clis/linkedin/**/*.test.ts',
'src/clis/grok/**/*.test.ts',
],
sequence: {
groupOrder: 1,
},
},
},
{
test: {
name: 'e2e',
include: ['tests/**/*.test.ts'],
maxWorkers: 2,
sequence: {
groupOrder: 2,
},
},
},
],
},
});