fix(tests): Fix Firebase Studio to IDE detection tests (#7163)
This commit is contained in:
parent
a33293ac60
commit
023053ed92
3 changed files with 8 additions and 8 deletions
|
|
@ -62,12 +62,6 @@ describe('detectIde', () => {
|
||||||
expect(detectIde(ideProcessInfo)).toBe(DetectedIde.Trae);
|
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', () => {
|
it('should detect Firebase Studio via MONOSPACE_ENV', () => {
|
||||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||||
vi.stubEnv('MONOSPACE_ENV', 'true');
|
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"', () => {
|
it('should detect VSCode when no other IDE is detected and command includes "code"', () => {
|
||||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||||
|
vi.stubEnv('MONOSPACE_ENV', '');
|
||||||
expect(detectIde(ideProcessInfo)).toBe(DetectedIde.VSCode);
|
expect(detectIde(ideProcessInfo)).toBe(DetectedIde.VSCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should detect VSCodeFork when no other IDE is detected and command does not include "code"', () => {
|
it('should detect VSCodeFork when no other IDE is detected and command does not include "code"', () => {
|
||||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||||
|
vi.stubEnv('MONOSPACE_ENV', '');
|
||||||
expect(detectIde(ideProcessInfoNoCode)).toBe(DetectedIde.VSCodeFork);
|
expect(detectIde(ideProcessInfoNoCode)).toBe(DetectedIde.VSCodeFork);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ export function detectIdeFromEnv(): DetectedIde {
|
||||||
if (process.env['TERM_PRODUCT'] === 'Trae') {
|
if (process.env['TERM_PRODUCT'] === 'Trae') {
|
||||||
return DetectedIde.Trae;
|
return DetectedIde.Trae;
|
||||||
}
|
}
|
||||||
if (process.env['FIREBASE_DEPLOY_AGENT'] || process.env['MONOSPACE_ENV']) {
|
if (process.env['MONOSPACE_ENV']) {
|
||||||
return DetectedIde.FirebaseStudio;
|
return DetectedIde.FirebaseStudio;
|
||||||
}
|
}
|
||||||
return DetectedIde.VSCode;
|
return DetectedIde.VSCode;
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ describe('ClearcutLogger', () => {
|
||||||
env: {
|
env: {
|
||||||
CURSOR_TRACE_ID: 'abc123',
|
CURSOR_TRACE_ID: 'abc123',
|
||||||
GITHUB_SHA: undefined,
|
GITHUB_SHA: undefined,
|
||||||
|
TERM_PROGRAM: 'vscode',
|
||||||
},
|
},
|
||||||
expectedValue: 'cursor',
|
expectedValue: 'cursor',
|
||||||
},
|
},
|
||||||
|
|
@ -288,6 +289,7 @@ describe('ClearcutLogger', () => {
|
||||||
env: {
|
env: {
|
||||||
TERM_PROGRAM: 'vscode',
|
TERM_PROGRAM: 'vscode',
|
||||||
GITHUB_SHA: undefined,
|
GITHUB_SHA: undefined,
|
||||||
|
MONOSPACE_ENV: '',
|
||||||
},
|
},
|
||||||
expectedValue: 'vscode',
|
expectedValue: 'vscode',
|
||||||
},
|
},
|
||||||
|
|
@ -295,6 +297,7 @@ describe('ClearcutLogger', () => {
|
||||||
env: {
|
env: {
|
||||||
MONOSPACE_ENV: 'true',
|
MONOSPACE_ENV: 'true',
|
||||||
GITHUB_SHA: undefined,
|
GITHUB_SHA: undefined,
|
||||||
|
TERM_PROGRAM: 'vscode',
|
||||||
},
|
},
|
||||||
expectedValue: 'firebasestudio',
|
expectedValue: 'firebasestudio',
|
||||||
},
|
},
|
||||||
|
|
@ -302,6 +305,7 @@ describe('ClearcutLogger', () => {
|
||||||
env: {
|
env: {
|
||||||
__COG_BASHRC_SOURCED: 'true',
|
__COG_BASHRC_SOURCED: 'true',
|
||||||
GITHUB_SHA: undefined,
|
GITHUB_SHA: undefined,
|
||||||
|
TERM_PROGRAM: 'vscode',
|
||||||
},
|
},
|
||||||
expectedValue: 'devin',
|
expectedValue: 'devin',
|
||||||
},
|
},
|
||||||
|
|
@ -309,6 +313,7 @@ describe('ClearcutLogger', () => {
|
||||||
env: {
|
env: {
|
||||||
CLOUD_SHELL: 'true',
|
CLOUD_SHELL: 'true',
|
||||||
GITHUB_SHA: undefined,
|
GITHUB_SHA: undefined,
|
||||||
|
TERM_PROGRAM: 'vscode',
|
||||||
},
|
},
|
||||||
expectedValue: 'cloudshell',
|
expectedValue: 'cloudshell',
|
||||||
},
|
},
|
||||||
|
|
@ -319,7 +324,6 @@ describe('ClearcutLogger', () => {
|
||||||
for (const [key, value] of Object.entries(env)) {
|
for (const [key, value] of Object.entries(env)) {
|
||||||
vi.stubEnv(key, value);
|
vi.stubEnv(key, value);
|
||||||
}
|
}
|
||||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
|
||||||
const event = logger?.createLogEvent(EventNames.API_ERROR, []);
|
const event = logger?.createLogEvent(EventNames.API_ERROR, []);
|
||||||
expect(event?.event_metadata[0][3]).toEqual({
|
expect(event?.event_metadata[0][3]).toEqual({
|
||||||
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SURFACE,
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SURFACE,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue