Skip to content

Commit

Permalink
Correctly set failed property when sending telemetry for TERMINAL_S…
Browse files Browse the repository at this point in the history
…HELL_IDENTIFICATION (#17832)
  • Loading branch information
Kartik Raj authored Oct 21, 2021
1 parent f0ad996 commit 8e09243
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/client/common/terminal/shellDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class ShellDetector {
`${detector}. Shell identified as ${shell} ${terminal ? `(Terminal name is ${terminal.name})` : ''}`,
);
if (shell && shell !== TerminalShellType.other) {
telemetryProperties.failed = false;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class VSCEnvironmentShellDetector extends BaseShellDetector {
traceVerbose(`Terminal shell path '${shellPath}' identified as shell '${shell}'`);
telemetryProperties.shellIdentificationSource =
shell === TerminalShellType.other ? telemetryProperties.shellIdentificationSource : 'vscode';
telemetryProperties.failed = shell === TerminalShellType.other ? false : true;
return shell;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ suite('Shell Detectors', () => {
shellPathsAndIdentification.set('/usr/bin/xonsh', TerminalShellType.xonsh);
shellPathsAndIdentification.set('/usr/bin/xonshx', TerminalShellType.other);

const telemetryProperties: ShellIdentificationTelemetry = {
failed: true,
shellIdentificationSource: 'default',
terminalProvided: false,
hasCustomShell: undefined,
hasShellInEnv: undefined,
};
let telemetryProperties: ShellIdentificationTelemetry;

setup(() => {
telemetryProperties = {
failed: true,
shellIdentificationSource: 'default',
terminalProvided: false,
hasCustomShell: undefined,
hasShellInEnv: undefined,
};
platformService = mock(PlatformService);
workspaceService = mock(WorkspaceService);
currentProcess = mock(CurrentProcess);
Expand Down Expand Up @@ -122,6 +123,7 @@ suite('Shell Detectors', () => {
undefined,
'Should be undefined when vscode.env.shell is undefined',
);
expect(telemetryProperties.failed).to.equal(false);
});
test('Identify shell based on VSC Settings', async () => {
const shellDetector = new SettingsShellDetector(instance(workspaceService), instance(platformService));
Expand Down

0 comments on commit 8e09243

Please sign in to comment.