@react-native-windows/telemetry 0.76.0-preview.2 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAAmD;AAEnD,qEAAuD;AACvD,mEAAqD;AACrD,+DAAiD;AA2BjD,sCAAsC;AACtC,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D,4DAA4D;AAC5D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD,wGAAwG;AACxG,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEpC,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACpC,QAAA,mBAAmB,GAAG,mBAAmB,CAAC;AAEvD,2CAA2C;AAC9B,QAAA,iBAAiB,GAAa;IACzC,wBAAgB;IAChB,2BAAmB;CACpB,CAAC;AAEF,4EAA4E;AAC5E,uDAAuD;AAC1C,QAAA,kBAAkB,GAAa;IAC1C,6BAA6B;IAC7B,2BAA2B;IAC3B,iCAAiC;IACjC,OAAO;IACP,cAAc;IACd,sBAAsB;IACtB,2BAA2B;CAC5B,CAAC;AAEF,4EAA4E;AAC/D,QAAA,oBAAoB,GAAa;IAC5C,mBAAmB;IACnB,4BAA4B;IAC5B,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,MAAa,SAAS;IAeV,MAAM,CAAC,qBAAqB;;QACpC,yEAAyE;QACzE,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,mCAAI,cAAc,CAAC;IAC3D,CAAC;IAES,MAAM,CAAC,KAAK;QACpB,eAAe;QACf,IAAI,SAAS,CAAC,MAAM,EAAE;YACpB,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzB,SAAS,CAAC,MAAM,GAAG,SAAS,CAA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U,CAAC,CAAC;QAE5C,aAAa;QACb,SAAS,CAAC,MAAO,CAAC,cAAc,CAAC;YAC/B,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QACH,SAAS,CAAC,MAAO,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AAzZgB,gBAAM,GAAiC,SAAS,CAAC;AACjD,iBAAO,GAAqB;IAC3C,WAAW,EAAE,SAAS,CAAC,qBAAqB,EAAE;IAC9C,qBAAqB,EAAE,KAAK;IAC5B,0BAA0B,EAAE,IAAI;CACjC,CAAC;AAEe,gBAAM,GAAY,aAAa,CAAC,SAAS,EAAE,CAAC;AAC5C,qBAAW,GAAgB,EAAE,CAAC;AAC9B,sBAAY,GAA2B,EAAE,CAAC;AAC1C,qBAAW,GAEa,SAAS,CAAC;AAbxC,8BAAS","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\n\nimport * as basePropUtils from './utils/basePropUtils';\nimport * as versionUtils from './utils/versionUtils';\nimport * as errorUtils from './utils/errorUtils';\nimport * as projectUtils from './utils/projectUtils';\n\nexport interface TelemetryOptions {\n setupString: string;\n preserveErrorMessages: boolean;\n populateNpmPackageVersions: boolean;\n}\n\nexport interface CommandStartInfo {\n commandName: string;\n args: Record<string, any>;\n options: Record<string, any>;\n defaultOptions: Record<string, any>;\n}\n\nexport interface CommandEndInfo {\n resultCode: errorUtils.CodedErrorType;\n}\n\ninterface CommandInfo {\n startTime?: number;\n endTime?: number;\n startInfo?: CommandStartInfo;\n endInfo?: CommandEndInfo;\n}\n\n// This is our key with the AI backend\nconst RNWSetupString = '795006ca-cf54-40ee-8bc6-03deb91401c3';\n\n// Environment variable to override the default setup string\nconst ENV_SETUP_OVERRIDE = 'RNW_TELEMETRY_SETUP';\n\n// Environment variable to override the http proxy (such as http://localhost:8888 for Fiddler debugging)\nconst ENV_PROXY_OVERRIDE = 'RNW_TELEMETRY_PROXY';\n\nexport const CommandEventName = 'RNWCLI.Command';\nexport const CodedErrorEventName = 'RNWCLI.CodedError';\n\n// These are the event names we're tracking\nexport const EventNamesWeTrack: string[] = [\n CommandEventName,\n CodedErrorEventName,\n];\n\n// These are NPM packages we care about, in terms of capturing versions used\n// and getting more details about when reporting errors\nexport const NpmPackagesWeTrack: string[] = [\n '@react-native-community/cli',\n '@react-native-windows/cli',\n '@react-native-windows/telemetry',\n 'react',\n 'react-native',\n 'react-native-windows',\n 'react-native-windows-init',\n];\n\n// These are NPM packages we care about, in terms of capturing versions used\nexport const NuGetPackagesWeTrack: string[] = [\n 'Microsoft.UI.Xaml',\n 'Microsoft.Windows.CppWinRT',\n 'Microsoft.WinUI',\n];\n\n/**\n * The Telemetry class is responsible for reporting telemetry for RNW CLI.\n */\nexport class Telemetry {\n protected static client?: appInsights.TelemetryClient = undefined;\n protected static options: TelemetryOptions = {\n setupString: Telemetry.getDefaultSetupString(), // We default to our AI key, but callers can easily override it in setup\n preserveErrorMessages: false,\n populateNpmPackageVersions: true,\n };\n\n protected static isTest: boolean = basePropUtils.isCliTest();\n protected static commandInfo: CommandInfo = {};\n protected static versionsProp: Record<string, string> = {};\n protected static projectProp?:\n | projectUtils.AppProjectInfo\n | projectUtils.DependencyProjectInfo = undefined;\n\n protected static getDefaultSetupString(): string {\n // Enable overriding the default setup string via an environment variable\n return process.env[ENV_SETUP_OVERRIDE] ?? RNWSetupString;\n }\n\n protected static reset(): void {\n // Reset client\n if (Telemetry.client) {\n Telemetry.client.flush();\n Telemetry.client = undefined;\n }\n\n // Reset local members\n Telemetry.options = {\n setupString: Telemetry.getDefaultSetupString(),\n preserveErrorMessages: false,\n populateNpmPackageVersions: true,\n };\n Telemetry.commandInfo = {};\n Telemetry.versionsProp = {};\n Telemetry.projectProp = undefined;\n }\n\n static isEnabled(): boolean {\n return Telemetry.client !== undefined;\n }\n\n static getSessionId(): string {\n return basePropUtils.getSessionId();\n }\n\n /** Sets up the Telemetry static to be used elsewhere. */\n static async setup(options?: Partial<TelemetryOptions>) {\n if (Telemetry.client) {\n // Bail since we've already setup\n return;\n }\n\n // Bail if we're in CI and not capturing CI\n if (!this.isTest && basePropUtils.isCI() && !basePropUtils.captureCI()) {\n return;\n }\n\n // Save off options for later\n Object.assign(Telemetry.options, options);\n\n Telemetry.setupClient();\n\n await Telemetry.setupBaseProperties();\n\n Telemetry.setupTelemetryProcessors();\n }\n\n /** Sets up Telemetry.client. */\n private static setupClient() {\n appInsights.Configuration.setInternalLogging(false, false);\n\n Telemetry.client = new appInsights.TelemetryClient(\n Telemetry.options.setupString,\n );\n\n // Allow overriding the proxy server via an environment variable\n const proxyServer = process.env[ENV_PROXY_OVERRIDE];\n if (proxyServer) {\n Telemetry.client.config.proxyHttpUrl = proxyServer;\n Telemetry.client.config.proxyHttpsUrl = proxyServer;\n }\n\n Telemetry.client.config.disableAppInsights = Telemetry.isTest;\n Telemetry.client.config.disableStatsbeat = true;\n\n // Despite trying to disable the statsbeat, it might still be running: https://github.com/microsoft/ApplicationInsights-node.js/issues/943\n // So we want to disable it, and despite the method's typing, getStatsbeat() _can_ return undefined\n\n Telemetry.client.getStatsbeat()?.enable(false);\n\n Telemetry.client.channel.setUseDiskRetryCaching(!Telemetry.isTest);\n }\n\n /** Sets up any base properties that all telemetry events require. */\n private static async setupBaseProperties() {\n Telemetry.client!.commonProperties.deviceId =\n await basePropUtils.deviceId();\n Telemetry.client!.commonProperties.deviceArchitecture =\n basePropUtils.deviceArchitecture();\n Telemetry.client!.commonProperties.nodeArchitecture =\n basePropUtils.nodeArchitecture();\n Telemetry.client!.commonProperties.devicePlatform =\n basePropUtils.devicePlatform();\n Telemetry.client!.commonProperties.deviceLocale =\n await basePropUtils.deviceLocale();\n Telemetry.client!.commonProperties.deviceNumCPUs = basePropUtils\n .deviceNumCPUs()\n .toString();\n Telemetry.client!.commonProperties.deviceTotalMemory = basePropUtils\n .deviceTotalMemory()\n .toString();\n Telemetry.client!.commonProperties.deviceDiskFreeSpace = basePropUtils\n .deviceDiskFreeSpace()\n .toString();\n Telemetry.client!.commonProperties.ciCaptured = basePropUtils\n .captureCI()\n .toString();\n Telemetry.client!.commonProperties.ciType = basePropUtils.ciType();\n Telemetry.client!.commonProperties.isMsftInternal = basePropUtils\n .isMsftInternal()\n .toString();\n Telemetry.client!.commonProperties.sampleRate = basePropUtils\n .sampleRate()\n .toString();\n Telemetry.client!.commonProperties.isTest = Telemetry.isTest.toString();\n Telemetry.client!.commonProperties.sessionId = Telemetry.getSessionId();\n\n Telemetry.client!.config.samplingPercentage = basePropUtils.sampleRate();\n\n await Telemetry.populateToolsVersions();\n if (Telemetry.options.populateNpmPackageVersions) {\n await Telemetry.populateNpmPackageVersions();\n }\n }\n\n /** Sets up any telemetry processors. */\n private static setupTelemetryProcessors() {\n Telemetry.client!.addTelemetryProcessor(Telemetry.basicTelemetryProcessor);\n Telemetry.client!.addTelemetryProcessor(Telemetry.errorTelemetryProcessor);\n }\n\n /**\n * Performs the processing necessary (mostly PII sanitization) for all events.\n * @param envelope The ApplicationInsights event envelope.\n * @param _contextObjects An optional context object.\n * @returns Whether to kee\n */\n private static basicTelemetryProcessor(\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n _contextObjects?: {\n [name: string]: any;\n },\n ): boolean {\n delete envelope.tags['ai.cloud.roleInstance'];\n\n // Filter out \"legacy\" events from older stable branches\n const properties = envelope.data.baseData?.properties;\n if (\n properties?.eventName &&\n EventNamesWeTrack.includes(properties.eventName)\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Performs the processing necessary (mostly PII sanitization) for error events.\n * @param envelope\n * @param _contextObjects\n * @returns\n */\n private static errorTelemetryProcessor(\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n _contextObjects?: {\n [name: string]: any;\n },\n ): boolean {\n if (envelope.data.baseType === 'ExceptionData') {\n const data = envelope.data.baseData;\n if (data?.exceptions) {\n for (const exception of data.exceptions) {\n for (const frame of exception.parsedStack) {\n errorUtils.sanitizeErrorStackFrame(frame);\n }\n\n // Exception message must never be blank, or AI will reject it\n exception.message = exception.message || '[None]';\n\n // CodedError has non-PII information in its 'type' member, plus optionally some more info in its 'data'.\n // The message may contain PII information. This can be sanitized, but for now delete it.\n // Note that the type of data.exceptions[0] is always going to be ExceptionDetails. It is not the original thrown exception.\n // https://github.com/microsoft/ApplicationInsights-node.js/issues/707\n if (Telemetry.options.preserveErrorMessages) {\n exception.message = errorUtils.sanitizeErrorMessage(\n exception.message,\n );\n } else {\n exception.message = '[Removed]';\n }\n }\n }\n }\n return true;\n }\n\n /** Tries to update the version of the named package/tool by calling getValue(). */\n static async tryUpdateVersionsProp(\n name: string,\n getValue: () => Promise<string | null>,\n forceRefresh?: boolean,\n ): Promise<boolean> {\n if (!Telemetry.client) {\n return true;\n }\n\n if (forceRefresh === true || !Telemetry.versionsProp[name]) {\n const value = await getValue();\n if (value) {\n Telemetry.versionsProp[name] = value;\n return true;\n }\n }\n return false;\n }\n\n /** Populates the versions property of tools we care to track. */\n static async populateToolsVersions(refresh?: boolean) {\n await Telemetry.tryUpdateVersionsProp(\n 'node',\n versionUtils.getNodeVersion,\n refresh,\n );\n await Telemetry.tryUpdateVersionsProp(\n 'npm',\n versionUtils.getNpmVersion,\n refresh,\n );\n await Telemetry.tryUpdateVersionsProp(\n 'yarn',\n versionUtils.getYarnVersion,\n refresh,\n );\n await Telemetry.tryUpdateVersionsProp(\n 'VisualStudio',\n versionUtils.getVisualStudioVersion,\n refresh,\n );\n }\n\n /** Populates the versions property of npm packages we care to track. */\n static async populateNpmPackageVersions(refresh?: boolean) {\n for (const npmPackage of NpmPackagesWeTrack) {\n await Telemetry.tryUpdateVersionsProp(\n npmPackage,\n async () => await versionUtils.getVersionOfNpmPackage(npmPackage),\n refresh,\n );\n }\n }\n\n /** Populates the versions property of nuget packages we care to track. */\n static async populateNuGetPackageVersions(\n projectFile: string,\n refresh?: boolean,\n ) {\n const nugetVersions = await versionUtils.getVersionsOfNuGetPackages(\n projectFile,\n NuGetPackagesWeTrack,\n );\n\n for (const nugetPackage of NuGetPackagesWeTrack) {\n await Telemetry.tryUpdateVersionsProp(\n nugetPackage,\n async () => nugetVersions[nugetPackage],\n refresh,\n );\n }\n }\n\n static setProjectInfo(\n info: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo,\n ) {\n if (!Telemetry.client) {\n return;\n }\n\n Telemetry.projectProp = info;\n }\n\n static startCommand(info: CommandStartInfo) {\n if (!Telemetry.client) {\n return;\n }\n\n if (Telemetry.commandInfo.startInfo) {\n return;\n }\n\n Telemetry.commandInfo.startTime = Date.now();\n Telemetry.commandInfo.startInfo = info;\n\n // Set common command props\n Telemetry.client!.commonProperties.commandName = info.commandName;\n }\n\n static endCommand(info: CommandEndInfo, extraProps?: Record<string, any>) {\n if (!Telemetry.client) {\n return;\n }\n\n if (!Telemetry.commandInfo.startInfo) {\n return;\n }\n\n Telemetry.commandInfo.endTime = Date.now();\n Telemetry.commandInfo.endInfo = info;\n\n Telemetry.trackCommandEvent(extraProps);\n }\n\n private static trackCommandEvent(extraProps?: Record<string, any>) {\n const props: Record<string, any> = {\n eventName: CommandEventName,\n };\n\n // Set command props\n props.command = {\n options: Telemetry.commandInfo.startInfo?.options,\n defaultOptions: Telemetry.commandInfo.startInfo?.defaultOptions,\n args: Telemetry.commandInfo.startInfo?.args,\n durationInSecs:\n (Telemetry.commandInfo.endTime! - Telemetry.commandInfo.startTime!) /\n 1000,\n resultCode: Telemetry.commandInfo.endInfo?.resultCode,\n };\n\n // Set remaining common props\n props.project = Telemetry.projectProp;\n props.versions = Telemetry.versionsProp;\n\n // Set extra props\n props.extraProps = {};\n Object.assign(props.extraProps, extraProps);\n\n // Fire event\n Telemetry.client!.trackEvent({name: props.eventName, properties: props});\n Telemetry.client!.flush();\n }\n\n static trackException(error: Error, extraProps?: Record<string, any>) {\n if (!Telemetry.client) {\n return;\n }\n\n const props: Record<string, any> = {\n eventName: CodedErrorEventName,\n };\n\n // Save off CodedError info\n const codedError =\n error instanceof errorUtils.CodedError\n ? (error as errorUtils.CodedError)\n : null;\n props.codedError = {\n type: codedError?.type ?? 'Unknown',\n data: codedError?.data ?? {},\n };\n\n // Copy msBuildErrorMessages into the codedError.data object\n if ((error as any).msBuildErrorMessages) {\n // Always grab MSBuild error codes if possible\n props.codedError.data.msBuildErrors = (error as any).msBuildErrorMessages\n .map(errorUtils.tryGetErrorCode)\n .filter((msg: string | undefined) => msg);\n\n // Grab sanitized MSBuild error messages if we're preserving them\n if (Telemetry.options.preserveErrorMessages) {\n props.codedError.data.msBuildErrorMessages = (\n error as any\n ).msBuildErrorMessages\n .map(errorUtils.sanitizeErrorMessage)\n .filter((msg: string) => msg);\n }\n }\n\n // Copy miscellaneous system error fields into the codedError.data object\n const syscallExceptionFieldsToCopy = ['errno', 'syscall', 'code'];\n for (const f of syscallExceptionFieldsToCopy) {\n if ((error as any)[f]) {\n props.codedError.data[f] = (error as any)[f];\n }\n }\n\n // Set remaining common props\n props.project = Telemetry.projectProp;\n props.versions = Telemetry.versionsProp;\n\n // Set extra props\n props.extraProps = {};\n Object.assign(props.extraProps, extraProps);\n\n // Fire event\n Telemetry.client!.trackException({\n exception: error,\n properties: props,\n });\n Telemetry.client!.flush();\n }\n}\n"]}
1
+ {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAAoD;AACpD,yDAA0E;AAE1E,qEAAuD;AACvD,mEAAqD;AACrD,+DAAiD;AAEjD,6DAA+C;AA0B/C,0BAA0B;AAC1B,MAAM,2BAA2B,GAC/B,4EAA4E,CAAC;AAE/E,4DAA4D;AAC5D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD,wGAAwG;AACxG,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEpC,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACpC,QAAA,mBAAmB,GAAG,mBAA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* as coreOneDS from '@microsoft/1ds-core-js';\nimport {PostChannel, IChannelConfiguration} from '@microsoft/1ds-post-js';\n\nimport * as basePropUtils from './utils/basePropUtils';\nimport * as versionUtils from './utils/versionUtils';\nimport * as errorUtils from './utils/errorUtils';\nimport * as projectUtils from './utils/projectUtils';\nimport * as nameUtils from './utils/nameUtils';\n\nexport interface TelemetryOptions {\n setupString: string;\n preserveErrorMessages: boolean;\n populateNpmPackageVersions: boolean;\n}\n\nexport interface CommandStartInfo {\n commandName: string;\n args: Record<string, any>;\n options: Record<string, any>;\n defaultOptions: Record<string, any>;\n}\n\nexport interface CommandEndInfo {\n resultCode: errorUtils.CodedErrorType;\n}\n\ninterface CommandInfo {\n startTime?: number;\n endTime?: number;\n startInfo?: CommandStartInfo;\n endInfo?: CommandEndInfo;\n}\n\n// 1DS instrumentation key\nconst RNW_1DS_INSTRUMENTATION_KEY =\n '49ff6d3ef12f4578a7b75a2573d9dba8-026332b2-2d50-452f-ad0d-50f921c97a9d-7145';\n\n// Environment variable to override the default setup string\nconst ENV_SETUP_OVERRIDE = 'RNW_TELEMETRY_SETUP';\n\n// Environment variable to override the http proxy (such as http://localhost:8888 for Fiddler debugging)\nconst ENV_PROXY_OVERRIDE = 'RNW_TELEMETRY_PROXY';\n\nexport const CommandEventName = 'RNWCLI.Command';\nexport const CodedErrorEventName = 'RNWCLI.CodedError';\n\n// These are the event names we're tracking\nexport const EventNamesWeTrack: string[] = [\n CommandEventName,\n CodedErrorEventName,\n];\n\n// These are NPM packages we care about, in terms of capturing versions used\n// and getting more details about when reporting errors\nexport const NpmPackagesWeTrack: string[] = [\n '@react-native-community/cli',\n '@react-native-windows/cli',\n '@react-native-windows/telemetry',\n 'react',\n 'react-native',\n 'react-native-windows',\n 'react-native-windows-init',\n];\n\n// These are NPM packages we care about, in terms of capturing versions used\nexport const NuGetPackagesWeTrack: string[] = [\n 'Microsoft.UI.Xaml',\n 'Microsoft.Windows.CppWinRT',\n 'Microsoft.WinUI',\n];\n\n/**\n * The Telemetry class is responsible for reporting telemetry for RNW CLI.\n */\nexport class Telemetry {\n protected static appInsightsCore?: coreOneDS.AppInsightsCore = undefined;\n\n protected static options: TelemetryOptions = {\n setupString: Telemetry.getDefaultSetupString(), // We default to our 1DS instrumentation key, but callers can easily override it in setup.\n preserveErrorMessages: false,\n populateNpmPackageVersions: true,\n };\n\n protected static isTestEnvironment: boolean = basePropUtils.isCliTest();\n\n protected static commandInfo: CommandInfo = {};\n\n // Stores the version of a list of packages used by the RNW app project.\n protected static versionsProp: Record<string, string> = {};\n\n protected static projectProp?:\n | projectUtils.AppProjectInfo\n | projectUtils.DependencyProjectInfo = undefined;\n\n // Store \"Common Properties\" in a single object. This will be logged in all telemetry events.\n protected static commonProperties: {[key: string]: string} = {};\n\n protected static getDefaultSetupString(): string {\n // Enable overriding the default setup string via an environment variable\n return process.env[ENV_SETUP_OVERRIDE] ?? RNW_1DS_INSTRUMENTATION_KEY;\n }\n\n protected static reset(): void {\n // Reset client\n if (Telemetry.appInsightsCore) {\n Telemetry.appInsightsCore.flush();\n Telemetry.appInsightsCore = undefined;\n }\n\n // Reset local members\n Telemetry.options = {\n setupString: Telemetry.getDefaultSetupString(),\n preserveErrorMessages: false,\n populateNpmPackageVersions: true,\n };\n Telemetry.commandInfo = {};\n Telemetry.versionsProp = {};\n Telemetry.projectProp = undefined;\n }\n\n static isEnabled(): boolean {\n return Telemetry.appInsightsCore !== undefined;\n }\n\n static getSessionId(): string {\n return basePropUtils.getSessionId();\n }\n\n /** Sets up the Telemetry static to be used elsewhere. */\n static async setup(options?: Partial<TelemetryOptions>) {\n if (Telemetry.appInsightsCore) {\n // Bail since we've already setup\n return;\n }\n\n // Bail if we're in CI and not capturing CI\n if (\n !Telemetry.isTestEnvironment &&\n basePropUtils.isCI() &&\n !basePropUtils.captureCI()\n ) {\n return;\n }\n\n // Save off options for later\n Object.assign(Telemetry.options, options);\n\n Telemetry.setupClient();\n\n await Telemetry.setupBaseProperties();\n }\n\n private static basicTelemetryInitializer(\n envelope: coreOneDS.ITelemetryItem,\n ): boolean {\n // Filter out \"legacy\" events from older stable branches\n if (envelope.name && EventNamesWeTrack.includes(envelope.name)) {\n return true;\n }\n\n return false;\n }\n\n /** Sets up Telemetry.appInsightsCore. */\n private static setupClient() {\n const postChannel: PostChannel = new PostChannel();\n\n const coreConfiguration: coreOneDS.IExtendedConfiguration = {\n instrumentationKey: Telemetry.getDefaultSetupString(),\n };\n\n const postChannelConfig: IChannelConfiguration = {\n eventsLimitInMem: 5000,\n };\n\n coreConfiguration.extensionConfig = {};\n coreConfiguration.extensionConfig[postChannel.identifier] =\n postChannelConfig;\n\n // Allow overriding the endpoint URL via an environment variable.\n if (process.env[ENV_PROXY_OVERRIDE] !== undefined) {\n coreConfiguration.endpointUrl = process.env[ENV_PROXY_OVERRIDE];\n }\n\n Telemetry.appInsightsCore = new coreOneDS.AppInsightsCore();\n Telemetry.appInsightsCore.initialize(\n coreConfiguration,\n [postChannel] /* extensions */,\n );\n\n Telemetry.appInsightsCore.addTelemetryInitializer(\n Telemetry.basicTelemetryInitializer,\n );\n }\n\n /** Sets up any base properties that all telemetry events require. */\n private static async setupBaseProperties() {\n Telemetry.commonProperties.deviceId = await basePropUtils.deviceId();\n Telemetry.commonProperties.fullBuildInfo =\n await basePropUtils.fullBuildInfo();\n Telemetry.commonProperties.deviceArchitecture =\n basePropUtils.deviceArchitecture();\n Telemetry.commonProperties.nodeArchitecture =\n basePropUtils.nodeArchitecture();\n Telemetry.commonProperties.nodePlatform = basePropUtils.nodePlatform();\n Telemetry.commonProperties.deviceClass = basePropUtils.deviceClass();\n Telemetry.commonProperties.deviceLocale =\n await basePropUtils.deviceLocale();\n Telemetry.commonProperties.deviceNumCPUs = basePropUtils\n .deviceNumCPUs()\n .toString();\n Telemetry.commonProperties.deviceTotalMemory = basePropUtils\n .deviceTotalMemory()\n .toString();\n Telemetry.commonProperties.deviceDiskFreeSpace = basePropUtils\n .deviceDiskFreeSpace()\n .toString();\n Telemetry.commonProperties.ciCaptured = basePropUtils\n .captureCI()\n .toString();\n Telemetry.commonProperties.ciType = basePropUtils.ciType();\n Telemetry.commonProperties.isMsftInternal = basePropUtils\n .isMsftInternal()\n .toString();\n Telemetry.commonProperties.isTest = Telemetry.isTestEnvironment.toString();\n Telemetry.commonProperties.sessionId = Telemetry.getSessionId();\n\n await Telemetry.populateToolsVersions();\n if (Telemetry.options.populateNpmPackageVersions) {\n await Telemetry.populateNpmPackageVersions();\n }\n }\n\n /** Tries to update the version of the named package/tool by calling getValue(). */\n static async tryUpdateVersionsProp(\n name: string,\n getValue: () => Promise<string | null>,\n forceRefresh?: boolean,\n ): Promise<boolean> {\n if (!Telemetry.appInsightsCore) {\n return true;\n }\n\n // Process the package name to comply with the backend requirements\n const packageName = nameUtils.isValidTelemetryPackageName(name)\n ? name\n : nameUtils.cleanTelemetryPackageName(name);\n\n if (forceRefresh === true || !Telemetry.versionsProp[packageName]) {\n const value = await getValue();\n if (value) {\n Telemetry.versionsProp[packageName] = value;\n return true;\n }\n }\n return false;\n }\n\n /** Populates the versions property of tools we care to track. */\n static async populateToolsVersions(refresh?: boolean) {\n await Telemetry.tryUpdateVersionsProp(\n 'node',\n versionUtils.getNodeVersion,\n refresh,\n );\n await Telemetry.tryUpdateVersionsProp(\n 'npm',\n versionUtils.getNpmVersion,\n refresh,\n );\n await Telemetry.tryUpdateVersionsProp(\n 'yarn',\n versionUtils.getYarnVersion,\n refresh,\n );\n await Telemetry.tryUpdateVersionsProp(\n 'VisualStudio',\n versionUtils.getVisualStudioVersion,\n refresh,\n );\n }\n\n /** Populates the versions property of npm packages we care to track. */\n static async populateNpmPackageVersions(refresh?: boolean) {\n for (const npmPackage of NpmPackagesWeTrack) {\n await Telemetry.tryUpdateVersionsProp(\n npmPackage,\n async () => await versionUtils.getVersionOfNpmPackage(npmPackage),\n refresh,\n );\n }\n }\n\n /** Populates the versions property of nuget packages we care to track. */\n static async populateNuGetPackageVersions(\n projectFile: string,\n refresh?: boolean,\n ) {\n const nugetVersions = await versionUtils.getVersionsOfNuGetPackages(\n projectFile,\n NuGetPackagesWeTrack,\n );\n\n for (const nugetPackage of NuGetPackagesWeTrack) {\n await Telemetry.tryUpdateVersionsProp(\n nugetPackage,\n async () => nugetVersions[nugetPackage],\n refresh,\n );\n }\n }\n\n static setProjectInfo(\n info: projectUtils.AppProjectInfo | projectUtils.DependencyProjectInfo,\n ) {\n if (!Telemetry.appInsightsCore) {\n return;\n }\n\n Telemetry.projectProp = info;\n }\n\n static startCommand(info: CommandStartInfo) {\n if (!Telemetry.appInsightsCore) {\n return;\n }\n\n // startCommand() was called before invoking endCommand(), bail out.\n if (Telemetry.commandInfo.startInfo) {\n return;\n }\n\n Telemetry.commandInfo.startTime = Date.now();\n Telemetry.commandInfo.startInfo = info;\n\n // Set common command props\n Telemetry.commonProperties.commandName = info.commandName;\n }\n\n static endCommand(info: CommandEndInfo, extraProps?: Record<string, any>) {\n if (!Telemetry.appInsightsCore) {\n return;\n }\n\n // startCommand() wasn't called, bail out.\n if (!Telemetry.commandInfo.startInfo) {\n return;\n }\n\n Telemetry.commandInfo.endTime = Date.now();\n Telemetry.commandInfo.endInfo = info;\n\n Telemetry.trackCommandEvent(extraProps);\n }\n\n private static trackEvent(telemetryItem: coreOneDS.ITelemetryItem) {\n // Populate Part A\n telemetryItem.ver = '4.0'; // Current Common Schema version\n telemetryItem.time = new Date().toISOString();\n telemetryItem.iKey = RNW_1DS_INSTRUMENTATION_KEY;\n\n // Populate Part A extensions\n telemetryItem.ext = {};\n telemetryItem.ext.device = {\n id: Telemetry.commonProperties.deviceId,\n deviceClass: Telemetry.commonProperties.deviceClass,\n };\n telemetryItem.ext.os = {\n locale: Telemetry.commonProperties.deviceLocale,\n ver: Telemetry.commonProperties.fullBuildInfo,\n };\n\n // Populate most of \"common\" properties into Part B.\n telemetryItem.baseData = {\n common: {\n device: {\n architecture: Telemetry.commonProperties.deviceArchitecture,\n numCPUs: Telemetry.commonProperties.numCPUs,\n totalMemory: Telemetry.commonProperties.totalMemory,\n diskFreeSpace: Telemetry.commonProperties.deviceDiskFreeSpace,\n },\n nodePlatform: Telemetry.commonProperties.nodePlatform,\n nodeArchitecture: Telemetry.commonProperties.nodeArchitecture,\n ciCaptured: Telemetry.commonProperties.ciCaptured,\n ciType: Telemetry.commonProperties.ciType,\n isMsftInternal: Telemetry.commonProperties.isMsftInternal,\n isCliTest: Telemetry.commonProperties.isTest,\n sessionId: Telemetry.commonProperties.sessionId,\n commandName: Telemetry.commonProperties.commandName,\n },\n // Set project and versions props, belonging to Part B.\n project: Telemetry.projectProp,\n versions: Telemetry.versionsProp,\n };\n\n // Send and post the telemetry event!\n Telemetry.appInsightsCore!.track(telemetryItem);\n Telemetry.appInsightsCore!.flush();\n }\n\n private static trackCommandEvent(extraProps?: Record<string, any>) {\n const telemetryItem: coreOneDS.ITelemetryItem = {name: CommandEventName};\n\n // This is logged in Part C.\n const command = {\n options: Telemetry.commandInfo.startInfo?.options,\n defaultOptions: Telemetry.commandInfo.startInfo?.defaultOptions,\n args: Telemetry.commandInfo.startInfo?.args,\n durationInSecs:\n (Telemetry.commandInfo.endTime! - Telemetry.commandInfo.startTime!) /\n 1000,\n resultCode: Telemetry.commandInfo.endInfo?.resultCode,\n };\n\n telemetryItem.data = {\n command: command,\n };\n\n if (extraProps) {\n telemetryItem.data.additionalData = extraProps;\n }\n\n // Populate common properties and fire event\n Telemetry.trackEvent(telemetryItem);\n }\n\n static trackException(error: Error, extraProps?: Record<string, any>) {\n if (!Telemetry.appInsightsCore) {\n return;\n }\n\n const telemetryItem: coreOneDS.ITelemetryItem = {name: CodedErrorEventName};\n\n // Save off CodedError info in Part C.\n const codedError =\n error instanceof errorUtils.CodedError\n ? (error as errorUtils.CodedError)\n : null;\n\n const codedErrorStruct = {\n type: codedError?.type ?? 'Unknown',\n data: codedError?.data ?? {},\n };\n\n // Copy msBuildErrorMessages into the codedError.data object\n if ((error as any).msBuildErrorMessages) {\n // Always grab MSBuild error codes if possible\n codedErrorStruct.data.msBuildErrors = (error as any).msBuildErrorMessages\n .map(errorUtils.tryGetErrorCode)\n .filter((msg: string | undefined) => msg);\n\n // Grab sanitized MSBuild error messages if we're preserving them\n if (Telemetry.options.preserveErrorMessages) {\n codedErrorStruct.data.msBuildErrorMessages = (\n error as any\n ).msBuildErrorMessages\n .map(errorUtils.sanitizeErrorMessage)\n .filter((msg: string) => msg);\n }\n }\n\n // Copy miscellaneous system error fields into the codedError.data object\n const syscallExceptionFieldsToCopy = ['errno', 'syscall', 'code'];\n for (const f of syscallExceptionFieldsToCopy) {\n if ((error as any)[f]) {\n codedErrorStruct.data[f] = (error as any)[f];\n }\n }\n\n // Scrub any potential PII present in codedError.data array, as long as the data is a string.\n codedErrorStruct.data = Telemetry.sanitizeAny(codedErrorStruct.data);\n\n // Break down TS Error object into Exception Data\n const exceptionData = Telemetry.convertErrorIntoExceptionData(error);\n\n telemetryItem.data = {\n codedError: codedErrorStruct,\n exceptionData: exceptionData,\n };\n\n Telemetry.trackEvent(telemetryItem);\n }\n\n static convertErrorIntoExceptionData(error: Error): Record<string, any> {\n const exceptionData = {\n hasFullStack: false,\n message: error.message,\n parsedStack: {},\n };\n\n exceptionData.message = exceptionData.message || '[None]';\n\n // CodedError has non-PII information in its 'type' member, plus optionally some more info in its 'data'.\n // The message may contain PII information. This can be sanitized, but for now delete it.\n if (Telemetry.options.preserveErrorMessages) {\n exceptionData.message = errorUtils.sanitizeErrorMessage(\n exceptionData.message,\n );\n } else {\n exceptionData.message = '[Removed]';\n }\n\n const lines = error.stack?.split('\\n');\n\n const parsedStack = lines?.slice(1).map(line => {\n const errorStackFrame: errorUtils.ErrorStackFrame = {};\n\n const match = line\n .trim()\n .match(/^\\s*at\\s+(?:(.*?)\\s+\\((.*):(\\d+):(\\d+)\\)|(.*):(\\d+):(\\d+))$/);\n if (match) {\n errorStackFrame.functionName = match[1] || 'N/A'; // Use a default value if no function name\n errorStackFrame.filePath = match[2] || match[5];\n errorStackFrame.lineNumber =\n parseInt(match[3], 10) || parseInt(match[6], 10);\n errorStackFrame.columnNumber =\n parseInt(match[4], 10) || parseInt(match[7], 10);\n }\n\n return errorStackFrame;\n });\n\n if (parsedStack) {\n parsedStack.filter(Boolean);\n\n // Sanitize parsed error stack frames\n for (const frame of parsedStack) {\n errorUtils.sanitizeErrorStackFrame(frame);\n }\n\n exceptionData.hasFullStack = true;\n exceptionData.parsedStack = parsedStack;\n }\n\n return exceptionData;\n }\n\n static sanitizeAny(data: any): any {\n if (Array.isArray(data)) {\n // This is an array, sanitize each element recursively.\n return data.map(item => Telemetry.sanitizeAny(item));\n } else if (typeof data === 'object' && data !== null) {\n // This is an object, sanitize each field recursively.\n const sanitizedObject: Record<string, any> = {};\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n sanitizedObject[key] = Telemetry.sanitizeAny(data[key]);\n }\n }\n return sanitizedObject;\n } else if (typeof data === 'string') {\n // The base case: this is a string, sanitize it.\n return errorUtils.sanitizeErrorMessage(data);\n }\n\n // Not a string, return the data unchanged.\n return data;\n }\n}\n"]}
@@ -51,8 +51,14 @@ test('nodeArchitecture() is valid', () => {
51
51
  expect(value).not.toBe('');
52
52
  expect(value).not.toBeNull();
53
53
  });
54
- test('devicePlatform() is valid', () => {
55
- const value = basePropUtils.devicePlatform();
54
+ test('deviceClass() is valid', () => {
55
+ const value = basePropUtils.deviceClass();
56
+ expect(value).toBeDefined();
57
+ expect(value).not.toBe('');
58
+ expect(value).not.toBeNull();
59
+ });
60
+ test('nodePlatform() is valid', () => {
61
+ const value = basePropUtils.nodePlatform();
56
62
  expect(value).toBeDefined();
57
63
  expect(value).not.toBe('');
58
64
  expect(value).not.toBeNull();
@@ -78,11 +84,6 @@ test('deviceDiskFreeSpace() is valid', () => {
78
84
  const value = basePropUtils.deviceDiskFreeSpace();
79
85
  expect(value).toBeGreaterThanOrEqual(0);
80
86
  });
81
- test('sampleRate() is within valid range', () => {
82
- const value = basePropUtils.sampleRate();
83
- expect(value).toBeGreaterThanOrEqual(0);
84
- expect(value).toBeLessThanOrEqual(100);
85
- });
86
87
  test('ciType() is valid', () => {
87
88
  const value = basePropUtils.ciType();
88
89
  expect(value).toBeDefined();
@@ -135,4 +136,10 @@ test('getSessionId() is a guid', () => {
135
136
  test('getSessionId() does not change', () => {
136
137
  expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());
137
138
  });
139
+ test('fullBuildInfo() is valid', () => {
140
+ const value = basePropUtils.fullBuildInfo();
141
+ expect(value).toBeDefined();
142
+ expect(value).not.toBe('');
143
+ expect(value).not.toBeNull();
144
+ });
138
145
  //# sourceMappingURL=basePropUtils.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"basePropUtils.test.js","sourceRoot":"","sources":["../../src/test/basePropUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sEAAwD;AAExD,IAAI,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACrC,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;IAC5C,MAAM,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC9E,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;IACzC,MAAM,KAAK,GAAG,aAAa,CAAC,kBAAkB,EAAE,CAAC;IACjD,MAAM,CAAC,KAAK,CAA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AI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC5D,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAChC,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACnC,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACpC,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAE/B,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as basePropUtils from '../utils/basePropUtils';\n\ntest('deviceId() is valid', async () => {\n const value = await basePropUtils.deviceId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceId() does not change', async () => {\n expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());\n});\n\ntest('deviceArchitecture() is valid', () => {\n const value = basePropUtils.deviceArchitecture();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('nodeArchitecture() is valid', () => {\n const value = basePropUtils.nodeArchitecture();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('devicePlatform() is valid', () => {\n const value = basePropUtils.devicePlatform();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() is valid', async () => {\n const value = await basePropUtils.deviceLocale();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() does not change', async () => {\n expect(await basePropUtils.deviceLocale()).toBe(\n await basePropUtils.deviceLocale(),\n );\n});\n\ntest('deviceNumCPUs() is valid', () => {\n const value = basePropUtils.deviceNumCPUs();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceTotalMemory() is valid', () => {\n const value = basePropUtils.deviceTotalMemory();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceDiskFreeSpace() is valid', () => {\n const value = basePropUtils.deviceDiskFreeSpace();\n expect(value).toBeGreaterThanOrEqual(0);\n});\n\ntest('sampleRate() is within valid range', () => {\n const value = basePropUtils.sampleRate();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThanOrEqual(100);\n});\n\ntest('ciType() is valid', () => {\n const value = basePropUtils.ciType();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('ciType() is None when not in CI', () => {\n if (basePropUtils.isCI()) {\n expect(basePropUtils.ciType()).not.toBe('None');\n } else {\n expect(basePropUtils.ciType()).toBe('None');\n }\n});\n\ntest('isMsftInternal() is false with no domain', () => {\n delete process.env.UserDNSDomain;\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is false with example.com domain', () => {\n process.env.UserDNSDomain = 'example.com';\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is true with Msft domain', () => {\n process.env.UserDNSDomain = 'test.corp.microsoft.com';\n expect(basePropUtils.isMsftInternal()).toBe(true);\n});\n\ntest('isCliTest() is true if RNW_CLI_TEST env variable is set', () => {\n process.env.RNW_CLI_TEST = 'true';\n expect(basePropUtils.isCliTest()).toBe(true);\n});\n\ntest('isCliTest() is false if no RNW_CLI_TEST variable', () => {\n delete process.env.RNW_CLI_TEST;\n expect(basePropUtils.isCliTest()).toBe(false);\n});\n\ntest('getSessionId() is valid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n expect(value).toHaveLength(32);\n});\n\ntest('getSessionId() is a guid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toHaveLength(32);\n\n const parseGuid = () => {\n parseInt(value, 16);\n };\n\n expect(parseGuid).not.toThrow();\n});\n\ntest('getSessionId() does not change', () => {\n expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());\n});\n"]}
1
+ {"version":3,"file":"basePropUtils.test.js","sourceRoot":"","sources":["../../src/test/basePropUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sEAAwD;AAExD,IAAI,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACrC,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAA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MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACpC,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as basePropUtils from '../utils/basePropUtils';\n\ntest('deviceId() is valid', async () => {\n const value = await basePropUtils.deviceId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceId() does not change', async () => {\n expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());\n});\n\ntest('deviceArchitecture() is valid', () => {\n const value = basePropUtils.deviceArchitecture();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('nodeArchitecture() is valid', () => {\n const value = basePropUtils.nodeArchitecture();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceClass() is valid', () => {\n const value = basePropUtils.deviceClass();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('nodePlatform() is valid', () => {\n const value = basePropUtils.nodePlatform();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() is valid', async () => {\n const value = await basePropUtils.deviceLocale();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() does not change', async () => {\n expect(await basePropUtils.deviceLocale()).toBe(\n await basePropUtils.deviceLocale(),\n );\n});\n\ntest('deviceNumCPUs() is valid', () => {\n const value = basePropUtils.deviceNumCPUs();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceTotalMemory() is valid', () => {\n const value = basePropUtils.deviceTotalMemory();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceDiskFreeSpace() is valid', () => {\n const value = basePropUtils.deviceDiskFreeSpace();\n expect(value).toBeGreaterThanOrEqual(0);\n});\n\ntest('ciType() is valid', () => {\n const value = basePropUtils.ciType();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('ciType() is None when not in CI', () => {\n if (basePropUtils.isCI()) {\n expect(basePropUtils.ciType()).not.toBe('None');\n } else {\n expect(basePropUtils.ciType()).toBe('None');\n }\n});\n\ntest('isMsftInternal() is false with no domain', () => {\n delete process.env.UserDNSDomain;\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is false with example.com domain', () => {\n process.env.UserDNSDomain = 'example.com';\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is true with Msft domain', () => {\n process.env.UserDNSDomain = 'test.corp.microsoft.com';\n expect(basePropUtils.isMsftInternal()).toBe(true);\n});\n\ntest('isCliTest() is true if RNW_CLI_TEST env variable is set', () => {\n process.env.RNW_CLI_TEST = 'true';\n expect(basePropUtils.isCliTest()).toBe(true);\n});\n\ntest('isCliTest() is false if no RNW_CLI_TEST variable', () => {\n delete process.env.RNW_CLI_TEST;\n expect(basePropUtils.isCliTest()).toBe(false);\n});\n\ntest('getSessionId() is valid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n expect(value).toHaveLength(32);\n});\n\ntest('getSessionId() is a guid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toHaveLength(32);\n\n const parseGuid = () => {\n parseInt(value, 16);\n };\n\n expect(parseGuid).not.toThrow();\n});\n\ntest('getSessionId() does not change', () => {\n expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());\n});\n\ntest('fullBuildInfo() is valid', () => {\n const value = basePropUtils.fullBuildInfo();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n"]}
@@ -113,54 +113,48 @@ test('sanitizeErrorMessage() with standard MSBuild error', () => {
113
113
  expect(errorUtils.sanitizeErrorMessage(`2:6>C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\XamlCompiler\\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The "CompileXaml" task returned false but did not log an error. [${process.cwd()}\\windows\\teltest68\\teltest68.csproj]`)).toEqual(`[path](486,5): error MSB4181: The CompileXaml task returned false but did not log an error. [windows]\\???.csproj(${'teltest68\\teltest68.csproj'.length})`);
114
114
  });
115
115
  test('sanitizeErrorStackFrame() with empty frame', () => {
116
- const emptyFrame = {
117
- level: 0,
118
- method: '',
119
- fileName: '',
120
- assembly: 'asdf',
121
- line: 0,
116
+ const stackFrame = {
117
+ functionName: '',
118
+ filePath: '',
119
+ lineNumber: 0,
120
+ columnNumber: 0,
122
121
  };
123
- errorUtils.sanitizeErrorStackFrame(emptyFrame);
124
- expect(emptyFrame).toEqual({
125
- level: 0,
126
- assembly: '',
127
- fileName: '[path]',
128
- method: '',
129
- line: 0,
122
+ errorUtils.sanitizeErrorStackFrame(stackFrame);
123
+ expect(stackFrame).toEqual({
124
+ functionName: '',
125
+ filePath: '[path]',
126
+ lineNumber: 0,
127
+ columnNumber: 0,
130
128
  });
131
129
  });
132
130
  test('sanitizeErrorStackFrame() with assembly name', () => {
133
- const frame1 = {
134
- method: '',
135
- fileName: `${process.cwd()}\\foo.js`,
136
- assembly: 'asdf',
137
- level: 0,
138
- line: 0,
131
+ const stackFrame = {
132
+ functionName: '',
133
+ filePath: `${process.cwd()}\\foo.js`,
134
+ lineNumber: 10,
135
+ columnNumber: 14,
139
136
  };
140
- errorUtils.sanitizeErrorStackFrame(frame1);
141
- expect(frame1).toEqual({
142
- assembly: '',
143
- fileName: '[project_dir]\\???.js(6)',
144
- method: '',
145
- level: 0,
146
- line: 0,
137
+ errorUtils.sanitizeErrorStackFrame(stackFrame);
138
+ expect(stackFrame).toEqual({
139
+ functionName: '',
140
+ filePath: '[project_dir]\\???.js(6)',
141
+ lineNumber: 10,
142
+ columnNumber: 14,
147
143
  });
148
144
  });
149
145
  test('sanitizeErrorStackFrame() with method name', () => {
150
- const frame2 = {
151
- method: `myMethod (something ${process.cwd()}`,
152
- fileName: `${process.cwd()}\\telemetry\\foo.js`,
153
- assembly: 'asdf',
154
- level: 1,
155
- line: 42,
146
+ const stackFrame = {
147
+ functionName: `myMethod (something ${process.cwd()}`,
148
+ filePath: `${process.cwd()}\\telemetry\\foo.js`,
149
+ lineNumber: 10,
150
+ columnNumber: 14,
156
151
  };
157
- errorUtils.sanitizeErrorStackFrame(frame2);
158
- expect(frame2).toEqual({
159
- assembly: '',
160
- fileName: '[project_dir]\\???.js(16)',
161
- method: 'myMethod',
162
- level: 1,
163
- line: 42,
152
+ errorUtils.sanitizeErrorStackFrame(stackFrame);
153
+ expect(stackFrame).toEqual({
154
+ functionName: 'myMethod',
155
+ filePath: '[project_dir]\\???.js(16)',
156
+ lineNumber: 10,
157
+ columnNumber: 14,
164
158
  });
165
159
  });
166
160
  //# sourceMappingURL=errorUtils.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.test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CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACtD,MAAM,MAAM,GAAqC;QAC/C,MAAM,EAAE,uBAAuB,OAAO,CAAC,GAAG,EAAE,EAAE;QAC9C,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,qBAAqB;QAC/C,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,EAAE;KACT,CAAC;IACF,UAAU,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QACrB,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,2BAA2B;QACrC,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\n\nimport * as errorUtils from '../utils/errorUtils';\n\ntest('tryGetErrorCode() with valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar error FOO2020: the thing')).toBe(\n 'FOO2020',\n );\n});\n\ntest('tryGetErrorCode() without valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar the thing')).toBeUndefined();\n});\n\ntest('tryGetErrorCode() with word error but no code', () => {\n expect(errorUtils.tryGetErrorCode('test error')).toBeUndefined();\n});\n\ntest('sanitizeErrorMessage() no-op on empty string', () => {\n expect(errorUtils.sanitizeErrorMessage('')).toBe('');\n});\n\ntest('sanitizeErrorMessage() no-op on test string', () => {\n expect(errorUtils.sanitizeErrorMessage('some text')).toBe('some text');\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is the cwd: '${process.cwd()}'`),\n ).toBe(`this is the cwd: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}'`,\n ),\n ).toBe(`uppercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}'`,\n ),\n ).toBe(`lowercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}' and something else`,\n ),\n ).toBe(`this is the cwd: [project_dir] and something else`);\n});\n\ntest('sanitizeErrorMessage() project_dir and something else', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()} and something else`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${' and something else'.length})`,\n );\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules'`,\n ),\n ).toBe(`this is the cwd: [project_dir]\\\\???(${'node_modules'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules\\\\foo'`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`uppercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`lowercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `trailing: '${process.cwd()}\\\\node_modules\\\\' and something else`,\n ),\n ).toBe(`trailing: [node_modules]\\\\???(0) and something else`);\n});\n\ntest('sanitizeErrorMessage() node_modules and something else that could be part of the path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules and something else that could be part of the path`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${\n 'node_modules and something else that could be part of the path'.length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() \\\\node_modules\\\\ a file under nm', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules\\\\ a file under nm`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${' a file under nm'.length})`);\n});\n\ntest('sanitizeErrorMessage() other path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is another path: A:\\\\foo\\\\bar\\\\baz`),\n ).toBe(`this is another path: [path]`);\n});\n\ntest(\"sanitizeErrorMessage() 'other path'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is another path: 'A:\\\\foo\\\\bar\\\\baz'`,\n ),\n ).toBe(`this is another path: [path]`);\n});\n\ntest('sanitizeErrorMessage() tracked packages in the npx cache', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `Cannot find module 'react-native/package.json'\n Require stack:\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\bin.js`,\n ),\n ).toBe(`Cannot find module react-native/package.json\n Require stack:\n - [node_modules]\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - [node_modules]\\\\react-native-windows-init\\\\bin.js`);\n});\n\ntest('sanitizeErrorMessage() forward slashes', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `EPERM: operation not permitted, scandir ${process.env.UserProfile!.replace(\n /\\\\/g,\n '/',\n )}/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include`,\n ),\n ).toBe(\n `EPERM: operation not permitted, scandir [UserProfile]\\\\???(${\n '/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include'\n .length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() file share path', () => {\n expect(errorUtils.sanitizeErrorMessage(`file here: \\\\\\\\server\\\\share`)).toBe(\n 'file here: [path]',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu id', () => {\n expect(errorUtils.sanitizeErrorMessage('5>This is an error')).toBe(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu/thread id', () => {\n expect(errorUtils.sanitizeErrorMessage('5:42>This is an error')).toEqual(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with standard MSBuild error', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `2:6>C:\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\bin\\\\10.0.22621.0\\\\XamlCompiler\\\\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The \"CompileXaml\" task returned false but did not log an error. [${process.cwd()}\\\\windows\\\\teltest68\\\\teltest68.csproj]`,\n ),\n ).toEqual(\n `[path](486,5): error MSB4181: The CompileXaml task returned false but did not log an error. [windows]\\\\???.csproj(${\n 'teltest68\\\\teltest68.csproj'.length\n })`,\n );\n});\n\ntest('sanitizeErrorStackFrame() with empty frame', () => {\n const emptyFrame: appInsights.Contracts.StackFrame = {\n level: 0,\n method: '',\n fileName: '',\n assembly: 'asdf',\n line: 0,\n };\n errorUtils.sanitizeErrorStackFrame(emptyFrame);\n expect(emptyFrame).toEqual({\n level: 0,\n assembly: '',\n fileName: '[path]',\n method: '',\n line: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with assembly name', () => {\n const frame1: appInsights.Contracts.StackFrame = {\n method: '',\n fileName: `${process.cwd()}\\\\foo.js`,\n assembly: 'asdf',\n level: 0,\n line: 0,\n };\n errorUtils.sanitizeErrorStackFrame(frame1);\n expect(frame1).toEqual({\n assembly: '',\n fileName: '[project_dir]\\\\???.js(6)',\n method: '',\n level: 0,\n line: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with method name', () => {\n const frame2: appInsights.Contracts.StackFrame = {\n method: `myMethod (something ${process.cwd()}`,\n fileName: `${process.cwd()}\\\\telemetry\\\\foo.js`,\n assembly: 'asdf',\n level: 1,\n line: 42,\n };\n errorUtils.sanitizeErrorStackFrame(frame2);\n expect(frame2).toEqual({\n assembly: '',\n fileName: '[project_dir]\\\\???.js(16)',\n method: 'myMethod',\n level: 1,\n line: 42,\n });\n});\n"]}
1
+ {"version":3,"file":"errorUtils.test.js","sourceRoot":"","sources":["../../src/test/errorUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gEAAkD;AAElD,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACnD,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,kCAAkC,CAAC,CAAC,CAAC,IAAI,CACzE,SAAS,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACtD,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACzD,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;AACnE,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC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;QAClB,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;KAChB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;IACxD,MAAM,UAAU,GAAG;QACjB,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU;QACpC,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,EAAE;KACjB,CAAC;IACF,UAAU,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACzB,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,0BAA0B;QACpC,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACtD,MAAM,UAAU,GAAG;QACjB,YAAY,EAAE,uBAAuB,OAAO,CAAC,GAAG,EAAE,EAAE;QACpD,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,qBAAqB;QAC/C,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,EAAE;KACjB,CAAC;IACF,UAAU,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACzB,YAAY,EAAE,UAAU;QACxB,QAAQ,EAAE,2BAA2B;QACrC,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as errorUtils from '../utils/errorUtils';\n\ntest('tryGetErrorCode() with valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar error FOO2020: the thing')).toBe(\n 'FOO2020',\n );\n});\n\ntest('tryGetErrorCode() without valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar the thing')).toBeUndefined();\n});\n\ntest('tryGetErrorCode() with word error but no code', () => {\n expect(errorUtils.tryGetErrorCode('test error')).toBeUndefined();\n});\n\ntest('sanitizeErrorMessage() no-op on empty string', () => {\n expect(errorUtils.sanitizeErrorMessage('')).toBe('');\n});\n\ntest('sanitizeErrorMessage() no-op on test string', () => {\n expect(errorUtils.sanitizeErrorMessage('some text')).toBe('some text');\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is the cwd: '${process.cwd()}'`),\n ).toBe(`this is the cwd: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}'`,\n ),\n ).toBe(`uppercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}'`,\n ),\n ).toBe(`lowercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}' and something else`,\n ),\n ).toBe(`this is the cwd: [project_dir] and something else`);\n});\n\ntest('sanitizeErrorMessage() project_dir and something else', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()} and something else`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${' and something else'.length})`,\n );\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules'`,\n ),\n ).toBe(`this is the cwd: [project_dir]\\\\???(${'node_modules'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules\\\\foo'`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`uppercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`lowercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `trailing: '${process.cwd()}\\\\node_modules\\\\' and something else`,\n ),\n ).toBe(`trailing: [node_modules]\\\\???(0) and something else`);\n});\n\ntest('sanitizeErrorMessage() node_modules and something else that could be part of the path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules and something else that could be part of the path`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${\n 'node_modules and something else that could be part of the path'.length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() \\\\node_modules\\\\ a file under nm', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules\\\\ a file under nm`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${' a file under nm'.length})`);\n});\n\ntest('sanitizeErrorMessage() other path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is another path: A:\\\\foo\\\\bar\\\\baz`),\n ).toBe(`this is another path: [path]`);\n});\n\ntest(\"sanitizeErrorMessage() 'other path'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is another path: 'A:\\\\foo\\\\bar\\\\baz'`,\n ),\n ).toBe(`this is another path: [path]`);\n});\n\ntest('sanitizeErrorMessage() tracked packages in the npx cache', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `Cannot find module 'react-native/package.json'\n Require stack:\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\bin.js`,\n ),\n ).toBe(`Cannot find module react-native/package.json\n Require stack:\n - [node_modules]\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - [node_modules]\\\\react-native-windows-init\\\\bin.js`);\n});\n\ntest('sanitizeErrorMessage() forward slashes', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `EPERM: operation not permitted, scandir ${process.env.UserProfile!.replace(\n /\\\\/g,\n '/',\n )}/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include`,\n ),\n ).toBe(\n `EPERM: operation not permitted, scandir [UserProfile]\\\\???(${\n '/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include'\n .length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() file share path', () => {\n expect(errorUtils.sanitizeErrorMessage(`file here: \\\\\\\\server\\\\share`)).toBe(\n 'file here: [path]',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu id', () => {\n expect(errorUtils.sanitizeErrorMessage('5>This is an error')).toBe(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu/thread id', () => {\n expect(errorUtils.sanitizeErrorMessage('5:42>This is an error')).toEqual(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with standard MSBuild error', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `2:6>C:\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\bin\\\\10.0.22621.0\\\\XamlCompiler\\\\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The \"CompileXaml\" task returned false but did not log an error. [${process.cwd()}\\\\windows\\\\teltest68\\\\teltest68.csproj]`,\n ),\n ).toEqual(\n `[path](486,5): error MSB4181: The CompileXaml task returned false but did not log an error. [windows]\\\\???.csproj(${\n 'teltest68\\\\teltest68.csproj'.length\n })`,\n );\n});\n\ntest('sanitizeErrorStackFrame() with empty frame', () => {\n const stackFrame = {\n functionName: '',\n filePath: '',\n lineNumber: 0,\n columnNumber: 0,\n };\n errorUtils.sanitizeErrorStackFrame(stackFrame);\n expect(stackFrame).toEqual({\n functionName: '',\n filePath: '[path]',\n lineNumber: 0,\n columnNumber: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with assembly name', () => {\n const stackFrame = {\n functionName: '',\n filePath: `${process.cwd()}\\\\foo.js`,\n lineNumber: 10,\n columnNumber: 14,\n };\n errorUtils.sanitizeErrorStackFrame(stackFrame);\n expect(stackFrame).toEqual({\n functionName: '',\n filePath: '[project_dir]\\\\???.js(6)',\n lineNumber: 10,\n columnNumber: 14,\n });\n});\n\ntest('sanitizeErrorStackFrame() with method name', () => {\n const stackFrame = {\n functionName: `myMethod (something ${process.cwd()}`,\n filePath: `${process.cwd()}\\\\telemetry\\\\foo.js`,\n lineNumber: 10,\n columnNumber: 14,\n };\n errorUtils.sanitizeErrorStackFrame(stackFrame);\n expect(stackFrame).toEqual({\n functionName: 'myMethod',\n filePath: '[project_dir]\\\\???.js(16)',\n lineNumber: 10,\n columnNumber: 14,\n });\n});\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ * Licensed under the MIT License.
5
+ *
6
+ * @format
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ const nameUtils = __importStar(require("../utils/nameUtils"));
33
+ test('Verify telemetry package name is valid', () => {
34
+ expect(nameUtils.isValidTelemetryPackageName('package')).toBe(true);
35
+ expect(nameUtils.isValidTelemetryPackageName('@react')).toBe(false);
36
+ expect(nameUtils.isValidTelemetryPackageName('react-native')).toBe(false);
37
+ expect(nameUtils.isValidTelemetryPackageName('react_native')).toBe(true);
38
+ expect(nameUtils.isValidTelemetryPackageName('react_native/cli')).toBe(false);
39
+ // Check for size limits. A valid package name has 100 characters or less.
40
+ expect(nameUtils.isValidTelemetryPackageName('react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat')).toBe(true);
41
+ expect(nameUtils.isValidTelemetryPackageName('react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nati')).toBe(false);
42
+ });
43
+ test('Verify telemetry package name cleaning', () => {
44
+ expect(nameUtils.cleanTelemetryPackageName('package')).toBe('package');
45
+ expect(nameUtils.cleanTelemetryPackageName('@react')).toBe('_react');
46
+ expect(nameUtils.cleanTelemetryPackageName('react-native')).toBe('react_native');
47
+ expect(nameUtils.cleanTelemetryPackageName('react_native')).toBe('react_native');
48
+ expect(nameUtils.cleanTelemetryPackageName('react_native/cli')).toBe('react_native_cli');
49
+ expect(nameUtils.cleanTelemetryPackageName('@react-native-windows/cli')).toBe('_react_native_windows_cli');
50
+ expect(nameUtils.cleanTelemetryPackageName('react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat')).toBe('react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat');
51
+ // Truncate a package name with 101 characters, to the first 100.
52
+ expect(nameUtils.cleanTelemetryPackageName('react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nati')).toBe('react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat');
53
+ });
54
+ //# sourceMappingURL=nameUtils.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nameUtils.test.js","sourceRoot":"","sources":["../../src/test/nameUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8DAAgD;AAEhD,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;IAClD,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE9E,0EAA0E;IAC1E,MAAM,CACJ,SAAS,CAAC,2BAA2B,CACnC,sGAAsG,CACvG,CACF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,CACJ,SAAS,CAAC,2BAA2B,CACnC,uGAAuG,CACxG,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;IAClD,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrE,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAC9D,cAAc,CACf,CAAC;IACF,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAC9D,cAAc,CACf,CAAC;IACF,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAClE,kBAAkB,CACnB,CAAC;IACF,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAC3E,2BAA2B,CAC5B,CAAC;IAEF,MAAM,CACJ,SAAS,CAAC,yBAAyB,CACjC,sGAAsG,CACvG,CACF,CAAC,IAAI,CACJ,sGAAsG,CACvG,CAAC;IAEF,iEAAiE;IACjE,MAAM,CACJ,SAAS,CAAC,yBAAyB,CACjC,uGAAuG,CACxG,CACF,CAAC,IAAI,CACJ,sGAAsG,CACvG,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as nameUtils from '../utils/nameUtils';\n\ntest('Verify telemetry package name is valid', () => {\n expect(nameUtils.isValidTelemetryPackageName('package')).toBe(true);\n expect(nameUtils.isValidTelemetryPackageName('@react')).toBe(false);\n expect(nameUtils.isValidTelemetryPackageName('react-native')).toBe(false);\n expect(nameUtils.isValidTelemetryPackageName('react_native')).toBe(true);\n expect(nameUtils.isValidTelemetryPackageName('react_native/cli')).toBe(false);\n\n // Check for size limits. A valid package name has 100 characters or less.\n expect(\n nameUtils.isValidTelemetryPackageName(\n 'react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat',\n ),\n ).toBe(true);\n expect(\n nameUtils.isValidTelemetryPackageName(\n 'react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nati',\n ),\n ).toBe(false);\n});\n\ntest('Verify telemetry package name cleaning', () => {\n expect(nameUtils.cleanTelemetryPackageName('package')).toBe('package');\n expect(nameUtils.cleanTelemetryPackageName('@react')).toBe('_react');\n expect(nameUtils.cleanTelemetryPackageName('react-native')).toBe(\n 'react_native',\n );\n expect(nameUtils.cleanTelemetryPackageName('react_native')).toBe(\n 'react_native',\n );\n expect(nameUtils.cleanTelemetryPackageName('react_native/cli')).toBe(\n 'react_native_cli',\n );\n expect(nameUtils.cleanTelemetryPackageName('@react-native-windows/cli')).toBe(\n '_react_native_windows_cli',\n );\n\n expect(\n nameUtils.cleanTelemetryPackageName(\n 'react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat',\n ),\n ).toBe(\n 'react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat',\n );\n\n // Truncate a package name with 101 characters, to the first 100.\n expect(\n nameUtils.cleanTelemetryPackageName(\n 'react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nati',\n ),\n ).toBe(\n 'react_native_react_native_react_native_react_native_react_native_react_native_react_native_react_nat',\n );\n});\n"]}
@@ -3,11 +3,22 @@
3
3
  * Licensed under the MIT License.
4
4
  * @format
5
5
  */
6
+ /**
7
+ * Given a path and a key, retrieves the value from the Registry.
8
+ * @returns If the path and key exist, the requested value from the Registry; empty string otherwise.
9
+ */
10
+ export declare function getValueFromRegistry(path: string, key: string): Promise<string>;
6
11
  /**
7
12
  * Gets a telemetry-safe stable device ID.
8
13
  * @returns A telemetry-safe stable device ID.
9
14
  */
10
15
  export declare function deviceId(): Promise<string>;
16
+ /**
17
+ * Gets the Windows build name, number and architecture.
18
+ * @returns A string containing the Windows build name, number and architecture.
19
+ * e.g. 19569.1000.amd64fre.rs_prerelease.200214-1419
20
+ */
21
+ export declare function fullBuildInfo(): Promise<string>;
11
22
  /**
12
23
  * Gets the device architecture, like x86/x64/arm64.
13
24
  * @returns The device architecture.
@@ -19,10 +30,15 @@ export declare function deviceArchitecture(): string;
19
30
  */
20
31
  export declare function nodeArchitecture(): string;
21
32
  /**
22
- * Gets the device platform, like darwin/linux/win32.
33
+ * Gets the node platform, like darwin/linux/win32.
23
34
  * @returns The device platform.
24
35
  */
25
- export declare function devicePlatform(): string;
36
+ export declare function nodePlatform(): string;
37
+ /**
38
+ * Gets the OS name, to be filled in the PartA device.deviceClass field.
39
+ * @returns The device class.
40
+ */
41
+ export declare function deviceClass(): string;
26
42
  /**
27
43
  * Gets the device locale.
28
44
  * @returns The device locale.
@@ -44,11 +60,6 @@ export declare function deviceTotalMemory(): number;
44
60
  * @returns The free space of the give drive in bytes.
45
61
  */
46
62
  export declare function deviceDiskFreeSpace(drivePath?: string | null): number;
47
- /**
48
- * Gets the telemetry sample rate.
49
- * @returns The telemetry sample rate.
50
- */
51
- export declare function sampleRate(): number;
52
63
  /**
53
64
  * Gets whether or not telemetry events are captured when running in CI.
54
65
  * @returns Whether or not telemetry events are captured when running in CI.