mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix(tests): Fix Firebase Studio to IDE detection tests (#7163)
This commit is contained in:
@@ -62,12 +62,6 @@ describe('detectIde', () => {
|
||||
expect(detectIde(ideProcessInfo)).toBe(DetectedIde.Trae);
|
||||
});
|
||||
|
||||
it('should detect Firebase Studio via FIREBASE_DEPLOY_AGENT', () => {
|
||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||
vi.stubEnv('FIREBASE_DEPLOY_AGENT', 'true');
|
||||
expect(detectIde(ideProcessInfo)).toBe(DetectedIde.FirebaseStudio);
|
||||
});
|
||||
|
||||
it('should detect Firebase Studio via MONOSPACE_ENV', () => {
|
||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||
vi.stubEnv('MONOSPACE_ENV', 'true');
|
||||
@@ -76,11 +70,13 @@ describe('detectIde', () => {
|
||||
|
||||
it('should detect VSCode when no other IDE is detected and command includes "code"', () => {
|
||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||
vi.stubEnv('MONOSPACE_ENV', '');
|
||||
expect(detectIde(ideProcessInfo)).toBe(DetectedIde.VSCode);
|
||||
});
|
||||
|
||||
it('should detect VSCodeFork when no other IDE is detected and command does not include "code"', () => {
|
||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||
vi.stubEnv('MONOSPACE_ENV', '');
|
||||
expect(detectIde(ideProcessInfoNoCode)).toBe(DetectedIde.VSCodeFork);
|
||||
});
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ export function detectIdeFromEnv(): DetectedIde {
|
||||
if (process.env['TERM_PRODUCT'] === 'Trae') {
|
||||
return DetectedIde.Trae;
|
||||
}
|
||||
if (process.env['FIREBASE_DEPLOY_AGENT'] || process.env['MONOSPACE_ENV']) {
|
||||
if (process.env['MONOSPACE_ENV']) {
|
||||
return DetectedIde.FirebaseStudio;
|
||||
}
|
||||
return DetectedIde.VSCode;
|
||||
|
||||
@@ -281,6 +281,7 @@ describe('ClearcutLogger', () => {
|
||||
env: {
|
||||
CURSOR_TRACE_ID: 'abc123',
|
||||
GITHUB_SHA: undefined,
|
||||
TERM_PROGRAM: 'vscode',
|
||||
},
|
||||
expectedValue: 'cursor',
|
||||
},
|
||||
@@ -288,6 +289,7 @@ describe('ClearcutLogger', () => {
|
||||
env: {
|
||||
TERM_PROGRAM: 'vscode',
|
||||
GITHUB_SHA: undefined,
|
||||
MONOSPACE_ENV: '',
|
||||
},
|
||||
expectedValue: 'vscode',
|
||||
},
|
||||
@@ -295,6 +297,7 @@ describe('ClearcutLogger', () => {
|
||||
env: {
|
||||
MONOSPACE_ENV: 'true',
|
||||
GITHUB_SHA: undefined,
|
||||
TERM_PROGRAM: 'vscode',
|
||||
},
|
||||
expectedValue: 'firebasestudio',
|
||||
},
|
||||
@@ -302,6 +305,7 @@ describe('ClearcutLogger', () => {
|
||||
env: {
|
||||
__COG_BASHRC_SOURCED: 'true',
|
||||
GITHUB_SHA: undefined,
|
||||
TERM_PROGRAM: 'vscode',
|
||||
},
|
||||
expectedValue: 'devin',
|
||||
},
|
||||
@@ -309,6 +313,7 @@ describe('ClearcutLogger', () => {
|
||||
env: {
|
||||
CLOUD_SHELL: 'true',
|
||||
GITHUB_SHA: undefined,
|
||||
TERM_PROGRAM: 'vscode',
|
||||
},
|
||||
expectedValue: 'cloudshell',
|
||||
},
|
||||
@@ -319,7 +324,6 @@ describe('ClearcutLogger', () => {
|
||||
for (const [key, value] of Object.entries(env)) {
|
||||
vi.stubEnv(key, value);
|
||||
}
|
||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||
const event = logger?.createLogEvent(EventNames.API_ERROR, []);
|
||||
expect(event?.event_metadata[0][3]).toEqual({
|
||||
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SURFACE,
|
||||
|
||||
Reference in New Issue
Block a user