mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: add os platform and version in log report (#1053)
This commit is contained in:
@@ -13,8 +13,10 @@ import {
|
||||
afterEach,
|
||||
afterAll,
|
||||
} from 'vitest';
|
||||
import * as os from 'node:os';
|
||||
import { QwenLogger, TEST_ONLY } from './qwen-logger.js';
|
||||
import type { Config } from '../../config/config.js';
|
||||
import { AuthType } from '../../core/contentGenerator.js';
|
||||
import {
|
||||
StartSessionEvent,
|
||||
EndSessionEvent,
|
||||
@@ -22,7 +24,7 @@ import {
|
||||
KittySequenceOverflowEvent,
|
||||
IdeConnectionType,
|
||||
} from '../types.js';
|
||||
import type { RumEvent } from './event-types.js';
|
||||
import type { RumEvent, RumPayload } from './event-types.js';
|
||||
|
||||
// Mock dependencies
|
||||
vi.mock('../../utils/user_id.js', () => ({
|
||||
@@ -46,6 +48,7 @@ const makeFakeConfig = (overrides: Partial<Config> = {}): Config => {
|
||||
getCliVersion: () => '1.0.0',
|
||||
getProxy: () => undefined,
|
||||
getContentGeneratorConfig: () => ({ authType: 'test-auth' }),
|
||||
getAuthType: () => AuthType.QWEN_OAUTH,
|
||||
getMcpServers: () => ({}),
|
||||
getModel: () => 'test-model',
|
||||
getEmbeddingModel: () => 'test-embedding',
|
||||
@@ -102,6 +105,24 @@ describe('QwenLogger', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('createRumPayload', () => {
|
||||
it('includes os metadata in payload', async () => {
|
||||
const logger = QwenLogger.getInstance(mockConfig)!;
|
||||
const payload = await (
|
||||
logger as unknown as {
|
||||
createRumPayload(): Promise<RumPayload>;
|
||||
}
|
||||
).createRumPayload();
|
||||
|
||||
expect(payload.os).toEqual(
|
||||
expect.objectContaining({
|
||||
type: os.platform(),
|
||||
version: os.release(),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('event queue management', () => {
|
||||
it('should handle event overflow gracefully', () => {
|
||||
const debugConfig = makeFakeConfig({ getDebugMode: () => true });
|
||||
|
||||
Reference in New Issue
Block a user