chore(usage telemetry): Freshen up Clearcut logging (#6013)

Co-authored-by: christine betts <chrstn@uw.edu>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
Richie Foreman
2025-08-12 14:31:59 -04:00
committed by GitHub
parent c5c6966d08
commit 7cc6b8c270
9 changed files with 969 additions and 270 deletions

View File

@@ -13,6 +13,25 @@ import {
ConfigParameters,
ContentGeneratorConfig,
} from '@google/gemini-cli-core';
import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node';
export const server = setupServer();
// TODO(richieforeman): Consider moving this to test setup globally.
beforeAll(() => {
server.listen({});
});
afterEach(() => {
server.resetHandlers();
});
afterAll(() => {
server.close();
});
const CLEARCUT_URL = 'https://play.googleapis.com/log';
const TEST_CONTENT_GENERATOR_CONFIG: ContentGeneratorConfig = {
apiKey: 'test-key',
@@ -37,6 +56,8 @@ describe('Configuration Integration Tests', () => {
let originalEnv: NodeJS.ProcessEnv;
beforeEach(() => {
server.resetHandlers(http.post(CLEARCUT_URL, () => HttpResponse.text()));
tempDir = fs.mkdtempSync(path.join(tmpdir(), 'gemini-cli-test-'));
originalEnv = { ...process.env };
process.env.GEMINI_API_KEY = 'test-api-key';