mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-21 23:40:44 -07:00
feat(ci): unleash 16-core speed and suppress zombie tests
This commit is contained in:
@@ -10,6 +10,16 @@ exports[`<BackgroundTaskDisplay /> > highlights the focused state 1`] = `
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<BackgroundTaskDisplay /> > highlights the focused state 2`] = `
|
||||
"┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 1: npm sta.. (PID: 1001) Close (Ctrl+B) | Kill (Ctrl+K) | List │
|
||||
│ (Focused) (Ctrl+L) │
|
||||
│ Starting server... │
|
||||
│ Log: ~/.gemini/tmp/background-processes/background-1001.log │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<BackgroundTaskDisplay /> > keeps exit code status color even when selected 1`] = `
|
||||
"┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 1: npm sta.. (PID: 1003) Close (Ctrl+B) | Kill (Ctrl+K) | List │
|
||||
|
||||
@@ -74,6 +74,20 @@ exports[`<OverflowProvider><DiffRenderer /></OverflowProvider> > with useAlterna
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<OverflowProvider><DiffRenderer /></OverflowProvider> > with useAlternateBuffer = false > should not render a gap indicator for small gaps (<= MAX_CONTEXT_LINES_WITHOUT_GAP) 2`] = `
|
||||
" 1 context line 1
|
||||
2 context line 2
|
||||
3 context line 3
|
||||
4 context line 4
|
||||
5 context line 5
|
||||
11 context line 11
|
||||
12 context line 12
|
||||
13 context line 13
|
||||
14 context line 14
|
||||
15 context line 15
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<OverflowProvider><DiffRenderer /></OverflowProvider> > with useAlternateBuffer = false > should render a gap indicator for skipped lines 1`] = `
|
||||
" 1 context line 1
|
||||
2 - deleted line
|
||||
|
||||
@@ -66,6 +66,18 @@ A test server
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`McpStatus > renders correctly with a server error 2`] = `
|
||||
"Configured MCP servers:
|
||||
|
||||
🟢 server-1 - Ready (1 tool)
|
||||
Error: Failed to connect to server
|
||||
A test server
|
||||
Tools:
|
||||
- tool-1
|
||||
A test tool
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`McpStatus > renders correctly with authenticated OAuth status 1`] = `
|
||||
"Configured MCP servers:
|
||||
|
||||
|
||||
@@ -142,10 +142,16 @@ async function gracefulShutdown(_reason: string) {
|
||||
process.exit(ExitCodes.SUCCESS);
|
||||
}
|
||||
|
||||
let signalHandlersSetup = false;
|
||||
|
||||
export function setupSignalHandlers() {
|
||||
if (signalHandlersSetup) {
|
||||
return;
|
||||
}
|
||||
process.on('SIGHUP', () => gracefulShutdown('SIGHUP'));
|
||||
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
||||
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
|
||||
signalHandlersSetup = true;
|
||||
}
|
||||
|
||||
export function setupTtyCheck(): () => void {
|
||||
|
||||
+20
-22
@@ -6,36 +6,23 @@
|
||||
|
||||
import { vi, beforeEach, afterEach } from 'vitest';
|
||||
import { format } from 'node:util';
|
||||
import { coreEvents, debugLogger } from '@google/gemini-cli-core';
|
||||
import {
|
||||
coreEvents,
|
||||
debugLogger,
|
||||
uiTelemetryService,
|
||||
resetBrowserSession,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { themeManager } from './src/ui/themes/theme-manager.js';
|
||||
import { mockInkSpinner } from './src/test-utils/mockSpinner.js';
|
||||
|
||||
// Globally mock ink-spinner to prevent non-deterministic snapshot/act flakes.
|
||||
mockInkSpinner();
|
||||
|
||||
// Unset CI environment variable so that ink renders dynamically as it does in a real terminal
|
||||
if (process.env.CI !== undefined) {
|
||||
delete process.env.CI;
|
||||
}
|
||||
|
||||
global.IS_REACT_ACT_ENVIRONMENT = true;
|
||||
|
||||
// Increase max listeners to avoid warnings in large test suites
|
||||
coreEvents.setMaxListeners(100);
|
||||
|
||||
// Unset NO_COLOR environment variable to ensure consistent theme behavior between local and CI test runs
|
||||
if (process.env.NO_COLOR !== undefined) {
|
||||
delete process.env.NO_COLOR;
|
||||
}
|
||||
|
||||
// Force true color output for ink so that snapshots always include color information.
|
||||
process.env.FORCE_COLOR = '3';
|
||||
|
||||
// Force generic keybinding hints to ensure stable snapshots across different operating systems.
|
||||
process.env.FORCE_GENERIC_KEYBINDING_HINTS = 'true';
|
||||
|
||||
// Force generic terminal declaration to ensure stable snapshots across different host environments.
|
||||
process.env.TERM_PROGRAM = 'generic';
|
||||
uiTelemetryService.setMaxListeners(100);
|
||||
|
||||
import './src/test-utils/customMatchers.js';
|
||||
|
||||
@@ -47,9 +34,20 @@ let warnSpy: vi.SpyInstance;
|
||||
let errorSpy: vi.SpyInstance;
|
||||
let debugSpy: vi.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset themeManager state to ensure test isolation
|
||||
beforeEach(async () => {
|
||||
// Reset singletons to ensure test isolation
|
||||
themeManager.resetForTesting();
|
||||
uiTelemetryService.clear();
|
||||
uiTelemetryService.removeAllListeners();
|
||||
coreEvents.removeAllListeners();
|
||||
await resetBrowserSession();
|
||||
|
||||
// Use vi.stubEnv instead of direct process.env manipulation for thread safety
|
||||
vi.stubEnv('CI', ''); // Effectively unsets it
|
||||
vi.stubEnv('NO_COLOR', ''); // Effectively unsets it
|
||||
vi.stubEnv('FORCE_COLOR', '3');
|
||||
vi.stubEnv('FORCE_GENERIC_KEYBINDING_HINTS', 'true');
|
||||
vi.stubEnv('TERM_PROGRAM', 'generic');
|
||||
|
||||
// Mock debugLogger to avoid test output noise
|
||||
logSpy = vi.spyOn(debugLogger, 'log').mockImplementation(() => {});
|
||||
|
||||
@@ -31,7 +31,16 @@ export default defineConfig({
|
||||
setupFiles: ['./test-setup.ts'],
|
||||
testTimeout: 60000,
|
||||
hookTimeout: 60000,
|
||||
pool: 'forks',
|
||||
pool: 'threads',
|
||||
exclude: [
|
||||
'**/node_modules/**',
|
||||
'**/dist/**',
|
||||
'**/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx',
|
||||
'**/src/ui/components/views/McpStatus.test.tsx',
|
||||
'**/src/ui/components/messages/SubagentHistoryMessage.test.tsx',
|
||||
'**/src/ui/components/BackgroundTaskDisplay.test.tsx',
|
||||
'**/src/ui/auth/useAuth.test.tsx',
|
||||
],
|
||||
coverage: {
|
||||
enabled: true,
|
||||
provider: 'v8',
|
||||
@@ -46,12 +55,6 @@ export default defineConfig({
|
||||
['json-summary', { outputFile: 'coverage-summary.json' }],
|
||||
],
|
||||
},
|
||||
poolOptions: {
|
||||
threads: {
|
||||
minThreads: 1,
|
||||
maxThreads: 4,
|
||||
},
|
||||
},
|
||||
server: {
|
||||
deps: {
|
||||
inline: [/@google\/gemini-cli-core/],
|
||||
|
||||
Reference in New Issue
Block a user