@react-native-windows/telemetry 0.67.1 → 0.68.0
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/index.d.ts +5 -2
- package/lib-commonjs/index.js +14 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/telemetry.d.ts +75 -20
- package/lib-commonjs/telemetry.js +284 -168
- package/lib-commonjs/telemetry.js.map +1 -1
- package/lib-commonjs/test/{sanitize.test.d.ts → basePropUtils.test.d.ts} +0 -0
- package/lib-commonjs/test/basePropUtils.test.js +116 -0
- package/lib-commonjs/test/basePropUtils.test.js.map +1 -0
- package/lib-commonjs/test/errorUtils.test.d.ts +7 -0
- package/lib-commonjs/test/errorUtils.test.js +159 -0
- package/lib-commonjs/test/errorUtils.test.js.map +1 -0
- package/lib-commonjs/test/projectUtils.test.d.ts +7 -0
- package/lib-commonjs/test/projectUtils.test.js +84 -0
- package/lib-commonjs/test/projectUtils.test.js.map +1 -0
- package/lib-commonjs/test/sanitizeUtils.test.d.ts +7 -0
- package/lib-commonjs/test/sanitizeUtils.test.js +94 -0
- package/lib-commonjs/test/sanitizeUtils.test.js.map +1 -0
- package/lib-commonjs/test/telemetry.test.d.ts +26 -0
- package/lib-commonjs/test/telemetry.test.js +469 -0
- package/lib-commonjs/test/telemetry.test.js.map +1 -0
- package/lib-commonjs/test/versionUtils.test.d.ts +7 -0
- package/lib-commonjs/test/versionUtils.test.js +111 -0
- package/lib-commonjs/test/versionUtils.test.js.map +1 -0
- package/lib-commonjs/utils/basePropUtils.d.ts +66 -0
- package/lib-commonjs/utils/basePropUtils.js +131 -0
- package/lib-commonjs/utils/basePropUtils.js.map +1 -0
- package/lib-commonjs/{CodedError.d.ts → utils/errorUtils.d.ts} +27 -8
- package/lib-commonjs/utils/errorUtils.js +164 -0
- package/lib-commonjs/utils/errorUtils.js.map +1 -0
- package/lib-commonjs/utils/optionUtils.d.ts +45 -0
- package/lib-commonjs/utils/optionUtils.js +96 -0
- package/lib-commonjs/utils/optionUtils.js.map +1 -0
- package/lib-commonjs/utils/projectUtils.d.ts +50 -0
- package/lib-commonjs/utils/projectUtils.js +187 -0
- package/lib-commonjs/utils/projectUtils.js.map +1 -0
- package/lib-commonjs/utils/sanitizeUtils.d.ts +12 -0
- package/lib-commonjs/utils/sanitizeUtils.js +82 -0
- package/lib-commonjs/utils/sanitizeUtils.js.map +1 -0
- package/lib-commonjs/utils/versionUtils.d.ts +38 -0
- package/lib-commonjs/utils/versionUtils.js +156 -0
- package/lib-commonjs/utils/versionUtils.js.map +1 -0
- package/package.json +20 -9
- package/CHANGELOG.json +0 -618
- package/CHANGELOG.md +0 -260
- package/lib-commonjs/CodedError.js +0 -77
- package/lib-commonjs/CodedError.js.map +0 -1
- package/lib-commonjs/test/sanitize.test.js +0 -259
- package/lib-commonjs/test/sanitize.test.js.map +0 -1
package/CHANGELOG.md
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
# Change Log - @react-native-windows/telemetry
|
|
2
|
-
|
|
3
|
-
This log was last generated on Mon, 04 Apr 2022 15:12:55 GMT and should not be manually modified.
|
|
4
|
-
|
|
5
|
-
<!-- Start content -->
|
|
6
|
-
|
|
7
|
-
## 0.67.1
|
|
8
|
-
|
|
9
|
-
Mon, 04 Apr 2022 15:12:55 GMT
|
|
10
|
-
|
|
11
|
-
### Patches
|
|
12
|
-
|
|
13
|
-
- Promote 0.67 to legacy (34109996+chiaramooney@users.noreply.github.com)
|
|
14
|
-
|
|
15
|
-
## 0.67.0
|
|
16
|
-
|
|
17
|
-
Mon, 24 Jan 2022 16:13:22 GMT
|
|
18
|
-
|
|
19
|
-
### Patches
|
|
20
|
-
|
|
21
|
-
- Promote 0.67 to latest (ngerlem@microsoft.com)
|
|
22
|
-
|
|
23
|
-
## 0.67.0
|
|
24
|
-
|
|
25
|
-
Mon, 24 Jan 2022 16:12:32 GMT
|
|
26
|
-
|
|
27
|
-
### Patches
|
|
28
|
-
|
|
29
|
-
- Promote 0.67 to latest (ngerlem@microsoft.com)
|
|
30
|
-
|
|
31
|
-
## 0.67.0-preview.1
|
|
32
|
-
|
|
33
|
-
Mon, 25 Oct 2021 15:07:48 GMT
|
|
34
|
-
|
|
35
|
-
### Changes
|
|
36
|
-
|
|
37
|
-
- Promote 0.67 to preview (ngerlem@microsoft.com)
|
|
38
|
-
|
|
39
|
-
## 0.67.0-preview.1
|
|
40
|
-
|
|
41
|
-
Mon, 25 Oct 2021 15:07:19 GMT
|
|
42
|
-
|
|
43
|
-
### Changes
|
|
44
|
-
|
|
45
|
-
- Promote 0.67 to preview (ngerlem@microsoft.com)
|
|
46
|
-
|
|
47
|
-
## 0.0.0-canary.24
|
|
48
|
-
|
|
49
|
-
Thu, 21 Oct 2021 05:08:01 GMT
|
|
50
|
-
|
|
51
|
-
### Changes
|
|
52
|
-
|
|
53
|
-
- Update to typescript 4 (30809111+acoates-ms@users.noreply.github.com)
|
|
54
|
-
|
|
55
|
-
## 0.0.0-canary.23
|
|
56
|
-
|
|
57
|
-
Wed, 08 Sep 2021 05:08:53 GMT
|
|
58
|
-
|
|
59
|
-
### Patches
|
|
60
|
-
|
|
61
|
-
- Bump @rnw-scripts/jest-unittest-config to v1.2.4 (ngerlem@microsoft.com)
|
|
62
|
-
- Bump @rnw-scripts/just-task to v2.2.1 (ngerlem@microsoft.com)
|
|
63
|
-
- Bump @rnw-scripts/ts-config to v2.0.1 (ngerlem@microsoft.com)
|
|
64
|
-
- Bump @rnw-scripts/eslint-config to v1.1.8 (ngerlem@microsoft.com)
|
|
65
|
-
|
|
66
|
-
### Changes
|
|
67
|
-
|
|
68
|
-
- Set consistent node requirements on our packages (ngerlem@microsoft.com)
|
|
69
|
-
|
|
70
|
-
## 0.0.0-canary.22
|
|
71
|
-
|
|
72
|
-
Sat, 26 Jun 2021 05:06:48 GMT
|
|
73
|
-
|
|
74
|
-
### Changes
|
|
75
|
-
|
|
76
|
-
- Upgrade to boost 1.76.0.0 (julio.rocha@microsoft.com)
|
|
77
|
-
|
|
78
|
-
## 0.0.0-canary.21
|
|
79
|
-
|
|
80
|
-
Fri, 11 Jun 2021 05:08:55 GMT
|
|
81
|
-
|
|
82
|
-
### Patches
|
|
83
|
-
|
|
84
|
-
- Bump @rnw-scripts/just-task to v2.2.0 (ngerlem@microsoft.com)
|
|
85
|
-
|
|
86
|
-
### Changes
|
|
87
|
-
|
|
88
|
-
- Mark windowsOnly (ngerlem@microsoft.com)
|
|
89
|
-
|
|
90
|
-
## 0.0.0-canary.20
|
|
91
|
-
|
|
92
|
-
Wed, 09 Jun 2021 05:10:07 GMT
|
|
93
|
-
|
|
94
|
-
### Patches
|
|
95
|
-
|
|
96
|
-
- Bump @rnw-scripts/just-task to v2.1.3 (igklemen@microsoft.com)
|
|
97
|
-
- Bump @rnw-scripts/jest-unittest-config to v1.2.3 (igklemen@microsoft.com)
|
|
98
|
-
|
|
99
|
-
## 0.0.0-canary.19
|
|
100
|
-
|
|
101
|
-
Thu, 03 Jun 2021 05:09:47 GMT
|
|
102
|
-
|
|
103
|
-
### Patches
|
|
104
|
-
|
|
105
|
-
- Bump @rnw-scripts/just-task to v2.1.2 (ngerlem@microsoft.com)
|
|
106
|
-
- Bump @rnw-scripts/ts-config to v2.0.0 (ngerlem@microsoft.com)
|
|
107
|
-
- Bump @rnw-scripts/eslint-config to v1.1.7 (ngerlem@microsoft.com)
|
|
108
|
-
- Bump @rnw-scripts/jest-unittest-config to v1.2.2 (ngerlem@microsoft.com)
|
|
109
|
-
|
|
110
|
-
### Changes
|
|
111
|
-
|
|
112
|
-
- Enable esModuleInterop Repo Wide (ngerlem@microsoft.com)
|
|
113
|
-
|
|
114
|
-
## 0.0.0-canary.18
|
|
115
|
-
|
|
116
|
-
Fri, 21 May 2021 05:17:18 GMT
|
|
117
|
-
|
|
118
|
-
### Patches
|
|
119
|
-
|
|
120
|
-
- Bump @rnw-scripts/just-task to v2.1.1 (ngerlem@microsoft.com)
|
|
121
|
-
- Bump @rnw-scripts/jest-unittest-config to v1.2.1 (ngerlem@microsoft.com)
|
|
122
|
-
|
|
123
|
-
### Changes
|
|
124
|
-
|
|
125
|
-
- Integrate Apr 28 (base of 0.65) Nightly RN Build (ngerlem@microsoft.com)
|
|
126
|
-
|
|
127
|
-
## 0.0.0-canary.17
|
|
128
|
-
|
|
129
|
-
Thu, 11 Feb 2021 05:08:29 GMT
|
|
130
|
-
|
|
131
|
-
### Patches
|
|
132
|
-
|
|
133
|
-
- Bump @rnw-scripts/just-task to v2.1.0 (ngerlem@microsoft.com)
|
|
134
|
-
- Bump @rnw-scripts/jest-unittest-config to v1.2.0 (ngerlem@microsoft.com)
|
|
135
|
-
|
|
136
|
-
## 0.0.0-canary.16
|
|
137
|
-
|
|
138
|
-
Tue, 09 Feb 2021 05:07:37 GMT
|
|
139
|
-
|
|
140
|
-
### Patches
|
|
141
|
-
|
|
142
|
-
- Bump @rnw-scripts/just-task to v2.0.2 (dannyvv@microsoft.com)
|
|
143
|
-
|
|
144
|
-
### Changes
|
|
145
|
-
|
|
146
|
-
- Bump just-scripts from 1.3.2 to 1.3.3 (dannyvv@microsoft.com)
|
|
147
|
-
|
|
148
|
-
## 0.0.0-canary.15
|
|
149
|
-
|
|
150
|
-
Thu, 28 Jan 2021 05:06:47 GMT
|
|
151
|
-
|
|
152
|
-
### Patches
|
|
153
|
-
|
|
154
|
-
- Bump @rnw-scripts/just-task to v2.0.1 (dannyvv@microsoft.com)
|
|
155
|
-
|
|
156
|
-
### Changes
|
|
157
|
-
|
|
158
|
-
- Leverage default config support in Just library and factor out common tasks (dannyvv@microsoft.com)
|
|
159
|
-
|
|
160
|
-
## 0.0.0-canary.14
|
|
161
|
-
|
|
162
|
-
Tue, 26 Jan 2021 05:06:39 GMT
|
|
163
|
-
|
|
164
|
-
### Patches
|
|
165
|
-
|
|
166
|
-
- Bump @rnw-scripts/just-task to v2.0.0 (ngerlem@microsoft.com)
|
|
167
|
-
|
|
168
|
-
### Changes
|
|
169
|
-
|
|
170
|
-
- Update @types package versions in package.json from dependabot updates to yarn.lock (dannyvv@microsoft.com)
|
|
171
|
-
|
|
172
|
-
## 0.0.0-canary.13
|
|
173
|
-
|
|
174
|
-
Fri, 15 Jan 2021 05:07:01 GMT
|
|
175
|
-
|
|
176
|
-
### Changes
|
|
177
|
-
|
|
178
|
-
- Remove appium from package dependency (dannyvv@microsoft.com)
|
|
179
|
-
|
|
180
|
-
## 0.0.0-canary.12
|
|
181
|
-
|
|
182
|
-
Tue, 05 Jan 2021 05:06:42 GMT
|
|
183
|
-
|
|
184
|
-
### Changes
|
|
185
|
-
|
|
186
|
-
- Rework error reporting/telemetry to only log the minimal amount of data (asklar@microsoft.com)
|
|
187
|
-
|
|
188
|
-
## 0.0.0-canary.11
|
|
189
|
-
|
|
190
|
-
Thu, 03 Dec 2020 23:59:32 GMT
|
|
191
|
-
|
|
192
|
-
### Changes
|
|
193
|
-
|
|
194
|
-
- Manual bump of @react-native-windows/telemetry to cause dependents to be republished (ngerlem@microsoft.com)
|
|
195
|
-
|
|
196
|
-
## 0.0.0-canary.10
|
|
197
|
-
|
|
198
|
-
Tue, 24 Nov 2020 05:08:17 GMT
|
|
199
|
-
|
|
200
|
-
### Changes
|
|
201
|
-
|
|
202
|
-
- Fixup naming convention rules (ngerlem@microsoft.com)
|
|
203
|
-
|
|
204
|
-
## 0.0.0-canary.8
|
|
205
|
-
|
|
206
|
-
Mon, 16 Nov 2020 14:39:19 GMT
|
|
207
|
-
|
|
208
|
-
### Changes
|
|
209
|
-
|
|
210
|
-
- anonymize paths with forward slashes and file shares (asklar@microsoft.com)
|
|
211
|
-
|
|
212
|
-
## 0.0.0-canary.7
|
|
213
|
-
|
|
214
|
-
Thu, 12 Nov 2020 05:05:57 GMT
|
|
215
|
-
|
|
216
|
-
### Changes
|
|
217
|
-
|
|
218
|
-
- Disable telemetry in other CI systems (asklar@microsoft.com)
|
|
219
|
-
|
|
220
|
-
## 0.0.0-canary.6
|
|
221
|
-
|
|
222
|
-
Wed, 11 Nov 2020 05:05:29 GMT
|
|
223
|
-
|
|
224
|
-
### Changes
|
|
225
|
-
|
|
226
|
-
- Silence warnings from appinsights in production (asklar@microsoft.com)
|
|
227
|
-
|
|
228
|
-
## 0.0.0-canary.5
|
|
229
|
-
|
|
230
|
-
Sat, 07 Nov 2020 05:04:58 GMT
|
|
231
|
-
|
|
232
|
-
### Changes
|
|
233
|
-
|
|
234
|
-
- Fix casing of msft domain (asklar@microsoft.com)
|
|
235
|
-
|
|
236
|
-
## 0.0.0-canary.4
|
|
237
|
-
|
|
238
|
-
Fri, 06 Nov 2020 05:06:31 GMT
|
|
239
|
-
|
|
240
|
-
### Changes
|
|
241
|
-
|
|
242
|
-
- Remove roleInstance property (asklar@microsoft.com)
|
|
243
|
-
|
|
244
|
-
## 0.0.0-canary.3
|
|
245
|
-
|
|
246
|
-
Thu, 05 Nov 2020 17:30:59 GMT
|
|
247
|
-
|
|
248
|
-
### Changes
|
|
249
|
-
|
|
250
|
-
- sanitize paths in other drives too (asklar@microsoft.com)
|
|
251
|
-
|
|
252
|
-
## 0.0.0-canary.2
|
|
253
|
-
|
|
254
|
-
Thu, 05 Nov 2020 05:05:45 GMT
|
|
255
|
-
|
|
256
|
-
### Changes
|
|
257
|
-
|
|
258
|
-
- Create telemetry package (asklar@microsoft.com)
|
|
259
|
-
|
|
260
|
-
# Change Log - @react-native-windows/telemetry
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.CodedError = exports.CodedErrors = void 0;
|
|
9
|
-
exports.CodedErrors = {
|
|
10
|
-
Success: 0,
|
|
11
|
-
// init
|
|
12
|
-
UnsupportedReactNativeVersion: 1,
|
|
13
|
-
UserCancel: 2,
|
|
14
|
-
NoReactNativeFound: 3,
|
|
15
|
-
NoPackageJSon: 4,
|
|
16
|
-
NoLatestReactNativeWindows: 5,
|
|
17
|
-
NoAutoMatchingReactNativeWindows: 6,
|
|
18
|
-
IncompatibleOptions: 7,
|
|
19
|
-
NoReactNativeDependencies: 8,
|
|
20
|
-
NoMatchingPackageVersion: 9,
|
|
21
|
-
// run-windows
|
|
22
|
-
NoSolution: 100,
|
|
23
|
-
// Project generation
|
|
24
|
-
NoPropertyInProject: 200,
|
|
25
|
-
CopyProjectTemplateNoSourcePath: 201,
|
|
26
|
-
CopyProjectTemplateNoDestPath: 202,
|
|
27
|
-
CopyProjectTemplateNoProjectName: 203,
|
|
28
|
-
// Config and Autolinking
|
|
29
|
-
NoWindowsConfig: 300,
|
|
30
|
-
IncompleteConfig: 301,
|
|
31
|
-
InvalidConfig: 302,
|
|
32
|
-
NeedAutolinking: 303,
|
|
33
|
-
AddProjectToSolution: 304,
|
|
34
|
-
Autolinking: 305,
|
|
35
|
-
// SDK requirements
|
|
36
|
-
MinSDKVersionNotMet: 400,
|
|
37
|
-
BadSDKVersionFormat: 401,
|
|
38
|
-
NoSDK: 402,
|
|
39
|
-
// Build
|
|
40
|
-
NoMSBuild: 500,
|
|
41
|
-
NoVSWhere: 501,
|
|
42
|
-
MSBuildError: 502,
|
|
43
|
-
// Deploy
|
|
44
|
-
NoAppPackage: 600,
|
|
45
|
-
NoAppxManifest: 601,
|
|
46
|
-
NoDevice: 602,
|
|
47
|
-
AppDidNotDeploy: 603,
|
|
48
|
-
InvalidDevicesOutput: 604,
|
|
49
|
-
RemoveOldAppVersionFailure: 605,
|
|
50
|
-
EnableDevModeFailure: 606,
|
|
51
|
-
InstallAppFailure: 607,
|
|
52
|
-
InstallAppDependenciesFailure: 608,
|
|
53
|
-
CheckNetIsolationFailure: 709,
|
|
54
|
-
InstallAppToDeviceFailure: 710,
|
|
55
|
-
UninstallAppOnDeviceFailure: 711,
|
|
56
|
-
DeployRecipeFailure: 712,
|
|
57
|
-
// Others
|
|
58
|
-
AppStartupFailure: 700,
|
|
59
|
-
//
|
|
60
|
-
Unknown: -1,
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Represents an error whose message might contain user-originating content,
|
|
64
|
-
* therefore when transmitting telemetry, only the type should be sent.
|
|
65
|
-
* @param type a stable ID identifying the type of error.
|
|
66
|
-
* @param message the error text. This should only be used for display to the user.
|
|
67
|
-
* @param data any additional metadata that is safe to collect for telemetry purposes.
|
|
68
|
-
*/
|
|
69
|
-
class CodedError extends Error {
|
|
70
|
-
constructor(type, message, data) {
|
|
71
|
-
super(message);
|
|
72
|
-
this.data = data;
|
|
73
|
-
this.name = type;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.CodedError = CodedError;
|
|
77
|
-
//# sourceMappingURL=CodedError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodedError.js","sourceRoot":"","sources":["../src/CodedError.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEU,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC;IACV,OAAO;IACP,6BAA6B,EAAE,CAAC;IAChC,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,CAAC;IACrB,aAAa,EAAE,CAAC;IAChB,0BAA0B,EAAE,CAAC;IAC7B,gCAAgC,EAAE,CAAC;IACnC,mBAAmB,EAAE,CAAC;IACtB,yBAAyB,EAAE,CAAC;IAC5B,wBAAwB,EAAE,CAAC;IAC3B,cAAc;IACd,UAAU,EAAE,GAAG;IACf,qBAAqB;IACrB,mBAAmB,EAAE,GAAG;IACxB,+BAA+B,EAAE,GAAG;IACpC,6BAA6B,EAAE,GAAG;IAClC,gCAAgC,EAAE,GAAG;IACrC,yBAAyB;IACzB,eAAe,EAAE,GAAG;IACpB,gBAAgB,EAAE,GAAG;IACrB,aAAa,EAAE,GAAG;IAClB,eAAe,EAAE,GAAG;IACpB,oBAAoB,EAAE,GAAG;IACzB,WAAW,EAAE,GAAG;IAChB,mBAAmB;IACnB,mBAAmB,EAAE,GAAG;IACxB,mBAAmB,EAAE,GAAG;IACxB,KAAK,EAAE,GAAG;IACV,QAAQ;IACR,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,YAAY,EAAE,GAAG;IACjB,SAAS;IACT,YAAY,EAAE,GAAG;IACjB,cAAc,EAAE,GAAG;IACnB,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,GAAG;IACpB,oBAAoB,EAAE,GAAG;IACzB,0BAA0B,EAAE,GAAG;IAC/B,oBAAoB,EAAE,GAAG;IACzB,iBAAiB,EAAE,GAAG;IACtB,6BAA6B,EAAE,GAAG;IAClC,wBAAwB,EAAE,GAAG;IAC7B,yBAAyB,EAAE,GAAG;IAC9B,2BAA2B,EAAE,GAAG;IAChC,mBAAmB,EAAE,GAAG;IAExB,SAAS;IACT,iBAAiB,EAAE,GAAG;IAEtB,EAAE;IACF,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC;AAIF;;;;;;GAMG;AACH,MAAa,UAAW,SAAQ,KAAK;IACnC,YACE,IAAoB,EACpB,OAAe,EACC,IAA0B;QAE1C,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,SAAI,GAAJ,IAAI,CAAsB;QAG1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AATD,gCASC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nexport const CodedErrors = {\n Success: 0,\n // init\n UnsupportedReactNativeVersion: 1,\n UserCancel: 2,\n NoReactNativeFound: 3,\n NoPackageJSon: 4,\n NoLatestReactNativeWindows: 5,\n NoAutoMatchingReactNativeWindows: 6,\n IncompatibleOptions: 7,\n NoReactNativeDependencies: 8,\n NoMatchingPackageVersion: 9,\n // run-windows\n NoSolution: 100,\n // Project generation\n NoPropertyInProject: 200,\n CopyProjectTemplateNoSourcePath: 201,\n CopyProjectTemplateNoDestPath: 202,\n CopyProjectTemplateNoProjectName: 203,\n // Config and Autolinking\n NoWindowsConfig: 300,\n IncompleteConfig: 301,\n InvalidConfig: 302,\n NeedAutolinking: 303,\n AddProjectToSolution: 304,\n Autolinking: 305,\n // SDK requirements\n MinSDKVersionNotMet: 400,\n BadSDKVersionFormat: 401,\n NoSDK: 402,\n // Build\n NoMSBuild: 500,\n NoVSWhere: 501,\n MSBuildError: 502,\n // Deploy\n NoAppPackage: 600,\n NoAppxManifest: 601,\n NoDevice: 602,\n AppDidNotDeploy: 603,\n InvalidDevicesOutput: 604,\n RemoveOldAppVersionFailure: 605,\n EnableDevModeFailure: 606,\n InstallAppFailure: 607,\n InstallAppDependenciesFailure: 608,\n CheckNetIsolationFailure: 709,\n InstallAppToDeviceFailure: 710,\n UninstallAppOnDeviceFailure: 711,\n DeployRecipeFailure: 712,\n\n // Others\n AppStartupFailure: 700,\n\n //\n Unknown: -1,\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 type: CodedErrorType,\n message: string,\n public readonly data?: Record<string, any>,\n ) {\n super(message);\n this.name = type;\n }\n}\n"]}
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* @format
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const telemetry_1 = require("../telemetry");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const CodedError_1 = require("../CodedError");
|
|
12
|
-
delete process.env.AGENT_NAME; // allow this test to run in Azure DevOps / GHA
|
|
13
|
-
telemetry_1.Telemetry.setup(true);
|
|
14
|
-
telemetry_1.Telemetry.client.config.disableAppInsights = true;
|
|
15
|
-
test('Sanitize message, no-op', () => {
|
|
16
|
-
// do stuff
|
|
17
|
-
expect((0, telemetry_1.sanitizeMessage)('')).toEqual('');
|
|
18
|
-
expect((0, telemetry_1.sanitizeMessage)('some text')).toEqual('some text');
|
|
19
|
-
});
|
|
20
|
-
test('Sanitize message, project_dir', () => {
|
|
21
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: '${process.cwd()}'`)).toEqual(`this is the cwd: [project_dir]\\???(${process.cwd().length})`);
|
|
22
|
-
expect((0, telemetry_1.sanitizeMessage)(`uppercase: '${process.cwd().toUpperCase()}'`)).toEqual(`uppercase: [project_dir]\\???(${process.cwd().length})`);
|
|
23
|
-
expect((0, telemetry_1.sanitizeMessage)(`lowercase: '${process.cwd().toLowerCase()}'`)).toEqual(`lowercase: [project_dir]\\???(${process.cwd().length})`);
|
|
24
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: '${process.cwd()}' and something else`)).toEqual(`this is the cwd: [project_dir]\\???(${process.cwd().length}) and something else`);
|
|
25
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: ${process.cwd()} and something else`)).toEqual(`this is the cwd: [project_dir]\\???(${(process.cwd() + ' and something else').length})`);
|
|
26
|
-
});
|
|
27
|
-
test('Sanitize message, node_modules', () => {
|
|
28
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: '${process.cwd()}\\node_modules'`)).toEqual(`this is the cwd: [project_dir]\\???(${(process.cwd() + '\\node_modules').length})`);
|
|
29
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: '${process.cwd()}\\node_modules\\foo'`)).toEqual('this is the cwd: node_modules\\foo');
|
|
30
|
-
expect((0, telemetry_1.sanitizeMessage)(`uppercase: '${process.cwd().toUpperCase()}\\NODE_MODULES\\foo'`)).toEqual('uppercase: node_modules\\foo');
|
|
31
|
-
expect((0, telemetry_1.sanitizeMessage)(`lowercase: '${process.cwd().toLowerCase()}\\NODE_MODULES\\'`)).toEqual('lowercase: node_modules\\');
|
|
32
|
-
expect((0, telemetry_1.sanitizeMessage)(`trailing: '${process.cwd()}\\node_modules\\' and something else`)).toEqual('trailing: node_modules\\ and something else');
|
|
33
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: ${process.cwd()}\\node_modules and something else that could be part of the path`)).toEqual(`this is the cwd: [project_dir]\\???(${(process.cwd() +
|
|
34
|
-
'\\node_modules and something else that could be part of the path').length})`);
|
|
35
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is the cwd: ${process.cwd()}\\node_modules\\ a file under nm`)).toEqual(`this is the cwd: node_modules\\ a file under nm`);
|
|
36
|
-
});
|
|
37
|
-
test('Sanitize message, other path', () => {
|
|
38
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is another path: 'A:\\foo\\bar\\baz'`)).toEqual(`this is another path: [path]`);
|
|
39
|
-
expect((0, telemetry_1.sanitizeMessage)(`this is another path: A:\\foo\\bar\\baz`)).toEqual(`this is another path: [path]`);
|
|
40
|
-
expect((0, telemetry_1.sanitizeMessage)(`Cannot find module 'react-native/package.json'
|
|
41
|
-
Require stack:
|
|
42
|
-
- ${process.env.AppData}\\npm-cache\\_npx\\1384\\node_modules\\react-native-windows-init\\lib-commonjs\\Cli.js
|
|
43
|
-
- ${process.env.AppData}\\npm-cache\\_npx\\1384\\node_modules\\react-native-windows-init\\bin.js`)).toEqual(`Cannot find module react-native/package.json
|
|
44
|
-
Require stack:
|
|
45
|
-
- [AppData]\\???(${(process.env.AppData +
|
|
46
|
-
'\\npm-cache\\_npx\\1384\\node_modules\\react-native-windows-init\\lib-commonjs\\Cli.js').length})
|
|
47
|
-
- [AppData]\\???(${(process.env.AppData +
|
|
48
|
-
'\\npm-cache\\_npx\\1384\\node_modules\\react-native-windows-init\\bin.js').length})`);
|
|
49
|
-
});
|
|
50
|
-
test('Sanitize message, forward slashes', () => {
|
|
51
|
-
expect((0, telemetry_1.sanitizeMessage)(`EPERM: operation not permitted, scandir ${process.env.UserProfile.replace(/\\/g, '/')}/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include`)).toEqual(`EPERM: operation not permitted, scandir [UserProfile]\\???(${(process.env.UserProfile +
|
|
52
|
-
'/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include').length})`);
|
|
53
|
-
});
|
|
54
|
-
test('Sanitize message, file share path', () => {
|
|
55
|
-
expect((0, telemetry_1.sanitizeMessage)(`\\\\server\\share`)).toEqual('[path]');
|
|
56
|
-
});
|
|
57
|
-
test('Sanitize message, with cpu/thread id', () => {
|
|
58
|
-
expect((0, telemetry_1.sanitizeMessage)('5>This is an error')).toEqual('This is an error');
|
|
59
|
-
expect((0, telemetry_1.sanitizeMessage)('5:42>This is an error')).toEqual('This is an error');
|
|
60
|
-
});
|
|
61
|
-
test('Error code', () => {
|
|
62
|
-
expect((0, telemetry_1.tryGetErrorCode)('foo bar error FOO2020: the thing')).toEqual('FOO2020');
|
|
63
|
-
});
|
|
64
|
-
test('Sanitize stack frame', () => {
|
|
65
|
-
const emptyFrame = {
|
|
66
|
-
level: 0,
|
|
67
|
-
method: '',
|
|
68
|
-
fileName: '',
|
|
69
|
-
assembly: 'asdf',
|
|
70
|
-
line: 0,
|
|
71
|
-
};
|
|
72
|
-
(0, telemetry_1.sanitizeFrame)(emptyFrame);
|
|
73
|
-
expect(emptyFrame).toEqual({
|
|
74
|
-
level: 0,
|
|
75
|
-
assembly: '',
|
|
76
|
-
fileName: '.',
|
|
77
|
-
method: '',
|
|
78
|
-
line: 0,
|
|
79
|
-
});
|
|
80
|
-
const frame1 = {
|
|
81
|
-
method: '',
|
|
82
|
-
fileName: `${process.cwd()}\\foo.js`,
|
|
83
|
-
assembly: 'asdf',
|
|
84
|
-
level: 0,
|
|
85
|
-
line: 0,
|
|
86
|
-
};
|
|
87
|
-
(0, telemetry_1.sanitizeFrame)(frame1);
|
|
88
|
-
expect(frame1).toEqual({
|
|
89
|
-
assembly: '',
|
|
90
|
-
fileName: 'telemetry\\foo.js',
|
|
91
|
-
method: '',
|
|
92
|
-
level: 0,
|
|
93
|
-
line: 0,
|
|
94
|
-
});
|
|
95
|
-
const frame2 = {
|
|
96
|
-
method: `myMethod (something ${process.cwd()}`,
|
|
97
|
-
fileName: `${process.cwd()}\\foo.js`,
|
|
98
|
-
assembly: 'asdf',
|
|
99
|
-
level: 1,
|
|
100
|
-
line: 42,
|
|
101
|
-
};
|
|
102
|
-
(0, telemetry_1.sanitizeFrame)(frame2);
|
|
103
|
-
expect(frame2).toEqual({
|
|
104
|
-
assembly: '',
|
|
105
|
-
fileName: 'telemetry\\foo.js',
|
|
106
|
-
method: 'myMethod',
|
|
107
|
-
level: 1,
|
|
108
|
-
line: 42,
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
test('basic setup', () => {
|
|
112
|
-
expect(telemetry_1.Telemetry.client.commonProperties.sessionId).toBeDefined();
|
|
113
|
-
expect(telemetry_1.Telemetry.client.commonProperties.sessionId.length).toBeGreaterThanOrEqual(32);
|
|
114
|
-
expect(telemetry_1.Telemetry.client.commonProperties.isTest).toEqual('true');
|
|
115
|
-
});
|
|
116
|
-
function b(s) {
|
|
117
|
-
throw new Error('hello ' + s);
|
|
118
|
-
}
|
|
119
|
-
function a(s) {
|
|
120
|
-
b(s);
|
|
121
|
-
}
|
|
122
|
-
// #7903: This test assumes exact structure of stack trace, which can be flaky or implementation dependent
|
|
123
|
-
test.skip('thrown exception a->b, hello world', () => {
|
|
124
|
-
let pass = false;
|
|
125
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor((envelope, _) => {
|
|
126
|
-
if (envelope.data.baseType === 'ExceptionData') {
|
|
127
|
-
const data = envelope.data.baseData;
|
|
128
|
-
expect(data.exceptions).toBeDefined();
|
|
129
|
-
expect(data.exceptions.length).toEqual(1);
|
|
130
|
-
expect(data.exceptions[0].message).toEqual('hello world');
|
|
131
|
-
const stack = data.exceptions[0].parsedStack;
|
|
132
|
-
expect(stack).toBeDefined();
|
|
133
|
-
expect(stack.length).toBeGreaterThan(5);
|
|
134
|
-
const filename = (0, path_1.basename)(__filename);
|
|
135
|
-
expect(stack[0].method).toEqual('b');
|
|
136
|
-
expect(stack[1].method).toEqual('b');
|
|
137
|
-
expect(stack[2].method).toEqual('Object.a');
|
|
138
|
-
expect(stack[0].fileName).toEqual(`test\\${filename}`);
|
|
139
|
-
expect(stack[1].fileName).toEqual(`test\\${filename}`);
|
|
140
|
-
expect(stack[2].fileName).toEqual(`test\\${filename}`);
|
|
141
|
-
pass = true;
|
|
142
|
-
}
|
|
143
|
-
return true;
|
|
144
|
-
});
|
|
145
|
-
try {
|
|
146
|
-
a('world');
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
telemetry_1.Telemetry.client.trackException({ exception: e });
|
|
150
|
-
}
|
|
151
|
-
telemetry_1.Telemetry.client.flush();
|
|
152
|
-
expect(pass).toBeTruthy();
|
|
153
|
-
telemetry_1.Telemetry.client.clearTelemetryProcessors();
|
|
154
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor(telemetry_1.sanitizeEnvelope);
|
|
155
|
-
});
|
|
156
|
-
test('throw exception with error code', done => {
|
|
157
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor((envelope, _) => {
|
|
158
|
-
const data = envelope.data.baseData;
|
|
159
|
-
expect(data.properties.errorCode).toEqual('FOO2020');
|
|
160
|
-
return true;
|
|
161
|
-
});
|
|
162
|
-
try {
|
|
163
|
-
throw new Error('hello from an error FOO2020: the error string');
|
|
164
|
-
}
|
|
165
|
-
catch (e) {
|
|
166
|
-
telemetry_1.Telemetry.client.trackException({ exception: e });
|
|
167
|
-
telemetry_1.Telemetry.client.flush();
|
|
168
|
-
}
|
|
169
|
-
telemetry_1.Telemetry.client.clearTelemetryProcessors();
|
|
170
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor(telemetry_1.sanitizeEnvelope);
|
|
171
|
-
done();
|
|
172
|
-
});
|
|
173
|
-
// #7903: This test assumes exact structure of stack trace, which can be flaky or implementation dependent
|
|
174
|
-
test.skip('thrown exception a->b, hello path', done => {
|
|
175
|
-
let pass = false;
|
|
176
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor((envelope, _) => {
|
|
177
|
-
if (envelope.data.baseType === 'ExceptionData') {
|
|
178
|
-
const data = envelope.data.baseData;
|
|
179
|
-
expect(data.exceptions).toBeDefined();
|
|
180
|
-
expect(data.exceptions.length).toEqual(1);
|
|
181
|
-
expect(data.exceptions[0].message).toEqual(`hello [project_dir]\\???(${process.cwd().length})`);
|
|
182
|
-
const stack = data.exceptions[0].parsedStack;
|
|
183
|
-
expect(stack).toBeDefined();
|
|
184
|
-
expect(stack.length).toBeGreaterThan(5);
|
|
185
|
-
const filename = (0, path_1.basename)(__filename);
|
|
186
|
-
expect(stack[0].method).toEqual('b');
|
|
187
|
-
expect(stack[1].method).toEqual('b');
|
|
188
|
-
expect(stack[2].method).toEqual('Object.a');
|
|
189
|
-
expect(stack[0].fileName).toEqual(`test\\${filename}`);
|
|
190
|
-
expect(stack[1].fileName).toEqual(`test\\${filename}`);
|
|
191
|
-
expect(stack[2].fileName).toEqual(`test\\${filename}`);
|
|
192
|
-
pass = true;
|
|
193
|
-
}
|
|
194
|
-
return true;
|
|
195
|
-
});
|
|
196
|
-
try {
|
|
197
|
-
a(process.cwd());
|
|
198
|
-
}
|
|
199
|
-
catch (e) {
|
|
200
|
-
telemetry_1.Telemetry.client.trackException({ exception: e });
|
|
201
|
-
}
|
|
202
|
-
telemetry_1.Telemetry.client.flush();
|
|
203
|
-
expect(pass).toBeTruthy();
|
|
204
|
-
expect(pass).toBeTruthy();
|
|
205
|
-
telemetry_1.Telemetry.client.clearTelemetryProcessors();
|
|
206
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor(telemetry_1.sanitizeEnvelope);
|
|
207
|
-
done();
|
|
208
|
-
});
|
|
209
|
-
test('trackEvent should not identify roleInstance', () => {
|
|
210
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor((envelope, _) => {
|
|
211
|
-
expect(envelope.tags['ai.cloud.roleInstance']).toBeUndefined();
|
|
212
|
-
return true;
|
|
213
|
-
});
|
|
214
|
-
telemetry_1.Telemetry.client.trackEvent({
|
|
215
|
-
name: 'test',
|
|
216
|
-
properties: {},
|
|
217
|
-
});
|
|
218
|
-
telemetry_1.Telemetry.client.flush();
|
|
219
|
-
telemetry_1.Telemetry.client.clearTelemetryProcessors();
|
|
220
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor(telemetry_1.sanitizeEnvelope);
|
|
221
|
-
});
|
|
222
|
-
/////////////////////////
|
|
223
|
-
// CodedError tests
|
|
224
|
-
test('No message', done => {
|
|
225
|
-
telemetry_1.Telemetry.preserveMessages = false;
|
|
226
|
-
let pass = false;
|
|
227
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor((envelope, _) => {
|
|
228
|
-
if (envelope.data.baseType === 'ExceptionData') {
|
|
229
|
-
const data = envelope.data.baseData;
|
|
230
|
-
expect(data.exceptions).toBeDefined();
|
|
231
|
-
expect(data.exceptions.length).toEqual(1);
|
|
232
|
-
expect(data.exceptions[0].message).toBeUndefined();
|
|
233
|
-
expect(data.exceptions[0].typeName).toEqual('MSBuildError');
|
|
234
|
-
// This should be 42, but instead it is '42'
|
|
235
|
-
// https://github.com/microsoft/ApplicationInsights-node.js/issues/708
|
|
236
|
-
expect(data.properties.foo).toBeDefined();
|
|
237
|
-
expect(parseInt(data.properties.foo, 10)).toEqual(42);
|
|
238
|
-
pass = true;
|
|
239
|
-
}
|
|
240
|
-
return true;
|
|
241
|
-
});
|
|
242
|
-
try {
|
|
243
|
-
throw new CodedError_1.CodedError('MSBuildError', 'Something secret', {
|
|
244
|
-
foo: 42,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
catch (e) {
|
|
248
|
-
telemetry_1.Telemetry.client.trackException({
|
|
249
|
-
exception: e,
|
|
250
|
-
properties: e.data,
|
|
251
|
-
});
|
|
252
|
-
telemetry_1.Telemetry.client.flush();
|
|
253
|
-
}
|
|
254
|
-
expect(pass).toEqual(true);
|
|
255
|
-
telemetry_1.Telemetry.client.clearTelemetryProcessors();
|
|
256
|
-
telemetry_1.Telemetry.client.addTelemetryProcessor(telemetry_1.sanitizeEnvelope);
|
|
257
|
-
done();
|
|
258
|
-
});
|
|
259
|
-
//# sourceMappingURL=sanitize.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.test.js","sourceRoot":"","sources":["../../src/test/sanitize.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,4CAMsB;AAEtB,+BAA8B;AAC9B,8CAAyC;AAEzC,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,+CAA+C;AAC9E,qBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtB,qBAAS,CAAC,MAAO,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC;AAEnD,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACnC,WAAW;IACX,MAAM,CAAC,IAAA,2BAAe,EAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,CAAC,IAAA,2BAAe,EAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;IACzC,MAAM,CAAC,IAAA,2BAAe,EAAC,qBAAqB,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CACpE,wCAAwC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,CAChE,CAAC;IACF,MAAM,CACJ,IAAA,2BAAe,EAAC,eAAe,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,CAC/D,CAAC,OA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C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAC5D,4CAA4C;YAC5C,sEAAsE;YACtE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;YAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACtD,IAAI,GAAG,IAAI,CAAC;SACb;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,IAAI;QACF,MAAM,IAAI,uBAAU,CAAC,cAAc,EAAE,kBAAkB,EAAE;YACvD,GAAG,EAAE,EAAE;SACR,CAAC,CAAC;KACJ;IAAC,OAAO,CAAC,EAAE;QACV,qBAAS,CAAC,MAAO,CAAC,cAAc,CAAC;YAC/B,SAAS,EAAE,CAAU;YACrB,UAAU,EAAG,CAAgB,CAAC,IAAI;SACnC,CAAC,CAAC;QACH,qBAAS,CAAC,MAAO,CAAC,KAAK,EAAE,CAAC;KAC3B;IAED,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,qBAAS,CAAC,MAAO,CAAC,wBAAwB,EAAE,CAAC;IAC7C,qBAAS,CAAC,MAAO,CAAC,qBAAqB,CAAC,4BAAgB,CAAC,CAAC;IAC1D,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport {\n Telemetry,\n sanitizeMessage,\n sanitizeEnvelope,\n sanitizeFrame,\n tryGetErrorCode,\n} from '../telemetry';\nimport * as appInsights from 'applicationinsights';\nimport {basename} from 'path';\nimport {CodedError} from '../CodedError';\n\ndelete process.env.AGENT_NAME; // allow this test to run in Azure DevOps / GHA\nTelemetry.setup(true);\nTelemetry.client!.config.disableAppInsights = true;\n\ntest('Sanitize message, no-op', () => {\n // do stuff\n expect(sanitizeMessage('')).toEqual('');\n expect(sanitizeMessage('some text')).toEqual('some text');\n});\n\ntest('Sanitize message, project_dir', () => {\n expect(sanitizeMessage(`this is the cwd: '${process.cwd()}'`)).toEqual(\n `this is the cwd: [project_dir]\\\\???(${process.cwd().length})`,\n );\n expect(\n sanitizeMessage(`uppercase: '${process.cwd().toUpperCase()}'`),\n ).toEqual(`uppercase: [project_dir]\\\\???(${process.cwd().length})`);\n expect(\n sanitizeMessage(`lowercase: '${process.cwd().toLowerCase()}'`),\n ).toEqual(`lowercase: [project_dir]\\\\???(${process.cwd().length})`);\n expect(\n sanitizeMessage(`this is the cwd: '${process.cwd()}' and something else`),\n ).toEqual(\n `this is the cwd: [project_dir]\\\\???(${\n process.cwd().length\n }) and something else`,\n );\n expect(\n sanitizeMessage(`this is the cwd: ${process.cwd()} and something else`),\n ).toEqual(\n `this is the cwd: [project_dir]\\\\???(${\n (process.cwd() + ' and something else').length\n })`,\n );\n});\n\ntest('Sanitize message, node_modules', () => {\n expect(\n sanitizeMessage(`this is the cwd: '${process.cwd()}\\\\node_modules'`),\n ).toEqual(\n `this is the cwd: [project_dir]\\\\???(${\n (process.cwd() + '\\\\node_modules').length\n })`,\n );\n expect(\n sanitizeMessage(`this is the cwd: '${process.cwd()}\\\\node_modules\\\\foo'`),\n ).toEqual('this is the cwd: node_modules\\\\foo');\n expect(\n sanitizeMessage(\n `uppercase: '${process.cwd().toUpperCase()}\\\\NODE_MODULES\\\\foo'`,\n ),\n ).toEqual('uppercase: node_modules\\\\foo');\n expect(\n sanitizeMessage(\n `lowercase: '${process.cwd().toLowerCase()}\\\\NODE_MODULES\\\\'`,\n ),\n ).toEqual('lowercase: node_modules\\\\');\n expect(\n sanitizeMessage(\n `trailing: '${process.cwd()}\\\\node_modules\\\\' and something else`,\n ),\n ).toEqual('trailing: node_modules\\\\ and something else');\n expect(\n sanitizeMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules and something else that could be part of the path`,\n ),\n ).toEqual(\n `this is the cwd: [project_dir]\\\\???(${\n (\n process.cwd() +\n '\\\\node_modules and something else that could be part of the path'\n ).length\n })`,\n );\n expect(\n sanitizeMessage(\n `this is the cwd: ${process.cwd()}\\\\node_modules\\\\ a file under nm`,\n ),\n ).toEqual(`this is the cwd: node_modules\\\\ a file under nm`);\n});\n\ntest('Sanitize message, other path', () => {\n expect(sanitizeMessage(`this is another path: 'A:\\\\foo\\\\bar\\\\baz'`)).toEqual(\n `this is another path: [path]`,\n );\n\n expect(sanitizeMessage(`this is another path: A:\\\\foo\\\\bar\\\\baz`)).toEqual(\n `this is another path: [path]`,\n );\n\n expect(\n sanitizeMessage(\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 ).toEqual(`Cannot find module react-native/package.json \n Require stack:\n - [AppData]\\\\???(${\n (\n process.env.AppData +\n '\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\lib-commonjs\\\\Cli.js'\n ).length\n })\n - [AppData]\\\\???(${\n (\n process.env.AppData +\n '\\\\npm-cache\\\\_npx\\\\1384\\\\node_modules\\\\react-native-windows-init\\\\bin.js'\n ).length\n })`);\n});\n\ntest('Sanitize message, forward slashes', () => {\n expect(\n sanitizeMessage(\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 ).toEqual(\n `EPERM: operation not permitted, scandir [UserProfile]\\\\???(${\n (\n process.env.UserProfile +\n '/source/repos/rn2/wintest/windows/packages/boost.1.76.0.0/lib/native/include'\n ).length\n })`,\n );\n});\n\ntest('Sanitize message, file share path', () => {\n expect(sanitizeMessage(`\\\\\\\\server\\\\share`)).toEqual('[path]');\n});\n\ntest('Sanitize message, with cpu/thread id', () => {\n expect(sanitizeMessage('5>This is an error')).toEqual('This is an error');\n\n expect(sanitizeMessage('5:42>This is an error')).toEqual('This is an error');\n});\n\ntest('Error code', () => {\n expect(tryGetErrorCode('foo bar error FOO2020: the thing')).toEqual(\n 'FOO2020',\n );\n});\n\ntest('Sanitize stack frame', () => {\n const emptyFrame: appInsights.Contracts.StackFrame = {\n level: 0,\n method: '',\n fileName: '',\n assembly: 'asdf',\n line: 0,\n };\n sanitizeFrame(emptyFrame);\n expect(emptyFrame).toEqual({\n level: 0,\n assembly: '',\n fileName: '.',\n method: '',\n line: 0,\n });\n\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 sanitizeFrame(frame1);\n expect(frame1).toEqual({\n assembly: '',\n fileName: 'telemetry\\\\foo.js',\n method: '',\n level: 0,\n line: 0,\n });\n\n const frame2: appInsights.Contracts.StackFrame = {\n method: `myMethod (something ${process.cwd()}`,\n fileName: `${process.cwd()}\\\\foo.js`,\n assembly: 'asdf',\n level: 1,\n line: 42,\n };\n sanitizeFrame(frame2);\n expect(frame2).toEqual({\n assembly: '',\n fileName: 'telemetry\\\\foo.js',\n method: 'myMethod',\n level: 1,\n line: 42,\n });\n});\n\ntest('basic setup', () => {\n expect(Telemetry.client!.commonProperties.sessionId).toBeDefined();\n\n expect(\n Telemetry.client!.commonProperties.sessionId.length,\n ).toBeGreaterThanOrEqual(32);\n\n expect(Telemetry.client!.commonProperties.isTest).toEqual('true');\n});\n\nfunction b(s: string) {\n throw new Error('hello ' + s);\n}\nfunction a(s: string) {\n b(s);\n}\n\n// #7903: This test assumes exact structure of stack trace, which can be flaky or implementation dependent\ntest.skip('thrown exception a->b, hello world', () => {\n let pass = false;\n Telemetry.client!.addTelemetryProcessor((envelope, _) => {\n if (envelope.data.baseType === 'ExceptionData') {\n const data = (envelope.data as any).baseData;\n expect(data.exceptions).toBeDefined();\n expect(data.exceptions.length).toEqual(1);\n expect(data.exceptions[0].message).toEqual('hello world');\n\n const stack = data.exceptions[0].parsedStack;\n expect(stack).toBeDefined();\n expect(stack.length).toBeGreaterThan(5);\n\n const filename = basename(__filename);\n expect(stack[0].method).toEqual('b');\n expect(stack[1].method).toEqual('b');\n expect(stack[2].method).toEqual('Object.a');\n expect(stack[0].fileName).toEqual(`test\\\\${filename}`);\n expect(stack[1].fileName).toEqual(`test\\\\${filename}`);\n expect(stack[2].fileName).toEqual(`test\\\\${filename}`);\n pass = true;\n }\n return true;\n });\n try {\n a('world');\n } catch (e) {\n Telemetry.client!.trackException({exception: e as Error});\n }\n Telemetry.client!.flush();\n\n expect(pass).toBeTruthy();\n Telemetry.client!.clearTelemetryProcessors();\n Telemetry.client!.addTelemetryProcessor(sanitizeEnvelope);\n});\n\ntest('throw exception with error code', done => {\n Telemetry.client!.addTelemetryProcessor((envelope, _) => {\n const data = (envelope.data as any).baseData;\n expect(data.properties.errorCode).toEqual('FOO2020');\n return true;\n });\n\n try {\n throw new Error('hello from an error FOO2020: the error string');\n } catch (e) {\n Telemetry.client!.trackException({exception: e as Error});\n Telemetry.client!.flush();\n }\n Telemetry.client!.clearTelemetryProcessors();\n Telemetry.client!.addTelemetryProcessor(sanitizeEnvelope);\n done();\n});\n\n// #7903: This test assumes exact structure of stack trace, which can be flaky or implementation dependent\ntest.skip('thrown exception a->b, hello path', done => {\n let pass = false;\n Telemetry.client!.addTelemetryProcessor((envelope, _) => {\n if (envelope.data.baseType === 'ExceptionData') {\n const data = (envelope.data as any).baseData;\n expect(data.exceptions).toBeDefined();\n expect(data.exceptions.length).toEqual(1);\n expect(data.exceptions[0].message).toEqual(\n `hello [project_dir]\\\\???(${process.cwd().length})`,\n );\n\n const stack = data.exceptions[0].parsedStack;\n expect(stack).toBeDefined();\n expect(stack.length).toBeGreaterThan(5);\n\n const filename = basename(__filename);\n expect(stack[0].method).toEqual('b');\n expect(stack[1].method).toEqual('b');\n expect(stack[2].method).toEqual('Object.a');\n expect(stack[0].fileName).toEqual(`test\\\\${filename}`);\n expect(stack[1].fileName).toEqual(`test\\\\${filename}`);\n expect(stack[2].fileName).toEqual(`test\\\\${filename}`);\n pass = true;\n }\n return true;\n });\n try {\n a(process.cwd());\n } catch (e) {\n Telemetry.client!.trackException({exception: e as Error});\n }\n Telemetry.client!.flush();\n\n expect(pass).toBeTruthy();\n expect(pass).toBeTruthy();\n Telemetry.client!.clearTelemetryProcessors();\n Telemetry.client!.addTelemetryProcessor(sanitizeEnvelope);\n done();\n});\n\ntest('trackEvent should not identify roleInstance', () => {\n Telemetry.client!.addTelemetryProcessor((envelope, _) => {\n expect(envelope.tags['ai.cloud.roleInstance']).toBeUndefined();\n return true;\n });\n Telemetry.client!.trackEvent({\n name: 'test',\n properties: {},\n });\n Telemetry.client!.flush();\n Telemetry.client!.clearTelemetryProcessors();\n Telemetry.client!.addTelemetryProcessor(sanitizeEnvelope);\n});\n\n/////////////////////////\n// CodedError tests\ntest('No message', done => {\n Telemetry.preserveMessages = false;\n let pass = false;\n Telemetry.client!.addTelemetryProcessor((envelope, _) => {\n if (envelope.data.baseType === 'ExceptionData') {\n const data = (envelope.data as any).baseData;\n expect(data.exceptions).toBeDefined();\n expect(data.exceptions.length).toEqual(1);\n expect(data.exceptions[0].message).toBeUndefined();\n expect(data.exceptions[0].typeName).toEqual('MSBuildError');\n // This should be 42, but instead it is '42'\n // https://github.com/microsoft/ApplicationInsights-node.js/issues/708\n expect(data.properties.foo).toBeDefined();\n expect(parseInt(data.properties.foo, 10)).toEqual(42);\n pass = true;\n }\n return true;\n });\n\n try {\n throw new CodedError('MSBuildError', 'Something secret', {\n foo: 42,\n });\n } catch (e) {\n Telemetry.client!.trackException({\n exception: e as Error,\n properties: (e as CodedError).data,\n });\n Telemetry.client!.flush();\n }\n\n expect(pass).toEqual(true);\n Telemetry.client!.clearTelemetryProcessors();\n Telemetry.client!.addTelemetryProcessor(sanitizeEnvelope);\n done();\n});\n"]}
|