mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-07 17:44:05 -05:00
Disable telemetry in smoke tests using an env arg
This commit is contained in:
@@ -99,9 +99,10 @@ function main(server: Server, initData: ISharedProcessInitData): void {
|
||||
server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appender));
|
||||
|
||||
const services = new ServiceCollection();
|
||||
const { appRoot, extensionsPath, extensionDevelopmentPath, isBuilt, extensionTestsPath, installSource } = accessor.get(IEnvironmentService);
|
||||
const environmentService = accessor.get(IEnvironmentService);
|
||||
const { appRoot, extensionsPath, extensionDevelopmentPath, isBuilt, extensionTestsPath, installSource } = environmentService;
|
||||
|
||||
if (isBuilt && !extensionDevelopmentPath && product.enableTelemetry) {
|
||||
if (isBuilt && !extensionDevelopmentPath && !environmentService.args['disable-telemetry'] && product.enableTelemetry) {
|
||||
const disableStorage = !!extensionTestsPath; // never keep any state when running extension tests!
|
||||
const storage = disableStorage ? inMemoryLocalStorageInstance : window.localStorage;
|
||||
const storageService = new StorageService(storage, storage);
|
||||
|
||||
@@ -291,7 +291,7 @@ export class CodeApplication {
|
||||
services.set(ICredentialsService, new SyncDescriptor(CredentialsService));
|
||||
|
||||
// Telemtry
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !!product.enableTelemetry) {
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
|
||||
const channel = getDelayedChannel<ITelemetryAppenderChannel>(this.sharedProcessClient.then(c => c.getChannel('telemetryAppender')));
|
||||
const appender = new TelemetryAppenderClient(channel);
|
||||
const commonProperties = resolveCommonProperties(product.commit, pkg.version, this.environmentService.installSource)
|
||||
|
||||
@@ -181,7 +181,7 @@ export function main(argv: ParsedArgs): TPromise<void> {
|
||||
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
|
||||
services.set(IChoiceService, new SyncDescriptor(ChoiceCliService));
|
||||
|
||||
if (isBuilt && !extensionDevelopmentPath && product.enableTelemetry) {
|
||||
if (isBuilt && !extensionDevelopmentPath && !envService.args['disable-telemetry'] && product.enableTelemetry) {
|
||||
const appenders: AppInsightsAppender[] = [];
|
||||
|
||||
if (product.aiConfig && product.aiConfig.asimovKey) {
|
||||
|
||||
@@ -41,6 +41,7 @@ export interface ParsedArgs {
|
||||
'open-url'?: string | string[];
|
||||
'skip-getting-started'?: boolean;
|
||||
'sticky-quickopen'?: boolean;
|
||||
'disable-telemetry'?: boolean;
|
||||
'export-default-configuration'?: string;
|
||||
'install-source'?: string;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ const options: minimist.Opts = {
|
||||
'show-versions',
|
||||
'nolazy',
|
||||
'skip-getting-started',
|
||||
'sticky-quickopen'
|
||||
'sticky-quickopen',
|
||||
'disable-telemetry'
|
||||
],
|
||||
alias: {
|
||||
add: 'a',
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
export function addGAParameters(telemetryService: ITelemetryService, environmentService: IEnvironmentService, uri: URI, origin: string, experiment = '1'): TPromise<URI> {
|
||||
if (environmentService.isBuilt && !environmentService.isExtensionDevelopment && !!product.enableTelemetry) {
|
||||
if (environmentService.isBuilt && !environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
|
||||
if (uri.scheme === 'https' && uri.authority === 'code.visualstudio.com') {
|
||||
return telemetryService.getTelemetryInfo()
|
||||
.then(info => {
|
||||
|
||||
@@ -299,7 +299,7 @@ export class WorkbenchShell {
|
||||
|
||||
// Telemetry
|
||||
this.sendMachineIdToMain(this.storageService);
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !!product.enableTelemetry) {
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
|
||||
const channel = getDelayedChannel<ITelemetryAppenderChannel>(sharedProcess.then(c => c.getChannel('telemetryAppender')));
|
||||
const commit = product.commit;
|
||||
const version = pkg.version;
|
||||
|
||||
@@ -126,6 +126,9 @@ export class SpectronApplication {
|
||||
// Prevent Quick Open from closing when focus is stolen, this allows concurrent smoketest suite running
|
||||
args.push('--sticky-quickopen');
|
||||
|
||||
// Disable telemetry for smoke tests
|
||||
args.push('--disable-telemetry');
|
||||
|
||||
// Ensure that running over custom extensions directory, rather than picking up the one that was used by a tester previously
|
||||
args.push(`--extensions-dir=${EXTENSIONS_DIR}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user