@react-native-windows/telemetry 0.68.1 → 0.68.2
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/{test → e2etest}/telemetry.test.d.ts +5 -3
- package/lib-commonjs/{test → e2etest}/telemetry.test.js +77 -40
- package/lib-commonjs/e2etest/telemetry.test.js.map +1 -0
- package/lib-commonjs/telemetry.js +32 -12
- package/lib-commonjs/telemetry.js.map +1 -1
- package/lib-commonjs/test/basePropUtils.test.js +12 -0
- package/lib-commonjs/test/basePropUtils.test.js.map +1 -1
- package/lib-commonjs/test/errorUtils.test.js +3 -0
- package/lib-commonjs/test/errorUtils.test.js.map +1 -1
- package/lib-commonjs/utils/basePropUtils.d.ts +10 -0
- package/lib-commonjs/utils/basePropUtils.js +17 -1
- package/lib-commonjs/utils/basePropUtils.js.map +1 -1
- package/lib-commonjs/utils/errorUtils.js +2 -0
- package/lib-commonjs/utils/errorUtils.js.map +1 -1
- package/lib-commonjs/utils/sanitizeUtils.js +1 -1
- package/lib-commonjs/utils/sanitizeUtils.js.map +1 -1
- package/package.json +1 -1
- package/lib-commonjs/test/telemetry.test.js.map +0 -1
|
@@ -5,20 +5,22 @@
|
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
7
|
import * as appInsights from 'applicationinsights';
|
|
8
|
-
import { Telemetry } from '../telemetry';
|
|
8
|
+
import { Telemetry, TelemetryOptions } from '../telemetry';
|
|
9
9
|
export declare class TelemetryTest extends Telemetry {
|
|
10
10
|
protected static hasTestTelemetryProviders: boolean;
|
|
11
11
|
protected static testTelemetryProvidersRan: boolean;
|
|
12
12
|
/** Run at the beginning of each test. */
|
|
13
|
-
static startTest(): Promise<void>;
|
|
13
|
+
static startTest(options?: Partial<TelemetryOptions>): Promise<void>;
|
|
14
14
|
/** Run at the end of each test where telemetry was fired. */
|
|
15
|
-
static endTest(finalCallback
|
|
15
|
+
static endTest(finalCallback?: () => void): void;
|
|
16
16
|
/** Sets that the telemetry provider has run. */
|
|
17
17
|
static setTestTelemetryProvidersRan(): void;
|
|
18
18
|
/** Retrieves the value of a common property.*/
|
|
19
19
|
static getCommonProperty(key: string): string | undefined;
|
|
20
20
|
/** Retrieves the version of the specified tool/package. */
|
|
21
21
|
static getVersion(key: string): string | null;
|
|
22
|
+
/** Retrieves the value of the preserveErrorMessages option. */
|
|
23
|
+
static getPreserveErrorMessages(): boolean;
|
|
22
24
|
/** Adds a telemetry processor, usually for verifying the envelope. */
|
|
23
25
|
static addTelemetryProcessor(telemetryProcessor: (envelope: appInsights.Contracts.EnvelopeTelemetry, contextObjects?: {
|
|
24
26
|
[name: string]: any;
|
|
@@ -34,16 +34,15 @@ const projectUtils = __importStar(require("../utils/projectUtils"));
|
|
|
34
34
|
const versionUtils = __importStar(require("../utils/versionUtils"));
|
|
35
35
|
class TelemetryTest extends telemetry_1.Telemetry {
|
|
36
36
|
/** Run at the beginning of each test. */
|
|
37
|
-
static async startTest() {
|
|
37
|
+
static async startTest(options) {
|
|
38
38
|
TelemetryTest.hasTestTelemetryProviders = false;
|
|
39
39
|
TelemetryTest.testTelemetryProvidersRan = false;
|
|
40
|
-
jest.setTimeout(10000); // These E2E tests can run longer than the default 5000ms
|
|
41
40
|
if (TelemetryTest.isEnabled()) {
|
|
42
41
|
telemetry_1.Telemetry.reset();
|
|
43
42
|
}
|
|
44
43
|
// Ensure that we don't actually fire events when testing
|
|
45
44
|
telemetry_1.Telemetry.isTest = true;
|
|
46
|
-
await telemetry_1.Telemetry.setup(
|
|
45
|
+
await telemetry_1.Telemetry.setup(options);
|
|
47
46
|
}
|
|
48
47
|
/** Run at the end of each test where telemetry was fired. */
|
|
49
48
|
static endTest(finalCallback) {
|
|
@@ -53,7 +52,9 @@ class TelemetryTest extends telemetry_1.Telemetry {
|
|
|
53
52
|
if (TelemetryTest.hasTestTelemetryProviders) {
|
|
54
53
|
expect(TelemetryTest.testTelemetryProvidersRan).toBe(true);
|
|
55
54
|
}
|
|
56
|
-
finalCallback
|
|
55
|
+
if (finalCallback) {
|
|
56
|
+
finalCallback();
|
|
57
|
+
}
|
|
57
58
|
},
|
|
58
59
|
});
|
|
59
60
|
}
|
|
@@ -72,6 +73,10 @@ class TelemetryTest extends telemetry_1.Telemetry {
|
|
|
72
73
|
? TelemetryTest.versionsProp[key]
|
|
73
74
|
: null;
|
|
74
75
|
}
|
|
76
|
+
/** Retrieves the value of the preserveErrorMessages option. */
|
|
77
|
+
static getPreserveErrorMessages() {
|
|
78
|
+
return TelemetryTest.options.preserveErrorMessages;
|
|
79
|
+
}
|
|
75
80
|
/** Adds a telemetry processor, usually for verifying the envelope. */
|
|
76
81
|
static addTelemetryProcessor(telemetryProcessor) {
|
|
77
82
|
var _a;
|
|
@@ -80,54 +85,63 @@ class TelemetryTest extends telemetry_1.Telemetry {
|
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
exports.TelemetryTest = TelemetryTest;
|
|
83
|
-
|
|
88
|
+
test('setup() verify session id is valid and a common property', async (done) => {
|
|
84
89
|
await TelemetryTest.startTest();
|
|
85
|
-
});
|
|
86
|
-
test('setup() verify session id is valid and a common property', async () => {
|
|
87
90
|
const sessionId = TelemetryTest.getSessionId();
|
|
88
91
|
expect(sessionId).toBeDefined();
|
|
89
92
|
expect(sessionId).toHaveLength(32);
|
|
90
93
|
expect(sessionId).toBe(basePropUtils.getSessionId());
|
|
91
|
-
expect(
|
|
94
|
+
expect(TelemetryTest.getCommonProperty('sessionId')).toBe(sessionId);
|
|
95
|
+
TelemetryTest.endTest(done);
|
|
92
96
|
});
|
|
93
|
-
test('setup() verify static common property values with async sources', async () => {
|
|
97
|
+
test('setup() verify static common property values with async sources', async (done) => {
|
|
98
|
+
await TelemetryTest.startTest();
|
|
94
99
|
const props = {
|
|
95
100
|
deviceId: basePropUtils.deviceId,
|
|
96
101
|
deviceLocale: basePropUtils.deviceLocale,
|
|
97
102
|
};
|
|
98
103
|
for (const key in props) {
|
|
99
104
|
if (!(key in Object.prototype)) {
|
|
100
|
-
const value =
|
|
105
|
+
const value = TelemetryTest.getCommonProperty(key);
|
|
101
106
|
expect(value).toBeDefined();
|
|
102
|
-
expect(value).toBe(
|
|
107
|
+
expect(value).toBe(await props[key]());
|
|
103
108
|
}
|
|
104
109
|
}
|
|
110
|
+
TelemetryTest.endTest(done);
|
|
105
111
|
});
|
|
106
|
-
test('setup() verify static common property values with sync sources', () => {
|
|
112
|
+
test('setup() verify static common property values with sync sources', async (done) => {
|
|
113
|
+
await TelemetryTest.startTest();
|
|
107
114
|
const props = {
|
|
115
|
+
deviceArchitecture: () => basePropUtils.deviceArchitecture(),
|
|
116
|
+
devicePlatform: () => basePropUtils.devicePlatform(),
|
|
108
117
|
deviceNumCPUs: () => basePropUtils.deviceNumCPUs().toString(),
|
|
109
118
|
deviceTotalMemory: () => basePropUtils.deviceTotalMemory().toString(),
|
|
110
119
|
ciCaptured: () => basePropUtils.captureCI().toString(),
|
|
111
120
|
ciType: () => basePropUtils.ciType(),
|
|
112
121
|
isMsftInternal: () => basePropUtils.isMsftInternal().toString(),
|
|
122
|
+
sampleRate: () => basePropUtils.sampleRate().toString(),
|
|
113
123
|
isTest: () => 'true',
|
|
114
124
|
};
|
|
115
125
|
for (const key in props) {
|
|
116
126
|
if (!(key in Object.prototype)) {
|
|
117
|
-
const value =
|
|
127
|
+
const value = TelemetryTest.getCommonProperty(key);
|
|
118
128
|
expect(value).toBeDefined();
|
|
119
|
-
expect(value).toBe(
|
|
129
|
+
expect(value).toBe(props[key]());
|
|
120
130
|
}
|
|
121
131
|
}
|
|
132
|
+
TelemetryTest.endTest(done);
|
|
122
133
|
});
|
|
123
|
-
test('setup() verify other common property values are defined', () => {
|
|
134
|
+
test('setup() verify other common property values are defined', async (done) => {
|
|
135
|
+
await TelemetryTest.startTest();
|
|
124
136
|
const props = ['deviceDiskFreeSpace'];
|
|
125
137
|
for (const key of props) {
|
|
126
138
|
const value = TelemetryTest.getCommonProperty(key);
|
|
127
139
|
expect(value).toBeDefined();
|
|
128
140
|
}
|
|
141
|
+
TelemetryTest.endTest(done);
|
|
129
142
|
});
|
|
130
|
-
test('setup() verify tool versions are populated', async () => {
|
|
143
|
+
test('setup() verify tool versions are populated', async (done) => {
|
|
144
|
+
await TelemetryTest.startTest();
|
|
131
145
|
const props = {
|
|
132
146
|
node: versionUtils.getNodeVersion,
|
|
133
147
|
npm: versionUtils.getNpmVersion,
|
|
@@ -140,14 +154,18 @@ test('setup() verify tool versions are populated', async () => {
|
|
|
140
154
|
expect(value).toBe(TelemetryTest.getVersion(key));
|
|
141
155
|
}
|
|
142
156
|
}
|
|
157
|
+
TelemetryTest.endTest(done);
|
|
143
158
|
});
|
|
144
|
-
test('tryUpdateVersionsProp() returns true for adding a new version', async () => {
|
|
159
|
+
test('tryUpdateVersionsProp() returns true for adding a new version', async (done) => {
|
|
160
|
+
await TelemetryTest.startTest();
|
|
145
161
|
const name = 'test';
|
|
146
162
|
const version = '1.0';
|
|
147
163
|
expect(await TelemetryTest.tryUpdateVersionsProp(name, async () => version)).toBe(true);
|
|
148
164
|
expect(TelemetryTest.getVersion(name)).toBe(version);
|
|
165
|
+
TelemetryTest.endTest(done);
|
|
149
166
|
});
|
|
150
|
-
test('tryUpdateVersionsProp() returns false for adding an existing version with refresh is false', async () => {
|
|
167
|
+
test('tryUpdateVersionsProp() returns false for adding an existing version with refresh is false', async (done) => {
|
|
168
|
+
await TelemetryTest.startTest();
|
|
151
169
|
const name = 'test';
|
|
152
170
|
const version = '1.0';
|
|
153
171
|
expect(await TelemetryTest.tryUpdateVersionsProp(name, async () => version)).toBe(true);
|
|
@@ -157,8 +175,10 @@ test('tryUpdateVersionsProp() returns false for adding an existing version with
|
|
|
157
175
|
return version;
|
|
158
176
|
})).toBe(false);
|
|
159
177
|
expect(getValueCalled).toBe(false);
|
|
178
|
+
TelemetryTest.endTest(done);
|
|
160
179
|
});
|
|
161
|
-
test('tryUpdateVersionsProp() returns true for adding an existing version with refresh is true', async () => {
|
|
180
|
+
test('tryUpdateVersionsProp() returns true for adding an existing version with refresh is true', async (done) => {
|
|
181
|
+
await TelemetryTest.startTest();
|
|
162
182
|
const name = 'test';
|
|
163
183
|
const version = '1.0';
|
|
164
184
|
expect(await TelemetryTest.tryUpdateVersionsProp(name, async () => version)).toBe(true);
|
|
@@ -168,6 +188,7 @@ test('tryUpdateVersionsProp() returns true for adding an existing version with r
|
|
|
168
188
|
return version;
|
|
169
189
|
}, true)).toBe(true);
|
|
170
190
|
expect(getValueCalled).toBe(true);
|
|
191
|
+
TelemetryTest.endTest(done);
|
|
171
192
|
});
|
|
172
193
|
/** Returns the CommandStartInfo for our fake 'test-command'. */
|
|
173
194
|
function getTestCommandStartInfo() {
|
|
@@ -261,7 +282,7 @@ async function runTestCommandE2E(commandBody) {
|
|
|
261
282
|
/** Verifys the contents of events fired during the 'test-command'. */
|
|
262
283
|
function verifyTestCommandTelemetryProcessor(caughtErrors, expectedResultCode, expectedError) {
|
|
263
284
|
return (envelope, _) => {
|
|
264
|
-
var _a, _b, _c, _d
|
|
285
|
+
var _a, _b, _c, _d;
|
|
265
286
|
try {
|
|
266
287
|
// Processor has run, so the test can (potentially) pass
|
|
267
288
|
TelemetryTest.setTestTelemetryProvidersRan();
|
|
@@ -284,18 +305,26 @@ function verifyTestCommandTelemetryProcessor(caughtErrors, expectedResultCode, e
|
|
|
284
305
|
if (envelope.data.baseType === 'ExceptionData') {
|
|
285
306
|
// Verify event name
|
|
286
307
|
expect(properties.eventName).toBe(telemetry_1.CodedErrorEventName);
|
|
308
|
+
// Verify exception info
|
|
309
|
+
const exceptions = (_b = envelope.data.baseData) === null || _b === void 0 ? void 0 : _b.exceptions;
|
|
310
|
+
expect(exceptions).toBeDefined();
|
|
311
|
+
expect(exceptions.length).toBe(1);
|
|
312
|
+
expect(exceptions[0].message).toBeDefined();
|
|
313
|
+
expect(exceptions[0].message).not.toBe('');
|
|
314
|
+
expect(exceptions[0].message).toBe(TelemetryTest.getPreserveErrorMessages()
|
|
315
|
+
? errorUtils.sanitizeErrorMessage((expectedError === null || expectedError === void 0 ? void 0 : expectedError.message) || 'None')
|
|
316
|
+
: '[Removed]');
|
|
287
317
|
// Verify coded error info
|
|
288
318
|
const codedError = JSON.parse(properties.codedError);
|
|
289
319
|
expect(codedError).toBeDefined();
|
|
290
320
|
expect(codedError.type).toBe(expectedError instanceof errorUtils.CodedError
|
|
291
321
|
? expectedError.type
|
|
292
322
|
: 'Unknown');
|
|
293
|
-
expect(codedError.
|
|
294
|
-
expect(codedError.data).toStrictEqual((_d = expectedError.data) !== null && _d !== void 0 ? _d : {});
|
|
323
|
+
expect(codedError.data).toStrictEqual((_c = expectedError.data) !== null && _c !== void 0 ? _c : {});
|
|
295
324
|
}
|
|
296
325
|
else {
|
|
297
326
|
// Verify event name
|
|
298
|
-
expect((
|
|
327
|
+
expect((_d = envelope.data.baseData) === null || _d === void 0 ? void 0 : _d.name).toBe(telemetry_1.CommandEventName);
|
|
299
328
|
expect(properties.eventName).toBe(telemetry_1.CommandEventName);
|
|
300
329
|
// Verify command info
|
|
301
330
|
const expectedInfo = getTestCommandStartInfo();
|
|
@@ -308,15 +337,7 @@ function verifyTestCommandTelemetryProcessor(caughtErrors, expectedResultCode, e
|
|
|
308
337
|
expect(command.resultCode).toBe(expectedResultCode !== null && expectedResultCode !== void 0 ? expectedResultCode : 'Success');
|
|
309
338
|
// Verify extra props
|
|
310
339
|
const extraProps = getExtraProps();
|
|
311
|
-
|
|
312
|
-
switch (typeof extraProps[key]) {
|
|
313
|
-
case 'object':
|
|
314
|
-
expect(JSON.parse(properties[key])).toStrictEqual(extraProps[key]);
|
|
315
|
-
break;
|
|
316
|
-
default:
|
|
317
|
-
expect(properties[key]).toBe(extraProps[key].toString());
|
|
318
|
-
}
|
|
319
|
-
}
|
|
340
|
+
expect(JSON.parse(properties.extraProps)).toStrictEqual(extraProps);
|
|
320
341
|
}
|
|
321
342
|
}
|
|
322
343
|
catch (ex) {
|
|
@@ -326,6 +347,7 @@ function verifyTestCommandTelemetryProcessor(caughtErrors, expectedResultCode, e
|
|
|
326
347
|
};
|
|
327
348
|
}
|
|
328
349
|
test('Telemetry run test command end to end, verify event fires', async (done) => {
|
|
350
|
+
await TelemetryTest.startTest();
|
|
329
351
|
// AI eats errors thrown in telemetry processors
|
|
330
352
|
const caughtErrors = [];
|
|
331
353
|
TelemetryTest.addTelemetryProcessor(verifyTestCommandTelemetryProcessor(caughtErrors));
|
|
@@ -336,7 +358,12 @@ test('Telemetry run test command end to end, verify event fires', async (done) =
|
|
|
336
358
|
done();
|
|
337
359
|
});
|
|
338
360
|
});
|
|
339
|
-
|
|
361
|
+
const testTelemetryOptions = [
|
|
362
|
+
{ preserveErrorMessages: false },
|
|
363
|
+
{ preserveErrorMessages: true },
|
|
364
|
+
];
|
|
365
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with CodedError, verify events fire %s', async (options, done) => {
|
|
366
|
+
await TelemetryTest.startTest(options);
|
|
340
367
|
const expectedError = new errorUtils.CodedError('MSBuildError', 'test error');
|
|
341
368
|
// AI eats errors thrown in telemetry processors
|
|
342
369
|
const caughtErrors = [];
|
|
@@ -348,7 +375,8 @@ test('Telemetry run test command end to end with CodedError, verify events fire'
|
|
|
348
375
|
done();
|
|
349
376
|
});
|
|
350
377
|
});
|
|
351
|
-
test('Telemetry run test command end to end with CodedError (with error in message), verify events fire', async (done) => {
|
|
378
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with CodedError (with error in message), verify events fire %s', async (options, done) => {
|
|
379
|
+
await TelemetryTest.startTest(options);
|
|
352
380
|
const expectedError = new errorUtils.CodedError('MSBuildError', 'error FOO2020: test error');
|
|
353
381
|
// AI eats errors thrown in telemetry processors
|
|
354
382
|
const caughtErrors = [];
|
|
@@ -360,7 +388,8 @@ test('Telemetry run test command end to end with CodedError (with error in messa
|
|
|
360
388
|
done();
|
|
361
389
|
});
|
|
362
390
|
});
|
|
363
|
-
test('Telemetry run test command end to end with CodedError (with data), verify events fire', async (done) => {
|
|
391
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with CodedError (with data), verify events fire %s', async (options, done) => {
|
|
392
|
+
await TelemetryTest.startTest(options);
|
|
364
393
|
const expectedError = new errorUtils.CodedError('MSBuildError', 'test error', { foo: 42 });
|
|
365
394
|
// AI eats errors thrown in telemetry processors
|
|
366
395
|
const caughtErrors = [];
|
|
@@ -372,7 +401,8 @@ test('Telemetry run test command end to end with CodedError (with data), verify
|
|
|
372
401
|
done();
|
|
373
402
|
});
|
|
374
403
|
});
|
|
375
|
-
test('Telemetry run test command end to end with Error, verify events fire', async (done) => {
|
|
404
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with Error, verify events fire %s', async (options, done) => {
|
|
405
|
+
await TelemetryTest.startTest(options);
|
|
376
406
|
const expectedError = new Error('error FOO2020: test error');
|
|
377
407
|
// AI eats errors thrown in telemetry processors
|
|
378
408
|
const caughtErrors = [];
|
|
@@ -384,7 +414,8 @@ test('Telemetry run test command end to end with Error, verify events fire', asy
|
|
|
384
414
|
done();
|
|
385
415
|
});
|
|
386
416
|
});
|
|
387
|
-
test('Telemetry run test command end to end with Error (no message), verify events fire', async (done) => {
|
|
417
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with Error (no message), verify events fire %s', async (options, done) => {
|
|
418
|
+
await TelemetryTest.startTest(options);
|
|
388
419
|
const expectedError = new Error();
|
|
389
420
|
// AI eats errors thrown in telemetry processors
|
|
390
421
|
const caughtErrors = [];
|
|
@@ -412,7 +443,11 @@ function getVerifyStackTelemetryProcessor(caughtErrors, expectedError) {
|
|
|
412
443
|
const data = envelope.data.baseData;
|
|
413
444
|
expect(data.exceptions).toBeDefined();
|
|
414
445
|
expect(data.exceptions.length).toBe(1);
|
|
415
|
-
expect(data.exceptions[0].message).
|
|
446
|
+
expect(data.exceptions[0].message).toBeDefined();
|
|
447
|
+
expect(data.exceptions[0].message).not.toBe('');
|
|
448
|
+
expect(data.exceptions[0].message).toBe(TelemetryTest.getPreserveErrorMessages()
|
|
449
|
+
? errorUtils.sanitizeErrorMessage(expectedError.message || 'None')
|
|
450
|
+
: '[Removed]');
|
|
416
451
|
const stack = data.exceptions[0].parsedStack;
|
|
417
452
|
expect(stack).toBeDefined();
|
|
418
453
|
expect(stack.length).toBeGreaterThan(2);
|
|
@@ -429,7 +464,8 @@ function getVerifyStackTelemetryProcessor(caughtErrors, expectedError) {
|
|
|
429
464
|
return true;
|
|
430
465
|
};
|
|
431
466
|
}
|
|
432
|
-
test('Telemetry run test command end to end with Error, verify sanitized message and stack', async (done) => {
|
|
467
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with Error, verify sanitized message and stack %s', async (options, done) => {
|
|
468
|
+
await TelemetryTest.startTest(options);
|
|
433
469
|
const expectedError = new Error('hello world');
|
|
434
470
|
// AI eats errors thrown in telemetry processors
|
|
435
471
|
const caughtErrors = [];
|
|
@@ -444,7 +480,8 @@ test('Telemetry run test command end to end with Error, verify sanitized message
|
|
|
444
480
|
done();
|
|
445
481
|
});
|
|
446
482
|
});
|
|
447
|
-
test('Telemetry run test command end to end with Error, verify sanitized message with path and stack', async (done) => {
|
|
483
|
+
test.each(testTelemetryOptions)('Telemetry run test command end to end with Error, verify sanitized message with path and stack %s', async (options, done) => {
|
|
484
|
+
await TelemetryTest.startTest(options);
|
|
448
485
|
const expectedError = new Error(`hello ${process.cwd()}`);
|
|
449
486
|
// AI eats errors thrown in telemetry processors
|
|
450
487
|
const caughtErrors = [];
|
|
@@ -0,0 +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,CA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AM,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;QACrC,IAAI,EAAE,CAAC;IACT,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 (done) => {\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(done);\n});\n\ntest('setup() verify static common property values with async sources', async (done) => {\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(done);\n});\n\ntest('setup() verify static common property values with sync sources', async (done) => {\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(done);\n});\n\ntest('setup() verify other common property values are defined', async (done) => {\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(done);\n});\n\ntest('setup() verify tool versions are populated', async (done) => {\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(done);\n});\n\ntest('tryUpdateVersionsProp() returns true for adding a new version', async (done) => {\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(done);\n});\n\ntest('tryUpdateVersionsProp() returns false for adding an existing version with refresh is false', async (done) => {\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(done);\n});\n\ntest('tryUpdateVersionsProp() returns true for adding an existing version with refresh is true', async (done) => {\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(done);\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 (done) => {\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 done();\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, done: any) => {\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 done();\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, done: any) => {\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 done();\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, done: any) => {\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 done();\n });\n },\n);\n\ntest.each(testTelemetryOptions)(\n 'Telemetry run test command end to end with Error, verify events fire %s',\n async (options, done: any) => {\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 done();\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, done: any) => {\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 done();\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('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 }\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, done: any) => {\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 done();\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, done: any) => {\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 done();\n });\n },\n);\n"]}
|
|
@@ -129,6 +129,10 @@ class Telemetry {
|
|
|
129
129
|
static async setupBaseProperties() {
|
|
130
130
|
Telemetry.client.commonProperties.deviceId =
|
|
131
131
|
await basePropUtils.deviceId();
|
|
132
|
+
Telemetry.client.commonProperties.deviceArchitecture =
|
|
133
|
+
basePropUtils.deviceArchitecture();
|
|
134
|
+
Telemetry.client.commonProperties.devicePlatform =
|
|
135
|
+
basePropUtils.devicePlatform();
|
|
132
136
|
Telemetry.client.commonProperties.deviceLocale =
|
|
133
137
|
await basePropUtils.deviceLocale();
|
|
134
138
|
Telemetry.client.commonProperties.deviceNumCPUs = basePropUtils
|
|
@@ -147,11 +151,12 @@ class Telemetry {
|
|
|
147
151
|
Telemetry.client.commonProperties.isMsftInternal = basePropUtils
|
|
148
152
|
.isMsftInternal()
|
|
149
153
|
.toString();
|
|
150
|
-
Telemetry.client.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
Telemetry.client.commonProperties.sampleRate = basePropUtils
|
|
155
|
+
.sampleRate()
|
|
156
|
+
.toString();
|
|
157
|
+
Telemetry.client.commonProperties.isTest = Telemetry.isTest.toString();
|
|
154
158
|
Telemetry.client.commonProperties.sessionId = Telemetry.getSessionId();
|
|
159
|
+
Telemetry.client.config.samplingPercentage = basePropUtils.sampleRate();
|
|
155
160
|
await Telemetry.populateToolsVersions();
|
|
156
161
|
if (Telemetry.options.populateNpmPackageVersions) {
|
|
157
162
|
await Telemetry.populateNpmPackageVersions();
|
|
@@ -193,6 +198,8 @@ class Telemetry {
|
|
|
193
198
|
for (const frame of exception.parsedStack) {
|
|
194
199
|
errorUtils.sanitizeErrorStackFrame(frame);
|
|
195
200
|
}
|
|
201
|
+
// Exception message must never be blank, or AI will reject it
|
|
202
|
+
exception.message = exception.message || '[None]';
|
|
196
203
|
// CodedError has non-PII information in its 'type' member, plus optionally some more info in its 'data'.
|
|
197
204
|
// The message may contain PII information. This can be sanitized, but for now delete it.
|
|
198
205
|
// Note that the type of data.exceptions[0] is always going to be ExceptionDetails. It is not the original thrown exception.
|
|
@@ -201,7 +208,7 @@ class Telemetry {
|
|
|
201
208
|
exception.message = errorUtils.sanitizeErrorMessage(exception.message);
|
|
202
209
|
}
|
|
203
210
|
else {
|
|
204
|
-
|
|
211
|
+
exception.message = '[Removed]';
|
|
205
212
|
}
|
|
206
213
|
}
|
|
207
214
|
}
|
|
@@ -286,15 +293,17 @@ class Telemetry {
|
|
|
286
293
|
resultCode: (_d = Telemetry.commandInfo.endInfo) === null || _d === void 0 ? void 0 : _d.resultCode,
|
|
287
294
|
};
|
|
288
295
|
// Set remaining common props
|
|
289
|
-
Object.assign(props, extraProps);
|
|
290
296
|
props.project = Telemetry.projectProp;
|
|
291
297
|
props.versions = Telemetry.versionsProp;
|
|
298
|
+
// Set extra props
|
|
299
|
+
props.extraProps = {};
|
|
300
|
+
Object.assign(props.extraProps, extraProps);
|
|
292
301
|
// Fire event
|
|
293
302
|
Telemetry.client.trackEvent({ name: props.eventName, properties: props });
|
|
294
303
|
Telemetry.client.flush();
|
|
295
304
|
}
|
|
296
305
|
static trackException(error, extraProps) {
|
|
297
|
-
var _a, _b
|
|
306
|
+
var _a, _b;
|
|
298
307
|
if (!Telemetry.client) {
|
|
299
308
|
return;
|
|
300
309
|
}
|
|
@@ -307,11 +316,20 @@ class Telemetry {
|
|
|
307
316
|
: null;
|
|
308
317
|
props.codedError = {
|
|
309
318
|
type: (_a = codedError === null || codedError === void 0 ? void 0 : codedError.type) !== null && _a !== void 0 ? _a : 'Unknown',
|
|
310
|
-
|
|
311
|
-
data: (_c = codedError === null || codedError === void 0 ? void 0 : codedError.data) !== null && _c !== void 0 ? _c : {},
|
|
319
|
+
data: (_b = codedError === null || codedError === void 0 ? void 0 : codedError.data) !== null && _b !== void 0 ? _b : {},
|
|
312
320
|
};
|
|
313
|
-
|
|
314
|
-
|
|
321
|
+
// Copy msBuildErrorMessages into the codedError.data object
|
|
322
|
+
if (error.msBuildErrorMessages) {
|
|
323
|
+
// Always grab MSBuild error codes if possible
|
|
324
|
+
props.codedError.data.msBuildErrors = error.msBuildErrorMessages
|
|
325
|
+
.map(errorUtils.tryGetErrorCode)
|
|
326
|
+
.filter((msg) => msg);
|
|
327
|
+
// Grab sanitized MSBuild error messages if we're preserving them
|
|
328
|
+
if (Telemetry.options.preserveErrorMessages) {
|
|
329
|
+
props.codedError.data.msBuildErrorMessages = error.msBuildErrorMessages
|
|
330
|
+
.map(errorUtils.sanitizeErrorMessage)
|
|
331
|
+
.filter((msg) => msg);
|
|
332
|
+
}
|
|
315
333
|
}
|
|
316
334
|
// Copy miscellaneous system error fields into the codedError.data object
|
|
317
335
|
const syscallExceptionFieldsToCopy = ['errno', 'syscall', 'code'];
|
|
@@ -321,9 +339,11 @@ class Telemetry {
|
|
|
321
339
|
}
|
|
322
340
|
}
|
|
323
341
|
// Set remaining common props
|
|
324
|
-
Object.assign(props, extraProps);
|
|
325
342
|
props.project = Telemetry.projectProp;
|
|
326
343
|
props.versions = Telemetry.versionsProp;
|
|
344
|
+
// Set extra props
|
|
345
|
+
props.extraProps = {};
|
|
346
|
+
Object.assign(props.extraProps, extraProps);
|
|
327
347
|
// Fire event
|
|
328
348
|
Telemetry.client.trackException({
|
|
329
349
|
exception: error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAAmD;AAEnD,qEAAuD;AACvD,mEAAqD;AACrD,+DAAiD;AA2BjD,sCAAsC;AACtC,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D,4DAA4D;AAC5D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD,wGAAwG;AACxG,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEpC,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACpC,QAAA,mBAAmB,GAAG,mBAAmB,CAAC;AAEv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EAAE,CAAC;IAC5B,CAAC;;AA/XH,8BAgYC;AA/XkB,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 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\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.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\n Telemetry.client!.config.samplingPercentage = basePropUtils.sampleRate();\n\n if (Telemetry.isTest) {\n Telemetry.client!.commonProperties.isTest = true.toString();\n }\n\n Telemetry.client!.commonProperties.sessionId = Telemetry.getSessionId();\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 // 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 delete exception.message;\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 Object.assign(props, extraProps);\n props.project = Telemetry.projectProp;\n props.versions = Telemetry.versionsProp;\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 rawErrorCode: errorUtils.tryGetErrorCode(error.message) ?? '',\n data: codedError?.data ?? {},\n };\n\n if (codedError?.data) {\n Object.assign(props.codedError.data, codedError.data);\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 Object.assign(props, extraProps);\n props.project = Telemetry.projectProp;\n props.versions = Telemetry.versionsProp;\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,sBAAsB;IACtB,2BAA2B;CAC5B,CAAC;AAEF,4EAA4E;AAC/D,QAAA,oBAAoB,GAAa;IAC5C,mBAAmB;IACnB,4BAA4B;IAC5B,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,MAAa,SAAS;IAeV,MAAM,CAAC,qBAAqB;;QACpC,yEAAyE;QACzE,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,mCAAI,cAAc,CAAC;IAC3D,CAAC;IAES,MAAM,CAAC,KAAK;QACpB,eAAe;QACf,IAAI,SAAS,CAAC,MAAM,EAAE;YACpB,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzB,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC;SAC9B;QAED,sBAAsB;QACtB,SAA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,KAAK;SAClB,CAAC,CAAC;QACH,SAAS,CAAC,MAAO,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AAxZH,8BAyZC;AAxZkB,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 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\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.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"]}
|
|
@@ -35,6 +35,18 @@ test('deviceId() is valid', async () => {
|
|
|
35
35
|
test('deviceId() does not change', async () => {
|
|
36
36
|
expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());
|
|
37
37
|
});
|
|
38
|
+
test('deviceArchitecture() is valid', () => {
|
|
39
|
+
const value = basePropUtils.deviceArchitecture();
|
|
40
|
+
expect(value).toBeDefined();
|
|
41
|
+
expect(value).not.toBe('');
|
|
42
|
+
expect(value).not.toBeNull();
|
|
43
|
+
});
|
|
44
|
+
test('devicePlatform() is valid', () => {
|
|
45
|
+
const value = basePropUtils.devicePlatform();
|
|
46
|
+
expect(value).toBeDefined();
|
|
47
|
+
expect(value).not.toBe('');
|
|
48
|
+
expect(value).not.toBeNull();
|
|
49
|
+
});
|
|
38
50
|
test('deviceLocale() is valid', async () => {
|
|
39
51
|
const value = await basePropUtils.deviceLocale();
|
|
40
52
|
expect(value).toBeDefined();
|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CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACnC,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACpC,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAE/B,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as basePropUtils from '../utils/basePropUtils';\n\ntest('deviceId() is valid', async () => {\n const value = await basePropUtils.deviceId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceId() does not change', async () => {\n expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());\n});\n\ntest('deviceLocale() is valid', async () => {\n const value = await basePropUtils.deviceLocale();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() does not change', async () => {\n expect(await basePropUtils.deviceLocale()).toBe(\n await basePropUtils.deviceLocale(),\n );\n});\n\ntest('deviceNumCPUs() is valid', () => {\n const value = basePropUtils.deviceNumCPUs();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceTotalMemory() is valid', () => {\n const value = basePropUtils.deviceTotalMemory();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceDiskFreeSpace() is valid', () => {\n const value = basePropUtils.deviceDiskFreeSpace();\n expect(value).toBeGreaterThanOrEqual(0);\n});\n\ntest('sampleRate() is within valid range', () => {\n const value = basePropUtils.sampleRate();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThanOrEqual(100);\n});\n\ntest('ciType() is valid', () => {\n const value = basePropUtils.ciType();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('ciType() is None when not in CI', () => {\n if (basePropUtils.isCI()) {\n expect(basePropUtils.ciType()).not.toBe('None');\n } else {\n expect(basePropUtils.ciType()).toBe('None');\n }\n});\n\ntest('isMsftInternal() is false with no domain', () => {\n delete process.env.UserDNSDomain;\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is false with example.com domain', () => {\n process.env.UserDNSDomain = 'example.com';\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is true with Msft domain', () => {\n process.env.UserDNSDomain = 'test.corp.microsoft.com';\n expect(basePropUtils.isMsftInternal()).toBe(true);\n});\n\ntest('isCliTest() is true if RNW_CLI_TEST env variable is set', () => {\n process.env.RNW_CLI_TEST = 'true';\n expect(basePropUtils.isCliTest()).toBe(true);\n});\n\ntest('isCliTest() is false if no RNW_CLI_TEST variable', () => {\n delete process.env.RNW_CLI_TEST;\n expect(basePropUtils.isCliTest()).toBe(false);\n});\n\ntest('getSessionId() is valid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n expect(value).toHaveLength(32);\n});\n\ntest('getSessionId() is a guid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toHaveLength(32);\n\n const parseGuid = () => {\n parseInt(value, 16);\n };\n\n expect(parseGuid).not.toThrow();\n});\n\ntest('getSessionId() does not change', () => {\n expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());\n});\n"]}
|
|
1
|
+
{"version":3,"file":"basePropUtils.test.js","sourceRoot":"","sources":["../../src/test/basePropUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;AAEH,sEAAwD;AAExD,IAAI,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACrC,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;IAC5C,MAAM,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC9E,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;IACzC,MAAM,KAAK,GAAG,aAAa,CAAC,kBAAkB,EAAE,CAAC;IACjD,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,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AI,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACpC,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAE/B,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as basePropUtils from '../utils/basePropUtils';\n\ntest('deviceId() is valid', async () => {\n const value = await basePropUtils.deviceId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceId() does not change', async () => {\n expect(await basePropUtils.deviceId()).toBe(await basePropUtils.deviceId());\n});\n\ntest('deviceArchitecture() is valid', () => {\n const value = basePropUtils.deviceArchitecture();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('devicePlatform() is valid', () => {\n const value = basePropUtils.devicePlatform();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() is valid', async () => {\n const value = await basePropUtils.deviceLocale();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('deviceLocale() does not change', async () => {\n expect(await basePropUtils.deviceLocale()).toBe(\n await basePropUtils.deviceLocale(),\n );\n});\n\ntest('deviceNumCPUs() is valid', () => {\n const value = basePropUtils.deviceNumCPUs();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceTotalMemory() is valid', () => {\n const value = basePropUtils.deviceTotalMemory();\n expect(value).toBeGreaterThan(0);\n});\n\ntest('deviceDiskFreeSpace() is valid', () => {\n const value = basePropUtils.deviceDiskFreeSpace();\n expect(value).toBeGreaterThanOrEqual(0);\n});\n\ntest('sampleRate() is within valid range', () => {\n const value = basePropUtils.sampleRate();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThanOrEqual(100);\n});\n\ntest('ciType() is valid', () => {\n const value = basePropUtils.ciType();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n});\n\ntest('ciType() is None when not in CI', () => {\n if (basePropUtils.isCI()) {\n expect(basePropUtils.ciType()).not.toBe('None');\n } else {\n expect(basePropUtils.ciType()).toBe('None');\n }\n});\n\ntest('isMsftInternal() is false with no domain', () => {\n delete process.env.UserDNSDomain;\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is false with example.com domain', () => {\n process.env.UserDNSDomain = 'example.com';\n expect(basePropUtils.isMsftInternal()).toBe(false);\n});\n\ntest('isMsftInternal() is true with Msft domain', () => {\n process.env.UserDNSDomain = 'test.corp.microsoft.com';\n expect(basePropUtils.isMsftInternal()).toBe(true);\n});\n\ntest('isCliTest() is true if RNW_CLI_TEST env variable is set', () => {\n process.env.RNW_CLI_TEST = 'true';\n expect(basePropUtils.isCliTest()).toBe(true);\n});\n\ntest('isCliTest() is false if no RNW_CLI_TEST variable', () => {\n delete process.env.RNW_CLI_TEST;\n expect(basePropUtils.isCliTest()).toBe(false);\n});\n\ntest('getSessionId() is valid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toBeDefined();\n expect(value).not.toBe('');\n expect(value).not.toBeNull();\n expect(value).toHaveLength(32);\n});\n\ntest('getSessionId() is a guid', () => {\n const value = basePropUtils.getSessionId();\n expect(value).toHaveLength(32);\n\n const parseGuid = () => {\n parseInt(value, 16);\n };\n\n expect(parseGuid).not.toThrow();\n});\n\ntest('getSessionId() does not change', () => {\n expect(basePropUtils.getSessionId()).toBe(basePropUtils.getSessionId());\n});\n"]}
|
|
@@ -105,6 +105,9 @@ test('sanitizeErrorMessage() with cpu id', () => {
|
|
|
105
105
|
test('sanitizeErrorMessage() with cpu/thread id', () => {
|
|
106
106
|
expect(errorUtils.sanitizeErrorMessage('5:42>This is an error')).toEqual('This is an error');
|
|
107
107
|
});
|
|
108
|
+
test('sanitizeErrorMessage() with standard MSBuild error', () => {
|
|
109
|
+
expect(errorUtils.sanitizeErrorMessage(`2:6>C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.19041.0\\XamlCompiler\\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The "CompileXaml" task returned false but did not log an error. [${process.cwd()}\\windows\\teltest68\\teltest68.csproj]`)).toEqual(`[path](486,5): error MSB4181: The CompileXaml task returned false but did not log an error. [windows]\\???.csproj(${'teltest68\\teltest68.csproj'.length})`);
|
|
110
|
+
});
|
|
108
111
|
test('sanitizeErrorStackFrame() with empty frame', () => {
|
|
109
112
|
const emptyFrame = {
|
|
110
113
|
level: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorUtils.test.js","sourceRoot":"","sources":["../../src/test/errorUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;AAIH,gEAAkD;AAElD,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACnD,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,kCAAkC,CAAC,CAAC,CAAC,IAAI,CACzE,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AAE,UAAU;QAClB,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\n\nimport * as errorUtils from '../utils/errorUtils';\n\ntest('tryGetErrorCode() with valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar error FOO2020: the thing')).toBe(\n 'FOO2020',\n );\n});\n\ntest('tryGetErrorCode() without valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar the thing')).toBeUndefined();\n});\n\ntest('tryGetErrorCode() with word error but no code', () => {\n expect(errorUtils.tryGetErrorCode('test error')).toBeUndefined();\n});\n\ntest('sanitizeErrorMessage() no-op on empty string', () => {\n expect(errorUtils.sanitizeErrorMessage('')).toBe('');\n});\n\ntest('sanitizeErrorMessage() no-op on test string', () => {\n expect(errorUtils.sanitizeErrorMessage('some text')).toBe('some text');\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is the cwd: '${process.cwd()}'`),\n ).toBe(`this is the cwd: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}'`,\n ),\n ).toBe(`uppercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}'`,\n ),\n ).toBe(`lowercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}' and something else`,\n ),\n ).toBe(`this is the cwd: [project_dir] and something else`);\n});\n\ntest('sanitizeErrorMessage() project_dir and something else', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()} and something else`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${' and something else'.length})`,\n );\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules'`,\n ),\n ).toBe(`this is the cwd: [project_dir]\\\\???(${'node_modules'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules\\\\foo'`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`uppercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`lowercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `trailing: '${process.cwd()}\\\\node_modules\\\\' and something else`,\n ),\n ).toBe(`trailing: [node_modules]\\\\???(0) and something else`);\n});\n\ntest('sanitizeErrorMessage() node_modules and something else that could be part of the path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules and something else that could be part of the path`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${\n 'node_modules and something else that could be part of the path'.length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() \\\\node_modules\\\\ a file under nm', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules\\\\ a file under nm`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${' a file under nm'.length})`);\n});\n\ntest('sanitizeErrorMessage() other path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is another path: A:\\\\foo\\\\bar\\\\baz`),\n ).toBe(`this is another path: [path]`);\n});\n\ntest(\"sanitizeErrorMessage() 'other path'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is another path: 'A:\\\\foo\\\\bar\\\\baz'`,\n ),\n ).toBe(`this is another path: [path]`);\n});\n\ntest('sanitizeErrorMessage() tracked packages in the npx cache', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `Cannot find module 'react-native/package.json'\n Require stack:\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\bin.js`,\n ),\n ).toBe(`Cannot find module react-native/package.json\n Require stack:\n - [node_modules]\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - [node_modules]\\\\react-native-windows-init\\\\bin.js`);\n});\n\ntest('sanitizeErrorMessage() forward slashes', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `EPERM: operation not permitted, scandir ${process.env.UserProfile!.replace(\n /\\\\/g,\n '/',\n )}/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include`,\n ),\n ).toBe(\n `EPERM: operation not permitted, scandir [UserProfile]\\\\???(${\n '/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include'\n .length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() file share path', () => {\n expect(errorUtils.sanitizeErrorMessage(`file here: \\\\\\\\server\\\\share`)).toBe(\n 'file here: [path]',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu id', () => {\n expect(errorUtils.sanitizeErrorMessage('5>This is an error')).toBe(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu/thread id', () => {\n expect(errorUtils.sanitizeErrorMessage('5:42>This is an error')).toEqual(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorStackFrame() with empty frame', () => {\n const emptyFrame: appInsights.Contracts.StackFrame = {\n level: 0,\n method: '',\n fileName: '',\n assembly: 'asdf',\n line: 0,\n };\n errorUtils.sanitizeErrorStackFrame(emptyFrame);\n expect(emptyFrame).toEqual({\n level: 0,\n assembly: '',\n fileName: '[path]',\n method: '',\n line: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with assembly name', () => {\n const frame1: appInsights.Contracts.StackFrame = {\n method: '',\n fileName: `${process.cwd()}\\\\foo.js`,\n assembly: 'asdf',\n level: 0,\n line: 0,\n };\n errorUtils.sanitizeErrorStackFrame(frame1);\n expect(frame1).toEqual({\n assembly: '',\n fileName: '[project_dir]\\\\???.js(6)',\n method: '',\n level: 0,\n line: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with method name', () => {\n const frame2: appInsights.Contracts.StackFrame = {\n method: `myMethod (something ${process.cwd()}`,\n fileName: `${process.cwd()}\\\\telemetry\\\\foo.js`,\n assembly: 'asdf',\n level: 1,\n line: 42,\n };\n errorUtils.sanitizeErrorStackFrame(frame2);\n expect(frame2).toEqual({\n assembly: '',\n fileName: '[project_dir]\\\\???.js(16)',\n method: 'myMethod',\n level: 1,\n line: 42,\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"errorUtils.test.js","sourceRoot":"","sources":["../../src/test/errorUtils.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;AAIH,gEAAkD;AAElD,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACnD,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,kCAAkC,CAAC,CAAC,CAAC,IAAI,CACzE,SAAS,CACV,CAAC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AAK,EAAE,CAAC;QACR,IAAI,EAAE,EAAE;KACT,CAAC;IACF,UAAU,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QACrB,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,2BAA2B;QACrC,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\n\nimport * as errorUtils from '../utils/errorUtils';\n\ntest('tryGetErrorCode() with valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar error FOO2020: the thing')).toBe(\n 'FOO2020',\n );\n});\n\ntest('tryGetErrorCode() without valid error code', () => {\n expect(errorUtils.tryGetErrorCode('foo bar the thing')).toBeUndefined();\n});\n\ntest('tryGetErrorCode() with word error but no code', () => {\n expect(errorUtils.tryGetErrorCode('test error')).toBeUndefined();\n});\n\ntest('sanitizeErrorMessage() no-op on empty string', () => {\n expect(errorUtils.sanitizeErrorMessage('')).toBe('');\n});\n\ntest('sanitizeErrorMessage() no-op on test string', () => {\n expect(errorUtils.sanitizeErrorMessage('some text')).toBe('some text');\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is the cwd: '${process.cwd()}'`),\n ).toBe(`this is the cwd: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}'`,\n ),\n ).toBe(`uppercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}'`,\n ),\n ).toBe(`lowercase: [project_dir]`);\n});\n\ntest(\"sanitizeErrorMessage() 'project_dir' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}' and something else`,\n ),\n ).toBe(`this is the cwd: [project_dir] and something else`);\n});\n\ntest('sanitizeErrorMessage() project_dir and something else', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()} and something else`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${' and something else'.length})`,\n );\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules'`,\n ),\n ).toBe(`this is the cwd: [project_dir]\\\\???(${'node_modules'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: '${process.cwd()}\\\\node_modules\\\\foo'`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' uppercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `uppercase: '${process.cwd().toUpperCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`uppercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\foo' lowercase\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `lowercase: '${process.cwd().toLowerCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toBe(`lowercase: [node_modules]\\\\???(${'foo'.length})`);\n});\n\ntest(\"sanitizeErrorMessage() 'node_modules\\\\' and something else\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `trailing: '${process.cwd()}\\\\node_modules\\\\' and something else`,\n ),\n ).toBe(`trailing: [node_modules]\\\\???(0) and something else`);\n});\n\ntest('sanitizeErrorMessage() node_modules and something else that could be part of the path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules and something else that could be part of the path`,\n ),\n ).toBe(\n `this is the cwd: [project_dir]\\\\???(${\n 'node_modules and something else that could be part of the path'.length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() \\\\node_modules\\\\ a file under nm', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules\\\\ a file under nm`,\n ),\n ).toBe(`this is the cwd: [node_modules]\\\\???(${' a file under nm'.length})`);\n});\n\ntest('sanitizeErrorMessage() other path', () => {\n expect(\n errorUtils.sanitizeErrorMessage(`this is another path: A:\\\\foo\\\\bar\\\\baz`),\n ).toBe(`this is another path: [path]`);\n});\n\ntest(\"sanitizeErrorMessage() 'other path'\", () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `this is another path: 'A:\\\\foo\\\\bar\\\\baz'`,\n ),\n ).toBe(`this is another path: [path]`);\n});\n\ntest('sanitizeErrorMessage() tracked packages in the npx cache', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `Cannot find module 'react-native/package.json'\n Require stack:\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - ${process.env.AppData}\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\bin.js`,\n ),\n ).toBe(`Cannot find module react-native/package.json\n Require stack:\n - [node_modules]\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js\n - [node_modules]\\\\react-native-windows-init\\\\bin.js`);\n});\n\ntest('sanitizeErrorMessage() forward slashes', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `EPERM: operation not permitted, scandir ${process.env.UserProfile!.replace(\n /\\\\/g,\n '/',\n )}/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include`,\n ),\n ).toBe(\n `EPERM: operation not permitted, scandir [UserProfile]\\\\???(${\n '/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include'\n .length\n })`,\n );\n});\n\ntest('sanitizeErrorMessage() file share path', () => {\n expect(errorUtils.sanitizeErrorMessage(`file here: \\\\\\\\server\\\\share`)).toBe(\n 'file here: [path]',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu id', () => {\n expect(errorUtils.sanitizeErrorMessage('5>This is an error')).toBe(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with cpu/thread id', () => {\n expect(errorUtils.sanitizeErrorMessage('5:42>This is an error')).toEqual(\n 'This is an error',\n );\n});\n\ntest('sanitizeErrorMessage() with standard MSBuild error', () => {\n expect(\n errorUtils.sanitizeErrorMessage(\n `2:6>C:\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\bin\\\\10.0.19041.0\\\\XamlCompiler\\\\Microsoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The \"CompileXaml\" task returned false but did not log an error. [${process.cwd()}\\\\windows\\\\teltest68\\\\teltest68.csproj]`,\n ),\n ).toEqual(\n `[path](486,5): error MSB4181: The CompileXaml task returned false but did not log an error. [windows]\\\\???.csproj(${\n 'teltest68\\\\teltest68.csproj'.length\n })`,\n );\n});\n\ntest('sanitizeErrorStackFrame() with empty frame', () => {\n const emptyFrame: appInsights.Contracts.StackFrame = {\n level: 0,\n method: '',\n fileName: '',\n assembly: 'asdf',\n line: 0,\n };\n errorUtils.sanitizeErrorStackFrame(emptyFrame);\n expect(emptyFrame).toEqual({\n level: 0,\n assembly: '',\n fileName: '[path]',\n method: '',\n line: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with assembly name', () => {\n const frame1: appInsights.Contracts.StackFrame = {\n method: '',\n fileName: `${process.cwd()}\\\\foo.js`,\n assembly: 'asdf',\n level: 0,\n line: 0,\n };\n errorUtils.sanitizeErrorStackFrame(frame1);\n expect(frame1).toEqual({\n assembly: '',\n fileName: '[project_dir]\\\\???.js(6)',\n method: '',\n level: 0,\n line: 0,\n });\n});\n\ntest('sanitizeErrorStackFrame() with method name', () => {\n const frame2: appInsights.Contracts.StackFrame = {\n method: `myMethod (something ${process.cwd()}`,\n fileName: `${process.cwd()}\\\\telemetry\\\\foo.js`,\n assembly: 'asdf',\n level: 1,\n line: 42,\n };\n errorUtils.sanitizeErrorStackFrame(frame2);\n expect(frame2).toEqual({\n assembly: '',\n fileName: '[project_dir]\\\\???.js(16)',\n method: 'myMethod',\n level: 1,\n line: 42,\n });\n});\n"]}
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
* @returns A telemetry-safe stable device ID.
|
|
9
9
|
*/
|
|
10
10
|
export declare function deviceId(): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the device architecture, like x64/arm64.
|
|
13
|
+
* @returns The device architecture.
|
|
14
|
+
*/
|
|
15
|
+
export declare function deviceArchitecture(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the device platform, like darwin/linux/win32.
|
|
18
|
+
* @returns The device platform.
|
|
19
|
+
*/
|
|
20
|
+
export declare function devicePlatform(): string;
|
|
11
21
|
/**
|
|
12
22
|
* Gets the device locale.
|
|
13
23
|
* @returns The device locale.
|
|
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.getSessionId = exports.isCliTest = exports.isMsftInternal = exports.ciType = exports.isCI = exports.captureCI = exports.sampleRate = exports.deviceDiskFreeSpace = exports.deviceTotalMemory = exports.deviceNumCPUs = exports.deviceLocale = exports.deviceId = void 0;
|
|
11
|
+
exports.getSessionId = exports.isCliTest = exports.isMsftInternal = exports.ciType = exports.isCI = exports.captureCI = exports.sampleRate = exports.deviceDiskFreeSpace = exports.deviceTotalMemory = exports.deviceNumCPUs = exports.deviceLocale = exports.devicePlatform = exports.deviceArchitecture = exports.deviceId = void 0;
|
|
12
12
|
const child_process_1 = require("child_process");
|
|
13
13
|
const os_1 = require("os");
|
|
14
14
|
const ci_info_1 = __importDefault(require("ci-info"));
|
|
@@ -23,6 +23,22 @@ async function deviceId() {
|
|
|
23
23
|
return await (0, node_machine_id_1.machineId)(false);
|
|
24
24
|
}
|
|
25
25
|
exports.deviceId = deviceId;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the device architecture, like x64/arm64.
|
|
28
|
+
* @returns The device architecture.
|
|
29
|
+
*/
|
|
30
|
+
function deviceArchitecture() {
|
|
31
|
+
return (0, os_1.arch)();
|
|
32
|
+
}
|
|
33
|
+
exports.deviceArchitecture = deviceArchitecture;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the device platform, like darwin/linux/win32.
|
|
36
|
+
* @returns The device platform.
|
|
37
|
+
*/
|
|
38
|
+
function devicePlatform() {
|
|
39
|
+
return (0, os_1.platform)();
|
|
40
|
+
}
|
|
41
|
+
exports.devicePlatform = devicePlatform;
|
|
26
42
|
/**
|
|
27
43
|
* Gets the device locale.
|
|
28
44
|
* @returns The device locale.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basePropUtils.js","sourceRoot":"","sources":["../../src/utils/basePropUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,iDAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"basePropUtils.js","sourceRoot":"","sources":["../../src/utils/basePropUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,iDAAuC;AACvC,2BAAkD;AAElD,sDAAyB;AACzB,mCAAmC;AACnC,qDAA0C;AAC1C,0DAAiC;AAEjC;;;GAGG;AACI,KAAK,UAAU,QAAQ;IAC5B,OAAO,MAAM,IAAA,2BAAS,EAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB;IAChC,OAAO,IAAA,SAAI,GAAE,CAAC;AAChB,CAAC;A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,iBAAE,CAAC,IAAI,CAAC;AACjB,CAAC;AAFD,oBAEC;AAED;;;GAGG;AACH,SAAgB,MAAM;;IACpB,OAAO,iBAAE,CAAC,IAAI,CAAC,CAAC,CAAC,MAAA,iBAAE,CAAC,IAAI,mCAAI,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC;AAFD,wBAEC;AAED;;;GAGG;AACH,SAAgB,cAAc;IAC5B,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,SAAS;QACvC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CACvE,CAAC;AACJ,CAAC;AALD,wCAKC;AAED;;;GAGG;AACH,SAAgB,SAAS;IACvB,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,SAAS;QACtC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,MAAM,CACzD,CAAC;AACJ,CAAC;AALD,8BAKC;AAED,IAAI,SAA6B,CAAC;AAElC;;;GAGG;AACH,SAAgB,YAAY;IAC1B,OAAO,CACL,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,CAAC,SAAS,GAAG,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC;AAJD,oCAIC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {execSync} from 'child_process';\nimport {totalmem, cpus, arch, platform} from 'os';\n\nimport ci from 'ci-info';\nimport {randomBytes} from 'crypto';\nimport {machineId} from 'node-machine-id';\nimport osLocale from 'os-locale';\n\n/**\n * Gets a telemetry-safe stable device ID.\n * @returns A telemetry-safe stable device ID.\n */\nexport async function deviceId(): Promise<string> {\n return await machineId(false);\n}\n\n/**\n * Gets the device architecture, like x64/arm64.\n * @returns The device architecture.\n */\nexport function deviceArchitecture(): string {\n return arch();\n}\n\n/**\n * Gets the device platform, like darwin/linux/win32.\n * @returns The device platform.\n */\nexport function devicePlatform(): string {\n return platform();\n}\n\n/**\n * Gets the device locale.\n * @returns The device locale.\n */\nexport async function deviceLocale(): Promise<string> {\n return await osLocale();\n}\n\n/**\n * Gets the device's number of CPUs.\n * @returns The device's number of CPUs.\n */\nexport function deviceNumCPUs(): number {\n return cpus().length;\n}\n\n/**\n * Gets the device's total memory in bytes.\n * @returns The device's total memory in bytes.\n */\nexport function deviceTotalMemory(): number {\n return totalmem();\n}\n\n/**\n * Gets the free space of the give drive in bytes.\n * @param drivePath A path on the drive to check.\n * @returns The free space of the give drive in bytes.\n */\nexport function deviceDiskFreeSpace(drivePath?: string | null): number {\n try {\n const out = execSync(`dir /-C ${drivePath ?? process.cwd()}`)\n .toString()\n .split('\\r\\n');\n const line = out[out.length - 2];\n const result = line.match(/(\\d+) [^\\d]+(\\d+) /);\n if (result && result.length > 2) {\n return Number(result[2]);\n }\n } catch {}\n return -1;\n}\n\n/**\n * Gets the telemetry sample rate.\n * @returns The telemetry sample rate.\n */\nexport function sampleRate(): number {\n return 100;\n}\n\n/**\n * Gets whether or not telemetry events are captured when running in CI.\n * @returns Whether or not telemetry events are captured when running in CI.\n */\nexport function captureCI(): boolean {\n // Only capture events in CI if running tests\n return isCliTest();\n}\n\n/**\n * Gets the whether the process is currently running in CI.\n * @returns Whether the process is currently running in CI.\n */\nexport function isCI(): boolean {\n return ci.isCI;\n}\n\n/**\n * Gets the type of CI the process is running under.\n * @returns The type of CI the process is running under.\n */\nexport function ciType(): string {\n return ci.isCI ? ci.name ?? 'Unknown' : 'None';\n}\n\n/**\n * Gets whether the process is running on a Microsoft owned machine.\n * @returns Whether the process is running on a Microsoft owned machine.\n */\nexport function isMsftInternal(): boolean {\n return (\n process.env.UserDNSDomain !== undefined &&\n process.env.UserDNSDomain.toLowerCase().endsWith('corp.microsoft.com')\n );\n}\n\n/**\n * Gets whether the process is running as part of our CLI tests.\n * @returns Whether the process is running as part of our CLI tests.\n */\nexport function isCliTest(): boolean {\n return (\n process.env.RNW_CLI_TEST !== undefined &&\n process.env.RNW_CLI_TEST.toLowerCase().trim() === 'true'\n );\n}\n\nlet sessionId: string | undefined;\n\n/**\n * Gets a stable session ID for correlating telemetry events.\n * @returns A stable session ID for correlating telemetry events.\n */\nexport function getSessionId(): string {\n return (\n sessionId ?? (sessionId = randomBytes(16).toString('hex').padStart(32, '0'))\n );\n}\n"]}
|
|
@@ -115,6 +115,8 @@ exports.tryGetErrorCode = tryGetErrorCode;
|
|
|
115
115
|
* @return The message with any paths anonymized.
|
|
116
116
|
*/
|
|
117
117
|
function sanitizeErrorMessage(msg) {
|
|
118
|
+
const msBuildErrorMessage = /^\d+:\d+>(.*)(\(\d+,\d+\)): error (\w+\d+): (.*)/g;
|
|
119
|
+
msg = msg.replace(msBuildErrorMessage, '[$1]$2: error $3: $4');
|
|
118
120
|
const cpuThreadId = /^\d+(:\d+)?>/g;
|
|
119
121
|
msg = msg.replace(cpuThreadId, '');
|
|
120
122
|
const parts = msg.split(/['[\]"]/g);
|
|
@@ -1 +1 @@
|
|
|
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,OAAO;IACP,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;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AAM,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 // 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\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"]}
|
|
@@ -56,7 +56,7 @@ function getAnonymizedPath(filepath, projectRoot) {
|
|
|
56
56
|
const rest = filepath.slice(projectRoot.length);
|
|
57
57
|
if (rest.toLowerCase().startsWith(windows)) {
|
|
58
58
|
// We are under the windows path, anonymize with [windows]
|
|
59
|
-
return `[windows]\\???${ext}(${rest.length - windows.length
|
|
59
|
+
return `[windows]\\???${ext}(${rest.length - windows.length})`;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
// We are just within the projectRoot, anonymize with [project_dir]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeUtils.js","sourceRoot":"","sources":["../../src/utils/sanitizeUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,gDAAwB;AAExB,4CAAgD;AAEhD,MAAM,WAAW,GAAG,kBAAkB,CAA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AC,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC9C,GAAG,CAAC;aACL;SACF;KACF;IAED,2DAA2D;IAC3D,KAAK,MAAM,SAAS,IAAI,6BAA6B,EAAE;QACrD,IACE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;YACtB,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC,WAAW,EAAE,CAAC,EACxE;YACA,OAAO,IAAI,SAAS,UAClB,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC,MAC5C,GAAG,CAAC;SACL;KACF;IAED,+CAA+C;IAC/C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzED,8CAyEC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport path from 'path';\n\nimport {NpmPackagesWeTrack} from '../telemetry';\n\nconst nodeModules = '\\\\node_modules\\\\';\nconst windows = '\\\\windows\\\\';\n\nconst knownEnvironmentVariablePaths = [\n 'AppData',\n 'LocalAppData',\n 'UserProfile',\n];\n\n/**\n * Gets an anonymized version of the given path, suitable for Telemetry.\n * @param filepath The path to anonymize.\n * @param projectRoot Optional root path for the project. Defaults to process.cwd().\n * @returns The anonymized path.\n */\nexport function getAnonymizedPath(\n filepath: string,\n projectRoot?: string,\n): string {\n projectRoot = (projectRoot ?? process.cwd())\n .replace(/\\//g, '\\\\')\n .toLowerCase();\n projectRoot = projectRoot.endsWith('\\\\')\n ? projectRoot.slice(0, -1)\n : projectRoot;\n filepath = filepath.replace(/\\//g, '\\\\');\n\n const ext = path.extname(filepath);\n\n // Check if we're under node_modules\n const nodeModulesIndex = filepath.toLowerCase().lastIndexOf(nodeModules);\n if (nodeModulesIndex >= 0) {\n // We are under node_modules\n\n // Check if it's an npm package we're tracking\n for (const trackedNpmPackage of NpmPackagesWeTrack) {\n const startIndex = filepath\n .toLowerCase()\n .lastIndexOf(\n nodeModules + trackedNpmPackage.replace(/\\//g, '\\\\') + '\\\\',\n );\n if (startIndex >= 0) {\n // We are under node_modules within an npm package we're tracking, anonymize by removing root\n return (\n '[node_modules]\\\\' + filepath.slice(startIndex + nodeModules.length)\n );\n }\n }\n\n // It's an npm package we're not tracking, anonymize with [node_modules]\n return `[node_modules]\\\\???${ext}(${\n filepath.slice(nodeModulesIndex).length - nodeModules.length\n })`;\n }\n\n // Check if we're under the projectRoot\n if (filepath.toLowerCase().startsWith(projectRoot)) {\n // We are under the projectRoot\n const rest = filepath.slice(projectRoot.length);\n if (rest.toLowerCase().startsWith(windows)) {\n // We are under the windows path, anonymize with [windows]\n return `[windows]\\\\???${ext}(${rest.length - windows.length})`;\n } else {\n // We are just within the projectRoot, anonymize with [project_dir]\n if (rest === '' || rest === '\\\\') {\n return '[project_dir]';\n } else {\n return `[project_dir]\\\\???${ext}(${\n rest.length - (rest.startsWith('\\\\') ? 1 : 0)\n })`;\n }\n }\n }\n\n // Check if we're under a known environmental variable path\n for (const knownPath of knownEnvironmentVariablePaths) {\n if (\n process.env[knownPath] &&\n filepath.toLowerCase().startsWith(process.env[knownPath]!.toLowerCase())\n ) {\n return `[${knownPath}]\\\\???(${\n filepath.length - process.env[knownPath]!.length\n })`;\n }\n }\n\n // We are somewhere else, anonymize with [path]\n return '[path]';\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.test.js","sourceRoot":"","sources":["../../src/test/telemetry.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;AAGH,2CAA6B;AAE7B,4CAMsB;AACtB,sEAAwD;AACxD,gEAAkD;AAClD,oEAAsD;AACtD,oEAAsD;AAEtD,MAAa,aAAc,SAAQ,qBAAS;IAI1C,yCAAyC;IACzC,MAAM,CA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AI,EAAE,EAAE;IACpH,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;QACrC,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport * as appInsights from 'applicationinsights';\nimport * as path from 'path';\n\nimport {\n Telemetry,\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() {\n TelemetryTest.hasTestTelemetryProviders = false;\n TelemetryTest.testTelemetryProvidersRan = false;\n\n jest.setTimeout(10000); // These E2E tests can run longer than the default 5000ms\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({preserveErrorMessages: true});\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 finalCallback();\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 /** 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\nbeforeEach(async () => {\n await TelemetryTest.startTest();\n});\n\ntest('setup() verify session id is valid and a common property', async () => {\n const sessionId = TelemetryTest.getSessionId();\n expect(sessionId).toBeDefined();\n expect(sessionId!).toHaveLength(32);\n expect(sessionId!).toBe(basePropUtils.getSessionId());\n expect(sessionId!).toBe(TelemetryTest.getCommonProperty('sessionId'));\n});\n\ntest('setup() verify static common property values with async sources', async () => {\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 = await props[key]();\n expect(value).toBeDefined();\n expect(value).toBe(TelemetryTest.getCommonProperty(key));\n }\n }\n});\n\ntest('setup() verify static common property values with sync sources', () => {\n const props: Record<string, () => string | undefined> = {\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 isTest: () => 'true',\n };\n\n for (const key in props) {\n if (!(key in Object.prototype)) {\n const value = props[key]();\n expect(value).toBeDefined();\n expect(value).toBe(TelemetryTest.getCommonProperty(key));\n }\n }\n});\n\ntest('setup() verify other common property values are defined', () => {\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\ntest('setup() verify tool versions are populated', async () => {\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\ntest('tryUpdateVersionsProp() returns true for adding a new version', async () => {\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\ntest('tryUpdateVersionsProp() returns false for adding an existing version with refresh is false', async () => {\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\ntest('tryUpdateVersionsProp() returns true for adding an existing version with refresh is true', async () => {\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\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 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 expect(codedError.rawErrorCode).toBe(\n errorUtils.tryGetErrorCode(expectedError?.message ?? '') ?? '',\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 for (const key of Object.keys(extraProps)) {\n switch (typeof extraProps[key]) {\n case 'object':\n expect(JSON.parse(properties[key])).toStrictEqual(\n extraProps[key],\n );\n break;\n default:\n expect(properties[key]).toBe(extraProps[key].toString());\n }\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('Telemetry run test command end to end, verify event fires', async (done) => {\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 done();\n });\n});\n\ntest('Telemetry run test command end to end with CodedError, verify events fire', async (done) => {\n const expectedError = new errorUtils.CodedError('MSBuildError', 'test error');\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 done();\n });\n});\n\ntest('Telemetry run test command end to end with CodedError (with error in message), verify events fire', async (done) => {\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 done();\n });\n});\n\ntest('Telemetry run test command end to end with CodedError (with data), verify events fire', async (done) => {\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 done();\n });\n});\n\ntest('Telemetry run test command end to end with Error, verify events fire', async (done) => {\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(caughtErrors, 'Unknown', expectedError),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n done();\n });\n});\n\ntest('Telemetry run test command end to end with Error (no message), verify events fire', async (done) => {\n const expectedError = new Error();\n\n // AI eats errors thrown in telemetry processors\n const caughtErrors: Error[] = [];\n TelemetryTest.addTelemetryProcessor(\n verifyTestCommandTelemetryProcessor(caughtErrors, 'Unknown', expectedError),\n );\n\n await runTestCommandE2E(() => testCommandBody(expectedError));\n\n TelemetryTest.endTest(() => {\n // Check if any errors were thrown\n expect(caughtErrors).toHaveLength(0);\n done();\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).toBe(\n errorUtils.sanitizeErrorMessage(expectedError.message),\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('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 }\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 with Error, verify sanitized message and stack', async (done) => {\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 done();\n });\n});\n\ntest('Telemetry run test command end to end with Error, verify sanitized message with path and stack', async (done) => {\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 done();\n });\n});\n"]}
|