@react-native-windows/telemetry 0.73.1 → 0.74.0-preview.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.
- package/lib-commonjs/e2etest/telemetry.test.d.ts +28 -28
- package/lib-commonjs/e2etest/telemetry.test.js +496 -496
- package/lib-commonjs/index.d.ts +11 -11
- package/lib-commonjs/index.js +26 -26
- package/lib-commonjs/telemetry.d.ts +84 -84
- package/lib-commonjs/telemetry.js +370 -370
- package/lib-commonjs/telemetry.js.map +1 -1
- package/lib-commonjs/test/basePropUtils.test.d.ts +7 -7
- package/lib-commonjs/test/basePropUtils.test.js +137 -137
- package/lib-commonjs/test/errorUtils.test.d.ts +7 -7
- package/lib-commonjs/test/errorUtils.test.js +159 -159
- package/lib-commonjs/test/projectUtils.test.d.ts +7 -7
- package/lib-commonjs/test/projectUtils.test.js +87 -87
- package/lib-commonjs/test/sanitizeUtils.test.d.ts +7 -7
- package/lib-commonjs/test/sanitizeUtils.test.js +97 -97
- package/lib-commonjs/test/versionUtils.test.d.ts +7 -7
- package/lib-commonjs/test/versionUtils.test.js +114 -114
- package/lib-commonjs/utils/basePropUtils.d.ts +81 -81
- package/lib-commonjs/utils/basePropUtils.js +173 -173
- package/lib-commonjs/utils/errorUtils.d.ts +87 -87
- package/lib-commonjs/utils/errorUtils.js +178 -178
- package/lib-commonjs/utils/optionUtils.d.ts +45 -45
- package/lib-commonjs/utils/optionUtils.js +95 -95
- package/lib-commonjs/utils/projectUtils.d.ts +50 -50
- package/lib-commonjs/utils/projectUtils.js +186 -186
- package/lib-commonjs/utils/sanitizeUtils.d.ts +12 -12
- package/lib-commonjs/utils/sanitizeUtils.js +81 -81
- package/lib-commonjs/utils/versionUtils.d.ts +38 -38
- package/lib-commonjs/utils/versionUtils.js +155 -155
- package/package.json +14 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":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ZH,8BA2ZC;AA1ZkB,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","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,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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S,EAAE,MAAM,CAAC,CAAC;QAClE,KAAK,MAAM,CAAC,IAAI,4BAA4B,EAAE;YAC5C,IAAK,KAAa,CAAC,CAAC,CAAC,EAAE;gBACrB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,GAAI,KAAa,CAAC,CAAC,CAAC,CAAC;aAC9C;SACF;QAED,6BAA6B;QAC7B,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC;QACtC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,YAAY,CAAC;QAExC,kBAAkB;QAClB,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,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,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
@@ -1,138 +1,138 @@
|
|
|
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 basePropUtils = __importStar(require("../utils/basePropUtils"));
|
|
33
|
-
test('deviceId() is valid', async () => {
|
|
34
|
-
const value = await basePropUtils.deviceId();
|
|
35
|
-
expect(value).toBeDefined();
|
|
36
|
-
expect(value).not.toBe('');
|
|
37
|
-
expect(value).not.toBeNull();
|
|
38
|
-
});
|
|
39
|
-
test('deviceId() does not change', async () => {
|
|
40
|
-
expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());
|
|
41
|
-
});
|
|
42
|
-
test('deviceArchitecture() is valid', () => {
|
|
43
|
-
const value = basePropUtils.deviceArchitecture();
|
|
44
|
-
expect(value).toBeDefined();
|
|
45
|
-
expect(value).not.toBe('');
|
|
46
|
-
expect(value).not.toBeNull();
|
|
47
|
-
});
|
|
48
|
-
test('nodeArchitecture() is valid', () => {
|
|
49
|
-
const value = basePropUtils.nodeArchitecture();
|
|
50
|
-
expect(value).toBeDefined();
|
|
51
|
-
expect(value).not.toBe('');
|
|
52
|
-
expect(value).not.toBeNull();
|
|
53
|
-
});
|
|
54
|
-
test('devicePlatform() is valid', () => {
|
|
55
|
-
const value = basePropUtils.devicePlatform();
|
|
56
|
-
expect(value).toBeDefined();
|
|
57
|
-
expect(value).not.toBe('');
|
|
58
|
-
expect(value).not.toBeNull();
|
|
59
|
-
});
|
|
60
|
-
test('deviceLocale() is valid', async () => {
|
|
61
|
-
const value = await basePropUtils.deviceLocale();
|
|
62
|
-
expect(value).toBeDefined();
|
|
63
|
-
expect(value).not.toBe('');
|
|
64
|
-
expect(value).not.toBeNull();
|
|
65
|
-
});
|
|
66
|
-
test('deviceLocale() does not change', async () => {
|
|
67
|
-
expect(await basePropUtils.deviceLocale()).toBe(await basePropUtils.deviceLocale());
|
|
68
|
-
});
|
|
69
|
-
test('deviceNumCPUs() is valid', () => {
|
|
70
|
-
const value = basePropUtils.deviceNumCPUs();
|
|
71
|
-
expect(value).toBeGreaterThan(0);
|
|
72
|
-
});
|
|
73
|
-
test('deviceTotalMemory() is valid', () => {
|
|
74
|
-
const value = basePropUtils.deviceTotalMemory();
|
|
75
|
-
expect(value).toBeGreaterThan(0);
|
|
76
|
-
});
|
|
77
|
-
test('deviceDiskFreeSpace() is valid', () => {
|
|
78
|
-
const value = basePropUtils.deviceDiskFreeSpace();
|
|
79
|
-
expect(value).toBeGreaterThanOrEqual(0);
|
|
80
|
-
});
|
|
81
|
-
test('sampleRate() is within valid range', () => {
|
|
82
|
-
const value = basePropUtils.sampleRate();
|
|
83
|
-
expect(value).toBeGreaterThanOrEqual(0);
|
|
84
|
-
expect(value).toBeLessThanOrEqual(100);
|
|
85
|
-
});
|
|
86
|
-
test('ciType() is valid', () => {
|
|
87
|
-
const value = basePropUtils.ciType();
|
|
88
|
-
expect(value).toBeDefined();
|
|
89
|
-
expect(value).not.toBe('');
|
|
90
|
-
expect(value).not.toBeNull();
|
|
91
|
-
});
|
|
92
|
-
test('ciType() is None when not in CI', () => {
|
|
93
|
-
if (basePropUtils.isCI()) {
|
|
94
|
-
expect(basePropUtils.ciType()).not.toBe('None');
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
expect(basePropUtils.ciType()).toBe('None');
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
test('isMsftInternal() is false with no domain', () => {
|
|
101
|
-
delete process.env.UserDNSDomain;
|
|
102
|
-
expect(basePropUtils.isMsftInternal()).toBe(false);
|
|
103
|
-
});
|
|
104
|
-
test('isMsftInternal() is false with example.com domain', () => {
|
|
105
|
-
process.env.UserDNSDomain = 'example.com';
|
|
106
|
-
expect(basePropUtils.isMsftInternal()).toBe(false);
|
|
107
|
-
});
|
|
108
|
-
test('isMsftInternal() is true with Msft domain', () => {
|
|
109
|
-
process.env.UserDNSDomain = 'test.corp.microsoft.com';
|
|
110
|
-
expect(basePropUtils.isMsftInternal()).toBe(true);
|
|
111
|
-
});
|
|
112
|
-
test('isCliTest() is true if RNW_CLI_TEST env variable is set', () => {
|
|
113
|
-
process.env.RNW_CLI_TEST = 'true';
|
|
114
|
-
expect(basePropUtils.isCliTest()).toBe(true);
|
|
115
|
-
});
|
|
116
|
-
test('isCliTest() is false if no RNW_CLI_TEST variable', () => {
|
|
117
|
-
delete process.env.RNW_CLI_TEST;
|
|
118
|
-
expect(basePropUtils.isCliTest()).toBe(false);
|
|
119
|
-
});
|
|
120
|
-
test('getSessionId() is valid', () => {
|
|
121
|
-
const value = basePropUtils.getSessionId();
|
|
122
|
-
expect(value).toBeDefined();
|
|
123
|
-
expect(value).not.toBe('');
|
|
124
|
-
expect(value).not.toBeNull();
|
|
125
|
-
expect(value).toHaveLength(32);
|
|
126
|
-
});
|
|
127
|
-
test('getSessionId() is a guid', () => {
|
|
128
|
-
const value = basePropUtils.getSessionId();
|
|
129
|
-
expect(value).toHaveLength(32);
|
|
130
|
-
const parseGuid = () => {
|
|
131
|
-
parseInt(value, 16);
|
|
132
|
-
};
|
|
133
|
-
expect(parseGuid).not.toThrow();
|
|
134
|
-
});
|
|
135
|
-
test('getSessionId() does not change', () => {
|
|
136
|
-
expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());
|
|
137
|
-
});
|
|
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 basePropUtils = __importStar(require("../utils/basePropUtils"));
|
|
33
|
+
test('deviceId() is valid', async () => {
|
|
34
|
+
const value = await basePropUtils.deviceId();
|
|
35
|
+
expect(value).toBeDefined();
|
|
36
|
+
expect(value).not.toBe('');
|
|
37
|
+
expect(value).not.toBeNull();
|
|
38
|
+
});
|
|
39
|
+
test('deviceId() does not change', async () => {
|
|
40
|
+
expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());
|
|
41
|
+
});
|
|
42
|
+
test('deviceArchitecture() is valid', () => {
|
|
43
|
+
const value = basePropUtils.deviceArchitecture();
|
|
44
|
+
expect(value).toBeDefined();
|
|
45
|
+
expect(value).not.toBe('');
|
|
46
|
+
expect(value).not.toBeNull();
|
|
47
|
+
});
|
|
48
|
+
test('nodeArchitecture() is valid', () => {
|
|
49
|
+
const value = basePropUtils.nodeArchitecture();
|
|
50
|
+
expect(value).toBeDefined();
|
|
51
|
+
expect(value).not.toBe('');
|
|
52
|
+
expect(value).not.toBeNull();
|
|
53
|
+
});
|
|
54
|
+
test('devicePlatform() is valid', () => {
|
|
55
|
+
const value = basePropUtils.devicePlatform();
|
|
56
|
+
expect(value).toBeDefined();
|
|
57
|
+
expect(value).not.toBe('');
|
|
58
|
+
expect(value).not.toBeNull();
|
|
59
|
+
});
|
|
60
|
+
test('deviceLocale() is valid', async () => {
|
|
61
|
+
const value = await basePropUtils.deviceLocale();
|
|
62
|
+
expect(value).toBeDefined();
|
|
63
|
+
expect(value).not.toBe('');
|
|
64
|
+
expect(value).not.toBeNull();
|
|
65
|
+
});
|
|
66
|
+
test('deviceLocale() does not change', async () => {
|
|
67
|
+
expect(await basePropUtils.deviceLocale()).toBe(await basePropUtils.deviceLocale());
|
|
68
|
+
});
|
|
69
|
+
test('deviceNumCPUs() is valid', () => {
|
|
70
|
+
const value = basePropUtils.deviceNumCPUs();
|
|
71
|
+
expect(value).toBeGreaterThan(0);
|
|
72
|
+
});
|
|
73
|
+
test('deviceTotalMemory() is valid', () => {
|
|
74
|
+
const value = basePropUtils.deviceTotalMemory();
|
|
75
|
+
expect(value).toBeGreaterThan(0);
|
|
76
|
+
});
|
|
77
|
+
test('deviceDiskFreeSpace() is valid', () => {
|
|
78
|
+
const value = basePropUtils.deviceDiskFreeSpace();
|
|
79
|
+
expect(value).toBeGreaterThanOrEqual(0);
|
|
80
|
+
});
|
|
81
|
+
test('sampleRate() is within valid range', () => {
|
|
82
|
+
const value = basePropUtils.sampleRate();
|
|
83
|
+
expect(value).toBeGreaterThanOrEqual(0);
|
|
84
|
+
expect(value).toBeLessThanOrEqual(100);
|
|
85
|
+
});
|
|
86
|
+
test('ciType() is valid', () => {
|
|
87
|
+
const value = basePropUtils.ciType();
|
|
88
|
+
expect(value).toBeDefined();
|
|
89
|
+
expect(value).not.toBe('');
|
|
90
|
+
expect(value).not.toBeNull();
|
|
91
|
+
});
|
|
92
|
+
test('ciType() is None when not in CI', () => {
|
|
93
|
+
if (basePropUtils.isCI()) {
|
|
94
|
+
expect(basePropUtils.ciType()).not.toBe('None');
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
expect(basePropUtils.ciType()).toBe('None');
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
test('isMsftInternal() is false with no domain', () => {
|
|
101
|
+
delete process.env.UserDNSDomain;
|
|
102
|
+
expect(basePropUtils.isMsftInternal()).toBe(false);
|
|
103
|
+
});
|
|
104
|
+
test('isMsftInternal() is false with example.com domain', () => {
|
|
105
|
+
process.env.UserDNSDomain = 'example.com';
|
|
106
|
+
expect(basePropUtils.isMsftInternal()).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
test('isMsftInternal() is true with Msft domain', () => {
|
|
109
|
+
process.env.UserDNSDomain = 'test.corp.microsoft.com';
|
|
110
|
+
expect(basePropUtils.isMsftInternal()).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
test('isCliTest() is true if RNW_CLI_TEST env variable is set', () => {
|
|
113
|
+
process.env.RNW_CLI_TEST = 'true';
|
|
114
|
+
expect(basePropUtils.isCliTest()).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
test('isCliTest() is false if no RNW_CLI_TEST variable', () => {
|
|
117
|
+
delete process.env.RNW_CLI_TEST;
|
|
118
|
+
expect(basePropUtils.isCliTest()).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
test('getSessionId() is valid', () => {
|
|
121
|
+
const value = basePropUtils.getSessionId();
|
|
122
|
+
expect(value).toBeDefined();
|
|
123
|
+
expect(value).not.toBe('');
|
|
124
|
+
expect(value).not.toBeNull();
|
|
125
|
+
expect(value).toHaveLength(32);
|
|
126
|
+
});
|
|
127
|
+
test('getSessionId() is a guid', () => {
|
|
128
|
+
const value = basePropUtils.getSessionId();
|
|
129
|
+
expect(value).toHaveLength(32);
|
|
130
|
+
const parseGuid = () => {
|
|
131
|
+
parseInt(value, 16);
|
|
132
|
+
};
|
|
133
|
+
expect(parseGuid).not.toThrow();
|
|
134
|
+
});
|
|
135
|
+
test('getSessionId() does not change', () => {
|
|
136
|
+
expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());
|
|
137
|
+
});
|
|
138
138
|
//# sourceMappingURL=basePropUtils.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
export {};
|