@react-native-windows/telemetry 0.72.1 → 0.73.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.
@@ -283,7 +283,7 @@ async function runTestCommandE2E(commandBody) {
283
283
  }
284
284
  TelemetryTest.endCommand(getTestCommandEndInfo(errorCode), getExtraProps());
285
285
  }
286
- /** Verifys the contents of events fired during the 'test-command'. */
286
+ /** Verifies the contents of events fired during the 'test-command'. */
287
287
  function verifyTestCommandTelemetryProcessor(caughtErrors, expectedResultCode, expectedError) {
288
288
  return (envelope, _) => {
289
289
  var _a, _b, _c, _d;
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.test.js","sourceRoot":"","sources":["../../src/e2etest/telemetry.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,2CAA6B;AAE7B,4CAOsB;AACtB,sEAAwD;AACxD,gEAAkD;AAClD,oEAAsD;AACtD,oEAAsD;AAEtD,MAAa,aAAc,SAAQ,qBAAS;IAI1C,yCAAyC;IACzC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAmC;QACxD,aAAa,CAAC,yBAAyB,GAAG,KAAK,CAAC;QAChD,aAAa,CAAC,yBAAyB,GAAG,KAAK,CAAC;QAEhD,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE;YAC7B,qBAAS,CAAC,KAAK,EAAE,CAAC;SACnB;QAED,yDAAyD;QACzD,qBAAS,CAAC,MAAM,GAAG,IAAI,CAAC;QAExB,MAAM,qBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,6DAA6D;IAC7D,MAAM,CAAC,OAAO,CAAC,aAA0B;;QACvC,MAAA,qBAAS,CAAC,MAAM,0CAAE,KAAK,CAAC;YACtB,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACZ,IAAI,aAAa,CAAC,yBAAyB,EAAE;oBAC3C,MAAM,CAAC,aAAa,C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AAC,CAAC,CAAC;IAEH,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE;QACzB,kCAAkC;QAClC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAC7B,mGAAmG,EACnG,KAAK,EAAC,OAAO,EAAC,EAAE;IACd,MAAM,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAE1D,gDAAgD;IAChD,MAAM,YAAY,GAAY,EAAE,CAAC;IACjC,aAAa,CAAC,qBAAqB,CACjC,gCAAgC,CAAC,YAAY,EAAE,aAAa,CAAC,CAC9D,CAAC;IAEF,MAAM,iBAAiB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE;QACzB,kCAAkC;QAClC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\nimport * as path from 'path';\n\nimport {\n Telemetry,\n TelemetryOptions,\n CommandStartInfo,\n CommandEndInfo,\n CommandEventName,\n CodedErrorEventName,\n} from '../telemetry';\nimport * as basePropUtils from '../utils/basePropUtils';\nimport * as errorUtils from '../utils/errorUtils';\nimport * as projectUtils from '../utils/projectUtils';\nimport * as versionUtils from '../utils/versionUtils';\n\nexport class TelemetryTest extends Telemetry {\n protected static hasTestTelemetryProviders: boolean;\n protected static testTelemetryProvidersRan: boolean;\n\n /** Run at the beginning of each test. */\n static async startTest(options?: Partial<TelemetryOptions>) {\n TelemetryTest.hasTestTelemetryProviders = false;\n TelemetryTest.testTelemetryProvidersRan = false;\n\n if (TelemetryTest.isEnabled()) {\n Telemetry.reset();\n }\n\n // Ensure that we don't actually fire events when testing\n Telemetry.isTest = true;\n\n await Telemetry.setup(options);\n }\n\n /** Run at the end of each test where telemetry was fired. */\n static endTest(finalCallback?: () => void): void {\n Telemetry.client?.flush({\n callback: _ => {\n if (TelemetryTest.hasTestTelemetryProviders) {\n expect(TelemetryTest.testTelemetryProvidersRan).toBe(true);\n }\n if (finalCallback) {\n finalCallback();\n }\n },\n });\n }\n\n /** Sets that the telemetry provider has run. */\n static setTestTelemetryProvidersRan() {\n TelemetryTest.testTelemetryProvidersRan = true;\n }\n\n /** Retrieves the value of a common property.*/\n static getCommonProperty(key: string): string | undefined {\n return TelemetryTest.client?.commonProperties[key];\n }\n\n /** Retrieves the version of the specified tool/package. */\n static getVersion(key: string): string | null {\n return key in TelemetryTest.versionsProp\n ? TelemetryTest.versionsProp[key]\n : null;\n }\n\n /** Retrieves the value of the preserveErrorMessages option. */\n static getPreserveErrorMessages(): boolean {\n return TelemetryTest.options.preserveErrorMessages;\n }\n\n /** Adds a telemetry processor, usually for verifying the envelope. */\n static addTelemetryProcessor(\n telemetryProcessor: (\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n contextObjects?: {\n [name: string]: any;\n },\n ) => boolean,\n ): void {\n TelemetryTest.client?.addTelemetryProcessor(telemetryProcessor);\n TelemetryTest.hasTestTelemetryProviders = true;\n }\n}\n\ntest('setup() verify session id is valid and a common property', async () => {\n await TelemetryTest.startTest();\n\n const sessionId = TelemetryTest.getSessionId();\n expect(sessionId).toBeDefined();\n expect(sessionId!).toHaveLength(32);\n expect(sessionId!).toBe(basePropUtils.getSessionId());\n expect(TelemetryTest.getCommonProperty('sessionId')).toBe(sessionId!);\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify static common property values with async sources', async () => {\n await TelemetryTest.startTest();\n\n const props: Record<string, () => Promise<string | undefined>> = {\n deviceId: basePropUtils.deviceId,\n deviceLocale: basePropUtils.deviceLocale,\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = TelemetryTest.getCommonProperty(key);\n expect(value).toBeDefined();\n expect(value).toBe(await props[key]());\n }\n }\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify static common property values with sync sources', async () => {\n await TelemetryTest.startTest();\n\n const props: Record<string, () => string | undefined> = {\n deviceArchitecture: () => basePropUtils.deviceArchitecture(),\n devicePlatform: () => basePropUtils.devicePlatform(),\n deviceNumCPUs: () => basePropUtils.deviceNumCPUs().toString(),\n deviceTotalMemory: () => basePropUtils.deviceTotalMemory().toString(),\n ciCaptured: () => basePropUtils.captureCI().toString(),\n ciType: () => basePropUtils.ciType(),\n isMsftInternal: () => basePropUtils.isMsftInternal().toString(),\n sampleRate: () => basePropUtils.sampleRate().toString(),\n isTest: () => 'true',\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = TelemetryTest.getCommonProperty(key);\n expect(value).toBeDefined();\n expect(value).toBe(props[key]());\n }\n }\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify other common property values are defined', async () => {\n await TelemetryTest.startTest();\n\n const props: string[] = ['deviceDiskFreeSpace'];\n\n for (const key of props) {\n const value = TelemetryTest.getCommonProperty(key);\n expect(value).toBeDefined();\n }\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify tool versions are populated', async () => {\n await TelemetryTest.startTest();\n\n const props: Record<string, () => Promise<string | null>> = {\n node: versionUtils.getNodeVersion,\n npm: versionUtils.getNpmVersion,\n yarn: versionUtils.getYarnVersion,\n VisualStudio: versionUtils.getVisualStudioVersion,\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = await props[key]();\n expect(value).toBe(TelemetryTest.getVersion(key));\n }\n }\n\n TelemetryTest.endTest();\n});\n\ntest('tryUpdateVersionsProp() returns true for adding a new version', async () => {\n await TelemetryTest.startTest();\n\n const name = 'test';\n const version = '1.0';\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => version),\n ).toBe(true);\n expect(TelemetryTest.getVersion(name)).toBe(version);\n\n TelemetryTest.endTest();\n});\n\ntest('tryUpdateVersionsProp() returns false for adding an existing version with refresh is false', async () => {\n await TelemetryTest.startTest();\n\n const name = 'test';\n const version = '1.0';\n\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => version),\n ).toBe(true);\n\n let getValueCalled = false;\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => {\n getValueCalled = true;\n return version;\n }),\n ).toBe(false);\n\n expect(getValueCalled).toBe(false);\n\n TelemetryTest.endTest();\n});\n\ntest('tryUpdateVersionsProp() returns true for adding an existing version with refresh is true', async () => {\n await TelemetryTest.startTest();\n\n const name = 'test';\n const version = '1.0';\n\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => version),\n ).toBe(true);\n\n let getValueCalled = false;\n expect(\n await TelemetryTest.tryUpdateVersionsProp(\n name,\n async () => {\n getValueCalled = true;\n return version;\n },\n true,\n ),\n ).toBe(true);\n\n expect(getValueCalled).toBe(true);\n\n TelemetryTest.endTest();\n});\n\n/** Returns the CommandStartInfo for our fake 'test-command'. */\nfunction getTestCommandStartInfo(): CommandStartInfo {\n return {\n commandName: 'test-command',\n args: {\n testArg1: 'true',\n testArg2: '10',\n testArg3: 'testValue',\n },\n options: {\n testArg0: 'unsetArg',\n testArg1: true,\n testArg2: 10,\n testArg3: 'testValue',\n },\n defaultOptions: {\n testArg0: 'unsetArg',\n testArg1: false,\n testArg2: 0,\n testArg3: 'defaultValue',\n },\n };\n}\n\n/** Returns the CommandEndInfo for our fake 'test-command'. */\nfunction getTestCommandEndInfo(\n resultCode: errorUtils.CodedErrorType,\n): CommandEndInfo {\n return {\n resultCode,\n };\n}\n\nfunction getTestCommandProjectInfo(): projectUtils.AppProjectInfo {\n return {\n id: projectUtils.getProjectId('test-app-project'),\n platforms: ['windows'],\n rnwLang: 'cpp',\n usesTS: true,\n usesRNConfig: false,\n jsEngine: 'Chakra',\n rnwSource: 'Source',\n dependencies: [\n {\n id: projectUtils.getProjectId('test-module-project'),\n platforms: ['android', 'windows'],\n rnwLang: 'cpp',\n },\n ],\n };\n}\n\nfunction getExtraProps(): Record<string, any> {\n return {\n extraProp1: true,\n extraProp2: 1234,\n extraProp3: 'test',\n extraProp4: ['test'],\n extraProp5: {\n nestedProp1: true,\n nestedProp2: 1234,\n },\n };\n}\n\n/** Asynchronously waits the number in ms. */\nasync function promiseDelay(ms: number) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/** The body of the fake 'test-command' which will throw the provided error. */\nasync function testCommandBody(errorToThrow?: Error): Promise<void> {\n await promiseDelay(100);\n if (errorToThrow) {\n throw errorToThrow;\n }\n}\n\n/** Runs the complete 'test-command' with the right Telemetry setup and cleanup. */\nasync function runTestCommandE2E(commandBody: () => Promise<void>) {\n TelemetryTest.startCommand(getTestCommandStartInfo());\n TelemetryTest.setProjectInfo(getTestCommandProjectInfo());\n let errorCode: errorUtils.CodedErrorType = 'Success';\n let caughtError: Error | undefined;\n try {\n await commandBody();\n } catch (ex) {\n caughtError = ex instanceof Error ? (ex as Error) : new Error(String(ex));\n errorCode =\n caughtError instanceof errorUtils.CodedError\n ? (caughtError as errorUtils.CodedError).type\n : 'Unknown';\n TelemetryTest.trackException(caughtError);\n }\n TelemetryTest.endCommand(getTestCommandEndInfo(errorCode), getExtraProps());\n}\n\n/** Verifys the contents of events fired during the 'test-command'. */\nfunction verifyTestCommandTelemetryProcessor(\n caughtErrors: Error[],\n expectedResultCode?: errorUtils.CodedErrorType,\n expectedError?: Error,\n): (\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n contextObjects?: {\n [name: string]: any;\n },\n) => boolean {\n return (envelope, _) => {\n try {\n // Processor has run, so the test can (potentially) pass\n TelemetryTest.setTestTelemetryProvidersRan();\n\n // Verify roleInstance has been removed\n expect(envelope.tags['ai.cloud.roleInstance']).toBeUndefined();\n\n const properties = envelope.data.baseData?.properties;\n expect(properties).toBeDefined();\n\n // Verify basics\n expect(properties.commandName).toBe('test-command');\n\n // Verify versions info\n const versions = JSON.parse(properties.versions);\n expect(versions).toBeDefined();\n\n // Verify project info\n const project = JSON.parse(properties.project);\n expect(project).toStrictEqual(getTestCommandProjectInfo());\n\n expect(Object.keys(versions).length).toBeGreaterThan(0);\n for (const key of Object.keys(versions)) {\n expect(versions[key]).toBe(TelemetryTest.getVersion(key));\n }\n\n if (envelope.data.baseType === 'ExceptionData') {\n // Verify event name\n expect(properties.eventName).toBe(CodedErrorEventName);\n\n // Verify exception info\n const exceptions = envelope.data.baseData?.exceptions;\n expect(exceptions).toBeDefined();\n expect(exceptions.length).toBe(1);\n expect(exceptions[0].message).toBeDefined();\n expect(exceptions[0].message).not.toBe('');\n\n expect(exceptions[0].message).toBe(\n TelemetryTest.getPreserveErrorMessages()\n ? errorUtils.sanitizeErrorMessage(expectedError?.message || 'None')\n : '[Removed]',\n );\n\n // Verify coded error info\n const codedError = JSON.parse(properties.codedError);\n expect(codedError).toBeDefined();\n\n expect(codedError.type).toBe(\n expectedError instanceof errorUtils.CodedError\n ? expectedError.type\n : 'Unknown',\n );\n\n expect(codedError.data).toStrictEqual(\n (expectedError as errorUtils.CodedError).data ?? {},\n );\n } else {\n // Verify event name\n expect(envelope.data.baseData?.name).toBe(CommandEventName);\n expect(properties.eventName).toBe(CommandEventName);\n\n // Verify command info\n const expectedInfo = getTestCommandStartInfo();\n\n const command = JSON.parse(properties.command);\n expect(command).toBeDefined();\n expect(command.args).toStrictEqual(expectedInfo.args);\n expect(command.options).toStrictEqual(expectedInfo.options);\n expect(command.defaultOptions).toStrictEqual(\n expectedInfo.defaultOptions,\n );\n expect(command.durationInSecs).toBeGreaterThan(0);\n expect(command.resultCode).toBe(expectedResultCode ?? 'Success');\n\n // Verify extra props\n const extraProps = getExtraProps();\n expect(JSON.parse(properties.extraProps)).toStrictEqual(extraProps);\n }\n } catch (ex) {\n caughtErrors.push(\n ex instanceof Error ? (ex as Error) : new Error(String(ex)),\n );\n }\n\n return true;\n };\n}\n\ntest('Telemetry run test command end to end, verify event fires', async () => {\n await TelemetryTest.startTest();\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(caughtErrors),\n );\n\n await runTestCommandE2E(testCommandBody);\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n});\n\nconst testTelemetryOptions = [\n {preserveErrorMessages: false},\n {preserveErrorMessages: true},\n];\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with CodedError, verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new errorUtils.CodedError(\n 'MSBuildError',\n 'test error',\n );\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n expectedError.type,\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with CodedError (with error in message), verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new errorUtils.CodedError(\n 'MSBuildError',\n 'error FOO2020: test error',\n );\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n expectedError.type,\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with CodedError (with data), verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new errorUtils.CodedError(\n 'MSBuildError',\n 'test error',\n {foo: 42},\n );\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n expectedError.type,\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error('error FOO2020: test error');\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n 'Unknown',\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error (no message), verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error();\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n 'Unknown',\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\nfunction b(s: string) {\n throw new Error('hello ' + s);\n}\n\nfunction a(s: string) {\n b(s);\n}\n\n/** Verifies the contents of an exception's message and stack frames */\nfunction getVerifyStackTelemetryProcessor(\n caughtErrors: Error[],\n expectedError: Error,\n): (\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n contextObjects?: {\n [name: string]: any;\n },\n) => boolean {\n return (envelope, _) => {\n try {\n // Processor has run, so the test can (potentially) pass\n TelemetryTest.setTestTelemetryProvidersRan();\n\n if (envelope.data.baseType === 'ExceptionData') {\n const data = (envelope.data as any).baseData;\n expect(data.exceptions).toBeDefined();\n expect(data.exceptions.length).toBe(1);\n expect(data.exceptions[0].message).toBeDefined();\n expect(data.exceptions[0].message).not.toBe('');\n\n expect(data.exceptions[0].message).toBe(\n TelemetryTest.getPreserveErrorMessages()\n ? errorUtils.sanitizeErrorMessage(expectedError.message || 'None')\n : '[Removed]',\n );\n\n const stack = data.exceptions[0].parsedStack;\n expect(stack).toBeDefined();\n expect(stack.length).toBeGreaterThan(2);\n\n const filename = path.relative(process.cwd(), __filename);\n expect(stack[0].method).toEqual('b');\n expect(stack[1].method).toEqual('b');\n expect(stack[2].method).toEqual('a');\n expect(stack[0].fileName).toEqual(\n `[project_dir]\\\\???.ts(${filename.length})`,\n );\n expect(stack[1].fileName).toEqual(\n `[project_dir]\\\\???.ts(${filename.length})`,\n );\n expect(stack[2].fileName).toEqual(\n `[project_dir]\\\\???.ts(${filename.length})`,\n );\n }\n } catch (ex) {\n caughtErrors.push(\n ex instanceof Error ? (ex as Error) : new Error(String(ex)),\n );\n }\n\n return true;\n };\n}\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify sanitized message and stack %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error('hello world');\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n getVerifyStackTelemetryProcessor(caughtErrors, expectedError),\n );\n\n await runTestCommandE2E(async () => {\n await promiseDelay(100);\n a('world');\n });\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify sanitized message with path and stack %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error(`hello ${process.cwd()}`);\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n getVerifyStackTelemetryProcessor(caughtErrors, expectedError),\n );\n\n await runTestCommandE2E(async () => {\n await promiseDelay(100);\n a(process.cwd());\n });\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n"]}
1
+ {"version":3,"file":"telemetry.test.js","sourceRoot":"","sources":["../../src/e2etest/telemetry.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,2CAA6B;AAE7B,4CAOsB;AACtB,sEAAwD;AACxD,gEAAkD;AAClD,oEAAsD;AACtD,oEAAsD;AAEtD,MAAa,aAAc,SAAQ,qBAAS;IAI1C,yCAAyC;IACzC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAmC;QACxD,aAAa,CAAC,yBAAyB,GAAG,KAAK,CAAC;QAChD,aAAa,CAAC,yBAAyB,GAAG,KAAK,CAAC;QAEhD,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE;YAC7B,qBAAS,CAAC,KAAK,EAAE,CAAC;SACnB;QAED,yDAAyD;QACzD,qBAAS,CAAC,MAAM,GAAG,IAAI,CAAC;QAExB,MAAM,qBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,6DAA6D;IAC7D,MAAM,CAAC,OAAO,CAAC,aAA0B;;QACvC,MAAA,qBAAS,CAAC,MAAM,0CAAE,KAAK,CAAC;YACtB,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACZ,IAAI,aAAa,CAAC,yBAAyB,EAAE;oBAC3C,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,IAAI,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AC,OAAO,CAAC,GAAG,EAAE;QACzB,kCAAkC;QAClC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAC7B,mGAAmG,EACnG,KAAK,EAAC,OAAO,EAAC,EAAE;IACd,MAAM,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAE1D,gDAAgD;IAChD,MAAM,YAAY,GAAY,EAAE,CAAC;IACjC,aAAa,CAAC,qBAAqB,CACjC,gCAAgC,CAAC,YAAY,EAAE,aAAa,CAAC,CAC9D,CAAC;IAEF,MAAM,iBAAiB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE;QACzB,kCAAkC;QAClC,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\nimport * as path from 'path';\n\nimport {\n Telemetry,\n TelemetryOptions,\n CommandStartInfo,\n CommandEndInfo,\n CommandEventName,\n CodedErrorEventName,\n} from '../telemetry';\nimport * as basePropUtils from '../utils/basePropUtils';\nimport * as errorUtils from '../utils/errorUtils';\nimport * as projectUtils from '../utils/projectUtils';\nimport * as versionUtils from '../utils/versionUtils';\n\nexport class TelemetryTest extends Telemetry {\n protected static hasTestTelemetryProviders: boolean;\n protected static testTelemetryProvidersRan: boolean;\n\n /** Run at the beginning of each test. */\n static async startTest(options?: Partial<TelemetryOptions>) {\n TelemetryTest.hasTestTelemetryProviders = false;\n TelemetryTest.testTelemetryProvidersRan = false;\n\n if (TelemetryTest.isEnabled()) {\n Telemetry.reset();\n }\n\n // Ensure that we don't actually fire events when testing\n Telemetry.isTest = true;\n\n await Telemetry.setup(options);\n }\n\n /** Run at the end of each test where telemetry was fired. */\n static endTest(finalCallback?: () => void): void {\n Telemetry.client?.flush({\n callback: _ => {\n if (TelemetryTest.hasTestTelemetryProviders) {\n expect(TelemetryTest.testTelemetryProvidersRan).toBe(true);\n }\n if (finalCallback) {\n finalCallback();\n }\n },\n });\n }\n\n /** Sets that the telemetry provider has run. */\n static setTestTelemetryProvidersRan() {\n TelemetryTest.testTelemetryProvidersRan = true;\n }\n\n /** Retrieves the value of a common property.*/\n static getCommonProperty(key: string): string | undefined {\n return TelemetryTest.client?.commonProperties[key];\n }\n\n /** Retrieves the version of the specified tool/package. */\n static getVersion(key: string): string | null {\n return key in TelemetryTest.versionsProp\n ? TelemetryTest.versionsProp[key]\n : null;\n }\n\n /** Retrieves the value of the preserveErrorMessages option. */\n static getPreserveErrorMessages(): boolean {\n return TelemetryTest.options.preserveErrorMessages;\n }\n\n /** Adds a telemetry processor, usually for verifying the envelope. */\n static addTelemetryProcessor(\n telemetryProcessor: (\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n contextObjects?: {\n [name: string]: any;\n },\n ) => boolean,\n ): void {\n TelemetryTest.client?.addTelemetryProcessor(telemetryProcessor);\n TelemetryTest.hasTestTelemetryProviders = true;\n }\n}\n\ntest('setup() verify session id is valid and a common property', async () => {\n await TelemetryTest.startTest();\n\n const sessionId = TelemetryTest.getSessionId();\n expect(sessionId).toBeDefined();\n expect(sessionId!).toHaveLength(32);\n expect(sessionId!).toBe(basePropUtils.getSessionId());\n expect(TelemetryTest.getCommonProperty('sessionId')).toBe(sessionId!);\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify static common property values with async sources', async () => {\n await TelemetryTest.startTest();\n\n const props: Record<string, () => Promise<string | undefined>> = {\n deviceId: basePropUtils.deviceId,\n deviceLocale: basePropUtils.deviceLocale,\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = TelemetryTest.getCommonProperty(key);\n expect(value).toBeDefined();\n expect(value).toBe(await props[key]());\n }\n }\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify static common property values with sync sources', async () => {\n await TelemetryTest.startTest();\n\n const props: Record<string, () => string | undefined> = {\n deviceArchitecture: () => basePropUtils.deviceArchitecture(),\n devicePlatform: () => basePropUtils.devicePlatform(),\n deviceNumCPUs: () => basePropUtils.deviceNumCPUs().toString(),\n deviceTotalMemory: () => basePropUtils.deviceTotalMemory().toString(),\n ciCaptured: () => basePropUtils.captureCI().toString(),\n ciType: () => basePropUtils.ciType(),\n isMsftInternal: () => basePropUtils.isMsftInternal().toString(),\n sampleRate: () => basePropUtils.sampleRate().toString(),\n isTest: () => 'true',\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = TelemetryTest.getCommonProperty(key);\n expect(value).toBeDefined();\n expect(value).toBe(props[key]());\n }\n }\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify other common property values are defined', async () => {\n await TelemetryTest.startTest();\n\n const props: string[] = ['deviceDiskFreeSpace'];\n\n for (const key of props) {\n const value = TelemetryTest.getCommonProperty(key);\n expect(value).toBeDefined();\n }\n\n TelemetryTest.endTest();\n});\n\ntest('setup() verify tool versions are populated', async () => {\n await TelemetryTest.startTest();\n\n const props: Record<string, () => Promise<string | null>> = {\n node: versionUtils.getNodeVersion,\n npm: versionUtils.getNpmVersion,\n yarn: versionUtils.getYarnVersion,\n VisualStudio: versionUtils.getVisualStudioVersion,\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = await props[key]();\n expect(value).toBe(TelemetryTest.getVersion(key));\n }\n }\n\n TelemetryTest.endTest();\n});\n\ntest('tryUpdateVersionsProp() returns true for adding a new version', async () => {\n await TelemetryTest.startTest();\n\n const name = 'test';\n const version = '1.0';\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => version),\n ).toBe(true);\n expect(TelemetryTest.getVersion(name)).toBe(version);\n\n TelemetryTest.endTest();\n});\n\ntest('tryUpdateVersionsProp() returns false for adding an existing version with refresh is false', async () => {\n await TelemetryTest.startTest();\n\n const name = 'test';\n const version = '1.0';\n\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => version),\n ).toBe(true);\n\n let getValueCalled = false;\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => {\n getValueCalled = true;\n return version;\n }),\n ).toBe(false);\n\n expect(getValueCalled).toBe(false);\n\n TelemetryTest.endTest();\n});\n\ntest('tryUpdateVersionsProp() returns true for adding an existing version with refresh is true', async () => {\n await TelemetryTest.startTest();\n\n const name = 'test';\n const version = '1.0';\n\n expect(\n await TelemetryTest.tryUpdateVersionsProp(name, async () => version),\n ).toBe(true);\n\n let getValueCalled = false;\n expect(\n await TelemetryTest.tryUpdateVersionsProp(\n name,\n async () => {\n getValueCalled = true;\n return version;\n },\n true,\n ),\n ).toBe(true);\n\n expect(getValueCalled).toBe(true);\n\n TelemetryTest.endTest();\n});\n\n/** Returns the CommandStartInfo for our fake 'test-command'. */\nfunction getTestCommandStartInfo(): CommandStartInfo {\n return {\n commandName: 'test-command',\n args: {\n testArg1: 'true',\n testArg2: '10',\n testArg3: 'testValue',\n },\n options: {\n testArg0: 'unsetArg',\n testArg1: true,\n testArg2: 10,\n testArg3: 'testValue',\n },\n defaultOptions: {\n testArg0: 'unsetArg',\n testArg1: false,\n testArg2: 0,\n testArg3: 'defaultValue',\n },\n };\n}\n\n/** Returns the CommandEndInfo for our fake 'test-command'. */\nfunction getTestCommandEndInfo(\n resultCode: errorUtils.CodedErrorType,\n): CommandEndInfo {\n return {\n resultCode,\n };\n}\n\nfunction getTestCommandProjectInfo(): projectUtils.AppProjectInfo {\n return {\n id: projectUtils.getProjectId('test-app-project'),\n platforms: ['windows'],\n rnwLang: 'cpp',\n usesTS: true,\n usesRNConfig: false,\n jsEngine: 'Chakra',\n rnwSource: 'Source',\n dependencies: [\n {\n id: projectUtils.getProjectId('test-module-project'),\n platforms: ['android', 'windows'],\n rnwLang: 'cpp',\n },\n ],\n };\n}\n\nfunction getExtraProps(): Record<string, any> {\n return {\n extraProp1: true,\n extraProp2: 1234,\n extraProp3: 'test',\n extraProp4: ['test'],\n extraProp5: {\n nestedProp1: true,\n nestedProp2: 1234,\n },\n };\n}\n\n/** Asynchronously waits the number in ms. */\nasync function promiseDelay(ms: number) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/** The body of the fake 'test-command' which will throw the provided error. */\nasync function testCommandBody(errorToThrow?: Error): Promise<void> {\n await promiseDelay(100);\n if (errorToThrow) {\n throw errorToThrow;\n }\n}\n\n/** Runs the complete 'test-command' with the right Telemetry setup and cleanup. */\nasync function runTestCommandE2E(commandBody: () => Promise<void>) {\n TelemetryTest.startCommand(getTestCommandStartInfo());\n TelemetryTest.setProjectInfo(getTestCommandProjectInfo());\n let errorCode: errorUtils.CodedErrorType = 'Success';\n let caughtError: Error | undefined;\n try {\n await commandBody();\n } catch (ex) {\n caughtError = ex instanceof Error ? (ex as Error) : new Error(String(ex));\n errorCode =\n caughtError instanceof errorUtils.CodedError\n ? (caughtError as errorUtils.CodedError).type\n : 'Unknown';\n TelemetryTest.trackException(caughtError);\n }\n TelemetryTest.endCommand(getTestCommandEndInfo(errorCode), getExtraProps());\n}\n\n/** Verifies the contents of events fired during the 'test-command'. */\nfunction verifyTestCommandTelemetryProcessor(\n caughtErrors: Error[],\n expectedResultCode?: errorUtils.CodedErrorType,\n expectedError?: Error,\n): (\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n contextObjects?: {\n [name: string]: any;\n },\n) => boolean {\n return (envelope, _) => {\n try {\n // Processor has run, so the test can (potentially) pass\n TelemetryTest.setTestTelemetryProvidersRan();\n\n // Verify roleInstance has been removed\n expect(envelope.tags['ai.cloud.roleInstance']).toBeUndefined();\n\n const properties = envelope.data.baseData?.properties;\n expect(properties).toBeDefined();\n\n // Verify basics\n expect(properties.commandName).toBe('test-command');\n\n // Verify versions info\n const versions = JSON.parse(properties.versions);\n expect(versions).toBeDefined();\n\n // Verify project info\n const project = JSON.parse(properties.project);\n expect(project).toStrictEqual(getTestCommandProjectInfo());\n\n expect(Object.keys(versions).length).toBeGreaterThan(0);\n for (const key of Object.keys(versions)) {\n expect(versions[key]).toBe(TelemetryTest.getVersion(key));\n }\n\n if (envelope.data.baseType === 'ExceptionData') {\n // Verify event name\n expect(properties.eventName).toBe(CodedErrorEventName);\n\n // Verify exception info\n const exceptions = envelope.data.baseData?.exceptions;\n expect(exceptions).toBeDefined();\n expect(exceptions.length).toBe(1);\n expect(exceptions[0].message).toBeDefined();\n expect(exceptions[0].message).not.toBe('');\n\n expect(exceptions[0].message).toBe(\n TelemetryTest.getPreserveErrorMessages()\n ? errorUtils.sanitizeErrorMessage(expectedError?.message || 'None')\n : '[Removed]',\n );\n\n // Verify coded error info\n const codedError = JSON.parse(properties.codedError);\n expect(codedError).toBeDefined();\n\n expect(codedError.type).toBe(\n expectedError instanceof errorUtils.CodedError\n ? expectedError.type\n : 'Unknown',\n );\n\n expect(codedError.data).toStrictEqual(\n (expectedError as errorUtils.CodedError).data ?? {},\n );\n } else {\n // Verify event name\n expect(envelope.data.baseData?.name).toBe(CommandEventName);\n expect(properties.eventName).toBe(CommandEventName);\n\n // Verify command info\n const expectedInfo = getTestCommandStartInfo();\n\n const command = JSON.parse(properties.command);\n expect(command).toBeDefined();\n expect(command.args).toStrictEqual(expectedInfo.args);\n expect(command.options).toStrictEqual(expectedInfo.options);\n expect(command.defaultOptions).toStrictEqual(\n expectedInfo.defaultOptions,\n );\n expect(command.durationInSecs).toBeGreaterThan(0);\n expect(command.resultCode).toBe(expectedResultCode ?? 'Success');\n\n // Verify extra props\n const extraProps = getExtraProps();\n expect(JSON.parse(properties.extraProps)).toStrictEqual(extraProps);\n }\n } catch (ex) {\n caughtErrors.push(\n ex instanceof Error ? (ex as Error) : new Error(String(ex)),\n );\n }\n\n return true;\n };\n}\n\ntest('Telemetry run test command end to end, verify event fires', async () => {\n await TelemetryTest.startTest();\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(caughtErrors),\n );\n\n await runTestCommandE2E(testCommandBody);\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n});\n\nconst testTelemetryOptions = [\n {preserveErrorMessages: false},\n {preserveErrorMessages: true},\n];\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with CodedError, verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new errorUtils.CodedError(\n 'MSBuildError',\n 'test error',\n );\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n expectedError.type,\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with CodedError (with error in message), verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new errorUtils.CodedError(\n 'MSBuildError',\n 'error FOO2020: test error',\n );\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n expectedError.type,\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with CodedError (with data), verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new errorUtils.CodedError(\n 'MSBuildError',\n 'test error',\n {foo: 42},\n );\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n expectedError.type,\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error('error FOO2020: test error');\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n 'Unknown',\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error (no message), verify events fire %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error();\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(\n caughtErrors,\n 'Unknown',\n expectedError,\n ),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\nfunction b(s: string) {\n throw new Error('hello ' + s);\n}\n\nfunction a(s: string) {\n b(s);\n}\n\n/** Verifies the contents of an exception's message and stack frames */\nfunction getVerifyStackTelemetryProcessor(\n caughtErrors: Error[],\n expectedError: Error,\n): (\n envelope: appInsights.Contracts.EnvelopeTelemetry,\n contextObjects?: {\n [name: string]: any;\n },\n) => boolean {\n return (envelope, _) => {\n try {\n // Processor has run, so the test can (potentially) pass\n TelemetryTest.setTestTelemetryProvidersRan();\n\n if (envelope.data.baseType === 'ExceptionData') {\n const data = (envelope.data as any).baseData;\n expect(data.exceptions).toBeDefined();\n expect(data.exceptions.length).toBe(1);\n expect(data.exceptions[0].message).toBeDefined();\n expect(data.exceptions[0].message).not.toBe('');\n\n expect(data.exceptions[0].message).toBe(\n TelemetryTest.getPreserveErrorMessages()\n ? errorUtils.sanitizeErrorMessage(expectedError.message || 'None')\n : '[Removed]',\n );\n\n const stack = data.exceptions[0].parsedStack;\n expect(stack).toBeDefined();\n expect(stack.length).toBeGreaterThan(2);\n\n const filename = path.relative(process.cwd(), __filename);\n expect(stack[0].method).toEqual('b');\n expect(stack[1].method).toEqual('b');\n expect(stack[2].method).toEqual('a');\n expect(stack[0].fileName).toEqual(\n `[project_dir]\\\\???.ts(${filename.length})`,\n );\n expect(stack[1].fileName).toEqual(\n `[project_dir]\\\\???.ts(${filename.length})`,\n );\n expect(stack[2].fileName).toEqual(\n `[project_dir]\\\\???.ts(${filename.length})`,\n );\n }\n } catch (ex) {\n caughtErrors.push(\n ex instanceof Error ? (ex as Error) : new Error(String(ex)),\n );\n }\n\n return true;\n };\n}\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify sanitized message and stack %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error('hello world');\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n getVerifyStackTelemetryProcessor(caughtErrors, expectedError),\n );\n\n await runTestCommandE2E(async () => {\n await promiseDelay(100);\n a('world');\n });\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify sanitized message with path and stack %s',\n async options => {\n await TelemetryTest.startTest(options);\n\n const expectedError = new Error(`hello ${process.cwd()}`);\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n getVerifyStackTelemetryProcessor(caughtErrors, expectedError),\n );\n\n await runTestCommandE2E(async () => {\n await promiseDelay(100);\n a(process.cwd());\n });\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n });\n },\n);\n"]}
@@ -49,6 +49,11 @@ export declare const CodedErrors: {
49
49
  Autolinking: number;
50
50
  NeedCodegen: number;
51
51
  InvalidCodegenConfig: number;
52
+ NoTemplatesFound: number;
53
+ NoDefaultTemplate: number;
54
+ InvalidTemplateName: number;
55
+ NoProjectName: number;
56
+ InvalidProjectName: number;
52
57
  };
53
58
  export type CodedErrorType = keyof typeof CodedErrors;
54
59
  /**
@@ -37,7 +37,7 @@ const sanitizeUtils = __importStar(require("./sanitizeUtils"));
37
37
  exports.CodedErrors = {
38
38
  Success: 0,
39
39
  Unknown: -1,
40
- // init
40
+ // react-native-windows-init
41
41
  UnsupportedReactNativeVersion: 1000,
42
42
  UserCancel: 1001,
43
43
  NoReactNativeFound: 1002,
@@ -88,6 +88,12 @@ exports.CodedErrors = {
88
88
  // codegen-windows
89
89
  NeedCodegen: 4000,
90
90
  InvalidCodegenConfig: 4001,
91
+ // init-windows
92
+ NoTemplatesFound: 5000,
93
+ NoDefaultTemplate: 5001,
94
+ InvalidTemplateName: 5002,
95
+ NoProjectName: 5003,
96
+ InvalidProjectName: 5004,
91
97
  };
92
98
  /**
93
99
  * Represents an error whose message might contain user-originating content,
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../../src/utils/errorUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,+DAAiD;AAEjD,6EAA6E;AAC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\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\n\nimport * as sanitizeUtils from './sanitizeUtils';\n\n// Note: All CLI commands will set process.exitCode to the numerical value of\n// a thrown CodedError. However node reserves codes 1-192 as per:\n// https://nodejs.org/api/process.html#process_exit_codes so we shouldn't\n// override those as other tools may be monitoring the error code\n\nexport const CodedErrors = {\n Success: 0,\n Unknown: -1,\n\n // init\n UnsupportedReactNativeVersion: 1000,\n UserCancel: 1001,\n NoReactNativeFound: 1002,\n NoPackageJson: 1003,\n NoLatestReactNativeWindows: 1004,\n NoAutoMatchingReactNativeWindows: 1005,\n IncompatibleOptions: 1006,\n NoReactNativeDependencies: 1007,\n NoMatchingPackageVersion: 1008,\n\n // run-windows\n NoSolution: 2000,\n // Project generation\n NoPropertyInProject: 2100,\n CopyProjectTemplateNoSourcePath: 2101,\n CopyProjectTemplateNoDestPath: 2102,\n CopyProjectTemplateNoProjectName: 2103,\n // SDK requirements\n MinSDKVersionNotMet: 2200,\n BadSDKVersionFormat: 2201,\n NoSDK: 2202,\n // Build\n NoMSBuild: 2300,\n NoVSWhere: 2301,\n MSBuildError: 2302,\n // Deploy\n NoAppPackage: 2400,\n NoAppxManifest: 2401,\n NoDevice: 2402,\n AppDidNotDeploy: 2403,\n InvalidDevicesOutput: 2404,\n RemoveOldAppVersionFailure: 2405,\n EnableDevModeFailure: 2406,\n InstallAppFailure: 2407,\n InstallAppDependenciesFailure: 2408,\n CheckNetIsolationFailure: 2409,\n InstallAppToDeviceFailure: 2410,\n UninstallAppOnDeviceFailure: 2411,\n DeployRecipeFailure: 2412,\n // Launch\n AppStartupFailure: 2500,\n\n // autolink-windows\n NoWindowsConfig: 3000,\n IncompleteConfig: 3001,\n InvalidConfig: 3002,\n NeedAutolinking: 3003,\n AddProjectToSolution: 3004,\n Autolinking: 3005,\n\n // codegen-windows\n NeedCodegen: 4000,\n InvalidCodegenConfig: 4001,\n};\n\nexport type CodedErrorType = keyof typeof CodedErrors;\n\n/**\n * Represents an error whose message might contain user-originating content,\n * therefore when transmitting telemetry, only the type should be sent.\n * @param type a stable ID identifying the type of error.\n * @param message the error text. This should only be used for display to the user.\n * @param data any additional metadata that is safe to collect for telemetry purposes.\n */\nexport class CodedError extends Error {\n constructor(\n public readonly type: CodedErrorType,\n message: string,\n public readonly data?: Record<string, any>,\n ) {\n super(message);\n this.name = type;\n }\n}\n\n/**\n * Tries to parse an error code out of an error message.\n * @param msg An error message to process.\n * @returns The parsed error code.\n */\nexport function tryGetErrorCode(msg: string): string | undefined {\n const errorRegEx = /error (\\w+\\d+):/gi;\n const m = errorRegEx.exec(msg);\n return m ? m[1] : undefined;\n}\n\n/**\n * Sanitize an error message by anonymizing any paths that appear between quotes (''), brackets ([]), or double quotes (\"\").\n * @param msg The error message to sanitize.\n * @return The message with any paths anonymized.\n */\nexport function sanitizeErrorMessage(msg: string): string {\n const msBuildErrorMessage =\n /^\\d+:\\d+>(.*)(\\(\\d+,\\d+\\)): error (\\w+\\d+): (.*)/g;\n msg = msg.replace(msBuildErrorMessage, '[$1]$2: error $3: $4');\n\n const cpuThreadId = /^\\d+(:\\d+)?>/g;\n msg = msg.replace(cpuThreadId, '');\n\n const parts = msg.split(/['[\\]\"]/g);\n const clean = [];\n const pathRegEx =\n /(['[\"]?)([A-Za-z]:|\\\\)[\\\\/]([^<>:;,?\"*\\t\\r\\n|/\\\\]+[\\\\/])+([^<>:;,?\"*\\t\\r\\n|]+\\/?(['[\"]?))/gi;\n for (const part of parts) {\n if (pathRegEx.test(part)) {\n pathRegEx.lastIndex = -1;\n let matches: RegExpExecArray | null;\n let noPath = '';\n let last = 0;\n while ((matches = pathRegEx.exec(part))) {\n noPath +=\n part.substr(last, matches!.index - last) +\n sanitizeUtils.getAnonymizedPath(matches[0]);\n last = matches!.index + matches![0].length;\n }\n if (noPath !== '') {\n clean.push(noPath);\n }\n } else if (part !== '') {\n clean.push(part);\n }\n }\n return clean.join('').trim();\n}\n\n/**\n * Sanitizes an error stack frame.\n * @param frame\n */\nexport function sanitizeErrorStackFrame(\n frame: appInsights.Contracts.StackFrame,\n): void {\n const parens = frame.method.indexOf('(');\n if (parens !== -1) {\n // case 1: method === 'methodName (rootOfThePath'\n frame.method = frame.method.substr(0, parens).trim();\n } else {\n // case 2: method === <no_method> or something without '(', fileName is full path\n }\n // anonymize the filename\n frame.fileName = sanitizeUtils.getAnonymizedPath(frame.fileName);\n frame.assembly = '';\n}\n"]}
1
+ {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../../src/utils/errorUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,+DAAiD;AAEjD,6EAA6E;AAC7E,iEAAiE;AACjE,yEAAyE;AACzE,iEAAiE;AAEpD,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,CAAC;IAEX,4BAA4B;IAC5B,6BAA6B,EAAE,IAAI;IACnC,UAAU,EAAE,IAAI;IAChB,kBAAkB,EAAE,IAAI;IACxB,aAAa,EAAE,IAAI;IACnB,0BAA0B,EAAE,IAAI;IAChC,gCAAgC,EAAE,IAAI;IACtC,mBAAmB,EAAE,IAAI;IACzB,yBAAyB,EAAE,IAAI;IAC/B,wBAAwB,EAAE,IAAI;IAE9B,cAAc;IACd,UAAU,EAAE,IAAI;IAChB,qBAAqB;IACrB,mBAAmB,EAAE,IAAI;IACzB,+BAA+B,EAAE,IAAI;IACrC,6BAA6B,EAAE,IAAI;IACnC,gCAAgC,EAAE,IAAI;IACtC,mBAAmB;IACnB,mBAAmB,EAAE,IAAI;IACzB,mBAAmB,EAAE,IAAI;IACzB,KAAK,EAAE,IAAI;IACX,QAAQ;IACR,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,IAAI;IAClB,SAAS;IACT,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE,IAAI;IACrB,oB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CD,oDAgCC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CACrC,KAAuC;IAEvC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE;QACjB,iDAAiD;QACjD,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;KACtD;SAAM;QACL,iFAAiF;KAClF;IACD,yBAAyB;IACzB,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjE,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;AACtB,CAAC;AAbD,0DAaC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\n\nimport * as sanitizeUtils from './sanitizeUtils';\n\n// Note: All CLI commands will set process.exitCode to the numerical value of\n// a thrown CodedError. However node reserves codes 1-192 as per:\n// https://nodejs.org/api/process.html#process_exit_codes so we shouldn't\n// override those as other tools may be monitoring the error code\n\nexport const CodedErrors = {\n Success: 0,\n Unknown: -1,\n\n // react-native-windows-init\n UnsupportedReactNativeVersion: 1000,\n UserCancel: 1001,\n NoReactNativeFound: 1002,\n NoPackageJson: 1003,\n NoLatestReactNativeWindows: 1004,\n NoAutoMatchingReactNativeWindows: 1005,\n IncompatibleOptions: 1006,\n NoReactNativeDependencies: 1007,\n NoMatchingPackageVersion: 1008,\n\n // run-windows\n NoSolution: 2000,\n // Project generation\n NoPropertyInProject: 2100,\n CopyProjectTemplateNoSourcePath: 2101,\n CopyProjectTemplateNoDestPath: 2102,\n CopyProjectTemplateNoProjectName: 2103,\n // SDK requirements\n MinSDKVersionNotMet: 2200,\n BadSDKVersionFormat: 2201,\n NoSDK: 2202,\n // Build\n NoMSBuild: 2300,\n NoVSWhere: 2301,\n MSBuildError: 2302,\n // Deploy\n NoAppPackage: 2400,\n NoAppxManifest: 2401,\n NoDevice: 2402,\n AppDidNotDeploy: 2403,\n InvalidDevicesOutput: 2404,\n RemoveOldAppVersionFailure: 2405,\n EnableDevModeFailure: 2406,\n InstallAppFailure: 2407,\n InstallAppDependenciesFailure: 2408,\n CheckNetIsolationFailure: 2409,\n InstallAppToDeviceFailure: 2410,\n UninstallAppOnDeviceFailure: 2411,\n DeployRecipeFailure: 2412,\n // Launch\n AppStartupFailure: 2500,\n\n // autolink-windows\n NoWindowsConfig: 3000,\n IncompleteConfig: 3001,\n InvalidConfig: 3002,\n NeedAutolinking: 3003,\n AddProjectToSolution: 3004,\n Autolinking: 3005,\n\n // codegen-windows\n NeedCodegen: 4000,\n InvalidCodegenConfig: 4001,\n\n // init-windows\n NoTemplatesFound: 5000,\n NoDefaultTemplate: 5001,\n InvalidTemplateName: 5002,\n NoProjectName: 5003,\n InvalidProjectName: 5004,\n};\n\nexport type CodedErrorType = keyof typeof CodedErrors;\n\n/**\n * Represents an error whose message might contain user-originating content,\n * therefore when transmitting telemetry, only the type should be sent.\n * @param type a stable ID identifying the type of error.\n * @param message the error text. This should only be used for display to the user.\n * @param data any additional metadata that is safe to collect for telemetry purposes.\n */\nexport class CodedError extends Error {\n constructor(\n public readonly type: CodedErrorType,\n message: string,\n public readonly data?: Record<string, any>,\n ) {\n super(message);\n this.name = type;\n }\n}\n\n/**\n * Tries to parse an error code out of an error message.\n * @param msg An error message to process.\n * @returns The parsed error code.\n */\nexport function tryGetErrorCode(msg: string): string | undefined {\n const errorRegEx = /error (\\w+\\d+):/gi;\n const m = errorRegEx.exec(msg);\n return m ? m[1] : undefined;\n}\n\n/**\n * Sanitize an error message by anonymizing any paths that appear between quotes (''), brackets ([]), or double quotes (\"\").\n * @param msg The error message to sanitize.\n * @return The message with any paths anonymized.\n */\nexport function sanitizeErrorMessage(msg: string): string {\n const msBuildErrorMessage =\n /^\\d+:\\d+>(.*)(\\(\\d+,\\d+\\)): error (\\w+\\d+): (.*)/g;\n msg = msg.replace(msBuildErrorMessage, '[$1]$2: error $3: $4');\n\n const cpuThreadId = /^\\d+(:\\d+)?>/g;\n msg = msg.replace(cpuThreadId, '');\n\n const parts = msg.split(/['[\\]\"]/g);\n const clean = [];\n const pathRegEx =\n /(['[\"]?)([A-Za-z]:|\\\\)[\\\\/]([^<>:;,?\"*\\t\\r\\n|/\\\\]+[\\\\/])+([^<>:;,?\"*\\t\\r\\n|]+\\/?(['[\"]?))/gi;\n for (const part of parts) {\n if (pathRegEx.test(part)) {\n pathRegEx.lastIndex = -1;\n let matches: RegExpExecArray | null;\n let noPath = '';\n let last = 0;\n while ((matches = pathRegEx.exec(part))) {\n noPath +=\n part.substr(last, matches!.index - last) +\n sanitizeUtils.getAnonymizedPath(matches[0]);\n last = matches!.index + matches![0].length;\n }\n if (noPath !== '') {\n clean.push(noPath);\n }\n } else if (part !== '') {\n clean.push(part);\n }\n }\n return clean.join('').trim();\n}\n\n/**\n * Sanitizes an error stack frame.\n * @param frame\n */\nexport function sanitizeErrorStackFrame(\n frame: appInsights.Contracts.StackFrame,\n): void {\n const parens = frame.method.indexOf('(');\n if (parens !== -1) {\n // case 1: method === 'methodName (rootOfThePath'\n frame.method = frame.method.substr(0, parens).trim();\n } else {\n // case 2: method === <no_method> or something without '(', fileName is full path\n }\n // anonymize the filename\n frame.fileName = sanitizeUtils.getAnonymizedPath(frame.fileName);\n frame.assembly = '';\n}\n"]}
@@ -95,7 +95,7 @@ async function readXmlFile(filePath) {
95
95
  }
96
96
  /**
97
97
  * Gets the versions of the specified NuGet packages referenced in a packages.config file.
98
- * @param projectDoc The XML document of the packages.connfig file.
98
+ * @param projectDoc The XML document of the packages.config file.
99
99
  * @param nugetPackages The NuGet package names to look for.
100
100
  * @returns The mapping of NuGet package names and their versions.
101
101
  */
@@ -1 +1 @@
1
- {"version":3,"file":"versionUtils.js","sourceRoot":"","sources":["../../src/utils/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C,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE;QACnC,MAAM,OAAO,GAAG,aAAa,CAC3B,0DAA0D,OAAO,oBAAoB,EACrF,UAAU,EACV,IAAI,CACL,CAAC;QAEF,IAAI,OAAO,EAAE;YACX,MAAM,YAAY,GAAI,OAAgB,CAAC,WAAW,CAAC;YACnD,IAAI,YAAY,KAAK,IAAI,EAAE;gBACzB,QAAQ,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;aAClC;SACF;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAC9C,WAAmB,EACnB,aAAuB;IAEvB,IAAI;QACF,yDAAyD;QACzD,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAClC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EACzB,iBAAiB,CAClB,CAAC;QACF,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,CAAC;QAChE,OAAO,6BAA6B,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;KACxE;IAAC,WAAM,GAAE;IAEV,IAAI;QACF,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;QAClD,OAAO,0BAA0B,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;KAC9D;IAAC,WAAM,GAAE;IAEV,OAAO,EAAE,CAAC;AACZ,CAAC;AApBD,gEAoBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport envinfo from 'envinfo';\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {DOMParser} from '@xmldom/xmldom';\nimport xpath from 'xpath';\n\nconst msbuildSelect = xpath.useNamespaces({\n msbuild: 'http://schemas.microsoft.com/developer/msbuild/2003',\n});\n\n/**\n * Gets the version of node being used.\n * @returns The version of node being used.\n */\nexport async function getNodeVersion(): Promise<string | null> {\n return process.version.slice(1);\n}\n\n/**\n * Gets the version of npm installed, if available.\n * @returns The version of npm installed, if available.\n */\nexport async function getNpmVersion(): Promise<string | null> {\n try {\n const info: any = await envinfo.helpers.getnpmInfo();\n return info[1] as string;\n } catch {}\n return null;\n}\n\n/**\n * Gets the version of yarn installed, if available.\n * @returns The version of yarn installed, if available.\n */\nexport async function getYarnVersion(): Promise<string | null> {\n try {\n const info: any = await envinfo.helpers.getYarnInfo();\n return info[1] as string;\n } catch {}\n return null;\n}\n\n/**\n * Gets the latest version of Visual Studio installed, if available.\n * @returns The latest version of Visual Studio installed, if available.\n */\nexport async function getVisualStudioVersion(): Promise<string | null> {\n try {\n const info: any = await envinfo.helpers.getVisualStudioInfo();\n const versions = info[1] as string[];\n return versions.sort().slice(-1)[0].split(' ')[0];\n } catch {}\n return null;\n}\n\n/**\n * Gets the version installed of the specified npm package.\n * @param pkgName The npm package name.\n * @returns The version installed, if available.\n */\nexport async function getVersionOfNpmPackage(\n pkgName: string,\n): Promise<string | null> {\n try {\n const pkgJsonPath = require.resolve(`${pkgName.trim()}/package.json`, {\n paths: [process.cwd(), __dirname],\n });\n const pkgJson = await fs.readJsonFile<{name: string; version: string}>(\n pkgJsonPath,\n );\n if (pkgJson.name === pkgName) {\n return pkgJson.version;\n }\n } catch {}\n return null;\n}\n\n/**\n * Reads and parses an XML file into a Document.\n * @param filePath The path to the XML file.\n * @returns The parsed Document.\n */\nasync function readXmlFile(filePath: string): Promise<Document> {\n const contents = await fs.readFile(filePath, 'utf-8');\n return new DOMParser().parseFromString(contents);\n}\n\n/**\n * Gets the versions of the specified NuGet packages referenced in a packages.config file.\n * @param projectDoc The XML document of the packages.connfig file.\n * @param nugetPackages The NuGet package names to look for.\n * @returns The mapping of NuGet package names and their versions.\n */\nfunction getVersionsFromPackagesConfig(\n packagesConfigDoc: Document,\n nugetPackages: string[],\n): Record<string, string> {\n const versions: Record<string, string> = {};\n for (const pkgName of nugetPackages) {\n const version = xpath.select1(\n `//packages/package[@id='${pkgName}']/@version`,\n packagesConfigDoc,\n );\n\n if (version) {\n const versionValue = (version as Attr).nodeValue;\n if (versionValue !== null) {\n versions[pkgName] = versionValue;\n }\n }\n }\n return versions;\n}\n\n/**\n * Gets the versions of the specified NuGet packages referenced in a project file.\n * @param projectDoc The XML document of the project file.\n * @param nugetPackages The NuGet package names to look for.\n * @returns The mapping of NuGet package names and their versions.\n */\nfunction getVersionsFromProjectFile(\n projectDoc: Document,\n nugetPackages: string[],\n): Record<string, string> {\n const versions: Record<string, string> = {};\n for (const pkgName of nugetPackages) {\n const version = msbuildSelect(\n `//msbuild:ItemGroup/msbuild:PackageReference[@Include='${pkgName}']/msbuild:Version`,\n projectDoc,\n true,\n );\n\n if (version) {\n const versionValue = (version as Node).textContent;\n if (versionValue !== null) {\n versions[pkgName] = versionValue;\n }\n }\n }\n return versions;\n}\n\n/**\n * Gets the versions of the specified NuGet packages referenced in a project file.\n * @param projectFile Path to the native project file.\n * @param nugetPackages The NuGet package names to look for.\n * @returns The mapping of NuGet package names and their versions.\n */\nexport async function getVersionsOfNuGetPackages(\n projectFile: string,\n nugetPackages: string[],\n): Promise<Record<string, string>> {\n try {\n // First check for the presence of a packages.config file\n const packagesConfigFile = path.join(\n path.dirname(projectFile),\n 'packages.config',\n );\n const packagesConfigDoc = await readXmlFile(packagesConfigFile);\n return getVersionsFromPackagesConfig(packagesConfigDoc, nugetPackages);\n } catch {}\n\n try {\n const projectDoc = await readXmlFile(projectFile);\n return getVersionsFromProjectFile(projectDoc, nugetPackages);\n } catch {}\n\n return {};\n}\n"]}
1
+ {"version":3,"file":"versionUtils.js","sourceRoot":"","sources":["../../src/utils/versionUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,sDAA8B;AAC9B,kEAA0C;AAC1C,gDAAwB;AACxB,2CAAyC;AACzC,kDAA0B;AAE1B,MAAM,aAAa,GAAG,eAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,qDAAqD;CAC/D,CAAC,CAAC;AAEH;;;G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K,IAAI,EAAE;gBACzB,QAAQ,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;aAClC;SACF;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAC9C,WAAmB,EACnB,aAAuB;IAEvB,IAAI;QACF,yDAAyD;QACzD,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAClC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EACzB,iBAAiB,CAClB,CAAC;QACF,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,CAAC;QAChE,OAAO,6BAA6B,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;KACxE;IAAC,WAAM,GAAE;IAEV,IAAI;QACF,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;QAClD,OAAO,0BAA0B,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;KAC9D;IAAC,WAAM,GAAE;IAEV,OAAO,EAAE,CAAC;AACZ,CAAC;AApBD,gEAoBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport envinfo from 'envinfo';\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {DOMParser} from '@xmldom/xmldom';\nimport xpath from 'xpath';\n\nconst msbuildSelect = xpath.useNamespaces({\n msbuild: 'http://schemas.microsoft.com/developer/msbuild/2003',\n});\n\n/**\n * Gets the version of node being used.\n * @returns The version of node being used.\n */\nexport async function getNodeVersion(): Promise<string | null> {\n return process.version.slice(1);\n}\n\n/**\n * Gets the version of npm installed, if available.\n * @returns The version of npm installed, if available.\n */\nexport async function getNpmVersion(): Promise<string | null> {\n try {\n const info: any = await envinfo.helpers.getnpmInfo();\n return info[1] as string;\n } catch {}\n return null;\n}\n\n/**\n * Gets the version of yarn installed, if available.\n * @returns The version of yarn installed, if available.\n */\nexport async function getYarnVersion(): Promise<string | null> {\n try {\n const info: any = await envinfo.helpers.getYarnInfo();\n return info[1] as string;\n } catch {}\n return null;\n}\n\n/**\n * Gets the latest version of Visual Studio installed, if available.\n * @returns The latest version of Visual Studio installed, if available.\n */\nexport async function getVisualStudioVersion(): Promise<string | null> {\n try {\n const info: any = await envinfo.helpers.getVisualStudioInfo();\n const versions = info[1] as string[];\n return versions.sort().slice(-1)[0].split(' ')[0];\n } catch {}\n return null;\n}\n\n/**\n * Gets the version installed of the specified npm package.\n * @param pkgName The npm package name.\n * @returns The version installed, if available.\n */\nexport async function getVersionOfNpmPackage(\n pkgName: string,\n): Promise<string | null> {\n try {\n const pkgJsonPath = require.resolve(`${pkgName.trim()}/package.json`, {\n paths: [process.cwd(), __dirname],\n });\n const pkgJson = await fs.readJsonFile<{name: string; version: string}>(\n pkgJsonPath,\n );\n if (pkgJson.name === pkgName) {\n return pkgJson.version;\n }\n } catch {}\n return null;\n}\n\n/**\n * Reads and parses an XML file into a Document.\n * @param filePath The path to the XML file.\n * @returns The parsed Document.\n */\nasync function readXmlFile(filePath: string): Promise<Document> {\n const contents = await fs.readFile(filePath, 'utf-8');\n return new DOMParser().parseFromString(contents);\n}\n\n/**\n * Gets the versions of the specified NuGet packages referenced in a packages.config file.\n * @param projectDoc The XML document of the packages.config file.\n * @param nugetPackages The NuGet package names to look for.\n * @returns The mapping of NuGet package names and their versions.\n */\nfunction getVersionsFromPackagesConfig(\n packagesConfigDoc: Document,\n nugetPackages: string[],\n): Record<string, string> {\n const versions: Record<string, string> = {};\n for (const pkgName of nugetPackages) {\n const version = xpath.select1(\n `//packages/package[@id='${pkgName}']/@version`,\n packagesConfigDoc,\n );\n\n if (version) {\n const versionValue = (version as Attr).nodeValue;\n if (versionValue !== null) {\n versions[pkgName] = versionValue;\n }\n }\n }\n return versions;\n}\n\n/**\n * Gets the versions of the specified NuGet packages referenced in a project file.\n * @param projectDoc The XML document of the project file.\n * @param nugetPackages The NuGet package names to look for.\n * @returns The mapping of NuGet package names and their versions.\n */\nfunction getVersionsFromProjectFile(\n projectDoc: Document,\n nugetPackages: string[],\n): Record<string, string> {\n const versions: Record<string, string> = {};\n for (const pkgName of nugetPackages) {\n const version = msbuildSelect(\n `//msbuild:ItemGroup/msbuild:PackageReference[@Include='${pkgName}']/msbuild:Version`,\n projectDoc,\n true,\n );\n\n if (version) {\n const versionValue = (version as Node).textContent;\n if (versionValue !== null) {\n versions[pkgName] = versionValue;\n }\n }\n }\n return versions;\n}\n\n/**\n * Gets the versions of the specified NuGet packages referenced in a project file.\n * @param projectFile Path to the native project file.\n * @param nugetPackages The NuGet package names to look for.\n * @returns The mapping of NuGet package names and their versions.\n */\nexport async function getVersionsOfNuGetPackages(\n projectFile: string,\n nugetPackages: string[],\n): Promise<Record<string, string>> {\n try {\n // First check for the presence of a packages.config file\n const packagesConfigFile = path.join(\n path.dirname(projectFile),\n 'packages.config',\n );\n const packagesConfigDoc = await readXmlFile(packagesConfigFile);\n return getVersionsFromPackagesConfig(packagesConfigDoc, nugetPackages);\n } catch {}\n\n try {\n const projectDoc = await readXmlFile(projectFile);\n return getVersionsFromProjectFile(projectDoc, nugetPackages);\n } catch {}\n\n return {};\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-windows/telemetry",
3
- "version": "0.72.1",
3
+ "version": "0.73.0-preview.1",
4
4
  "license": "MIT",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "typings": "lib-commonjs/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "watch": "rnw-scripts watch"
19
19
  },
20
20
  "dependencies": {
21
- "@react-native-windows/fs": "0.72.0",
21
+ "@react-native-windows/fs": "0.73.0-preview.1",
22
22
  "@xmldom/xmldom": "^0.7.7",
23
23
  "applicationinsights": "^2.3.1",
24
24
  "ci-info": "^3.2.0",
@@ -28,16 +28,16 @@
28
28
  "xpath": "^0.0.27"
29
29
  },
30
30
  "devDependencies": {
31
- "@rnw-scripts/eslint-config": "1.1.15",
32
- "@rnw-scripts/jest-unittest-config": "1.5.1",
33
- "@rnw-scripts/just-task": "2.3.6",
34
- "@rnw-scripts/ts-config": "2.0.3",
31
+ "@rnw-scripts/eslint-config": "1.2.3",
32
+ "@rnw-scripts/jest-unittest-config": "1.5.6",
33
+ "@rnw-scripts/just-task": "2.3.17",
34
+ "@rnw-scripts/ts-config": "2.0.5",
35
35
  "@types/envinfo": "^7.8.1",
36
36
  "@types/jest": "^29.2.2",
37
- "@types/node": "^16.0.0",
37
+ "@types/node": "^18.0.0",
38
38
  "@types/semver": "^7.3.3",
39
39
  "@typescript-eslint/eslint-plugin": "^5.30.5",
40
- "@typescript-eslint/parser": "^5.30.5",
40
+ "@typescript-eslint/parser": "^5.57.1",
41
41
  "babel-jest": "^29.3.0",
42
42
  "eslint": "^8.19.0",
43
43
  "jest": "^29.2.1",
@@ -50,16 +50,16 @@
50
50
  "lib-commonjs"
51
51
  ],
52
52
  "beachball": {
53
- "defaultNpmTag": "latest",
53
+ "defaultNpmTag": "preview",
54
54
  "disallowedChangeTypes": [
55
55
  "major",
56
56
  "minor",
57
- "prerelease"
57
+ "patch"
58
58
  ]
59
59
  },
60
60
  "promoteRelease": true,
61
61
  "windowsOnly": true,
62
62
  "engines": {
63
- "node": ">= 16"
63
+ "node": ">= 18"
64
64
  }
65
65
  }