@react-native-windows/telemetry 0.73.1 → 0.74.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/lib-commonjs/e2etest/telemetry.test.d.ts +28 -28
  2. package/lib-commonjs/e2etest/telemetry.test.js +496 -496
  3. package/lib-commonjs/index.d.ts +11 -11
  4. package/lib-commonjs/index.js +26 -26
  5. package/lib-commonjs/telemetry.d.ts +84 -84
  6. package/lib-commonjs/telemetry.js +370 -370
  7. package/lib-commonjs/telemetry.js.map +1 -1
  8. package/lib-commonjs/test/basePropUtils.test.d.ts +7 -7
  9. package/lib-commonjs/test/basePropUtils.test.js +137 -137
  10. package/lib-commonjs/test/errorUtils.test.d.ts +7 -7
  11. package/lib-commonjs/test/errorUtils.test.js +159 -159
  12. package/lib-commonjs/test/projectUtils.test.d.ts +7 -7
  13. package/lib-commonjs/test/projectUtils.test.js +87 -87
  14. package/lib-commonjs/test/sanitizeUtils.test.d.ts +7 -7
  15. package/lib-commonjs/test/sanitizeUtils.test.js +97 -97
  16. package/lib-commonjs/test/versionUtils.test.d.ts +7 -7
  17. package/lib-commonjs/test/versionUtils.test.js +114 -114
  18. package/lib-commonjs/utils/basePropUtils.d.ts +81 -81
  19. package/lib-commonjs/utils/basePropUtils.js +173 -173
  20. package/lib-commonjs/utils/errorUtils.d.ts +87 -87
  21. package/lib-commonjs/utils/errorUtils.js +178 -178
  22. package/lib-commonjs/utils/optionUtils.d.ts +45 -45
  23. package/lib-commonjs/utils/optionUtils.js +95 -95
  24. package/lib-commonjs/utils/projectUtils.d.ts +50 -50
  25. package/lib-commonjs/utils/projectUtils.js +186 -186
  26. package/lib-commonjs/utils/sanitizeUtils.d.ts +12 -12
  27. package/lib-commonjs/utils/sanitizeUtils.js +81 -81
  28. package/lib-commonjs/utils/versionUtils.d.ts +38 -38
  29. package/lib-commonjs/utils/versionUtils.js +155 -155
  30. package/package.json +14 -16
@@ -1,98 +1,98 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- *
6
- * @format
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const path_1 = __importDefault(require("path"));
36
- const sanitizeUtils = __importStar(require("../utils/sanitizeUtils"));
37
- const projectDir = process.cwd();
38
- test('getAnonymizedPath() with project dir is anonymized', () => {
39
- const originalPath = projectDir;
40
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
41
- expect(anonymizedPath).not.toBe(originalPath);
42
- expect(anonymizedPath.startsWith('[project_dir]')).toBe(true);
43
- });
44
- test('getAnonymizedPath() with project/index.js is anonymized', () => {
45
- const originalPath = path_1.default.join(projectDir, 'index.js');
46
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
47
- expect(anonymizedPath).not.toBe(originalPath);
48
- expect(anonymizedPath.startsWith('[project_dir]\\???.js')).toBe(true);
49
- });
50
- test('getAnonymizedPath() with project/windows/test.sln is anonymized', () => {
51
- const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'windows/test.sln'));
52
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
53
- expect(anonymizedPath).not.toBe(originalPath);
54
- expect(anonymizedPath.startsWith('[windows]\\???.sln')).toBe(true);
55
- });
56
- test('getAnonymizedPath() with project/node_modules for untracked package is anonymized', () => {
57
- const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/untracked/index.js'));
58
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
59
- expect(anonymizedPath).not.toBe(originalPath);
60
- expect(anonymizedPath.startsWith('[node_modules]\\???.js')).toBe(true);
61
- });
62
- test('getAnonymizedPath() with project/node_modules for react-secret-pii package is anonymized', () => {
63
- const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/react-secret-pii/index.js'));
64
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
65
- expect(anonymizedPath).not.toBe(originalPath);
66
- expect(anonymizedPath.startsWith('[node_modules]\\???.js')).toBe(true);
67
- });
68
- test('getAnonymizedPath() with path under react-native-windows is anonymized', () => {
69
- const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/react-native-windows/index.js'));
70
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
71
- expect(anonymizedPath).not.toBe(originalPath);
72
- expect(anonymizedPath).toBe('[node_modules]\\react-native-windows\\index.js');
73
- });
74
- test('getAnonymizedPath() with path under @react-native-windows/cli is anonymized', () => {
75
- const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/@react-native-windows/cli/index.js'));
76
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
77
- expect(anonymizedPath).not.toBe(originalPath);
78
- expect(anonymizedPath).toBe('[node_modules]\\@react-native-windows\\cli\\index.js');
79
- });
80
- test('getAnonymizedPath() with path under %%LocalAppData%% is anonymized', () => {
81
- const originalPath = path_1.default.normalize(path_1.default.join(process.env.LocalAppData, 'test.sln'));
82
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
83
- expect(anonymizedPath).not.toBe(originalPath);
84
- expect(anonymizedPath.startsWith('[LocalAppData]\\???')).toBe(true);
85
- });
86
- test('getAnonymizedPath() with a tracked npm package under %%LocalAppData%% is anonymized', () => {
87
- const originalPath = path_1.default.normalize(path_1.default.join(process.env.LocalAppData, 'node_modules/@react-native-windows/cli/index.js'));
88
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
89
- expect(anonymizedPath).not.toBe(originalPath);
90
- expect(anonymizedPath).toBe('[node_modules]\\@react-native-windows\\cli\\index.js');
91
- });
92
- test('getAnonymizedPath() with arbitrary path not under project dir is anonymized', () => {
93
- const originalPath = 'test.sln';
94
- const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
95
- expect(anonymizedPath).not.toBe(originalPath);
96
- expect(anonymizedPath).toBe('[path]');
97
- });
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ * Licensed under the MIT License.
5
+ *
6
+ * @format
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ const path_1 = __importDefault(require("path"));
36
+ const sanitizeUtils = __importStar(require("../utils/sanitizeUtils"));
37
+ const projectDir = process.cwd();
38
+ test('getAnonymizedPath() with project dir is anonymized', () => {
39
+ const originalPath = projectDir;
40
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
41
+ expect(anonymizedPath).not.toBe(originalPath);
42
+ expect(anonymizedPath.startsWith('[project_dir]')).toBe(true);
43
+ });
44
+ test('getAnonymizedPath() with project/index.js is anonymized', () => {
45
+ const originalPath = path_1.default.join(projectDir, 'index.js');
46
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
47
+ expect(anonymizedPath).not.toBe(originalPath);
48
+ expect(anonymizedPath.startsWith('[project_dir]\\???.js')).toBe(true);
49
+ });
50
+ test('getAnonymizedPath() with project/windows/test.sln is anonymized', () => {
51
+ const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'windows/test.sln'));
52
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
53
+ expect(anonymizedPath).not.toBe(originalPath);
54
+ expect(anonymizedPath.startsWith('[windows]\\???.sln')).toBe(true);
55
+ });
56
+ test('getAnonymizedPath() with project/node_modules for untracked package is anonymized', () => {
57
+ const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/untracked/index.js'));
58
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
59
+ expect(anonymizedPath).not.toBe(originalPath);
60
+ expect(anonymizedPath.startsWith('[node_modules]\\???.js')).toBe(true);
61
+ });
62
+ test('getAnonymizedPath() with project/node_modules for react-secret-pii package is anonymized', () => {
63
+ const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/react-secret-pii/index.js'));
64
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
65
+ expect(anonymizedPath).not.toBe(originalPath);
66
+ expect(anonymizedPath.startsWith('[node_modules]\\???.js')).toBe(true);
67
+ });
68
+ test('getAnonymizedPath() with path under react-native-windows is anonymized', () => {
69
+ const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/react-native-windows/index.js'));
70
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
71
+ expect(anonymizedPath).not.toBe(originalPath);
72
+ expect(anonymizedPath).toBe('[node_modules]\\react-native-windows\\index.js');
73
+ });
74
+ test('getAnonymizedPath() with path under @react-native-windows/cli is anonymized', () => {
75
+ const originalPath = path_1.default.normalize(path_1.default.join(projectDir, 'node_modules/@react-native-windows/cli/index.js'));
76
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
77
+ expect(anonymizedPath).not.toBe(originalPath);
78
+ expect(anonymizedPath).toBe('[node_modules]\\@react-native-windows\\cli\\index.js');
79
+ });
80
+ test('getAnonymizedPath() with path under %%LocalAppData%% is anonymized', () => {
81
+ const originalPath = path_1.default.normalize(path_1.default.join(process.env.LocalAppData, 'test.sln'));
82
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
83
+ expect(anonymizedPath).not.toBe(originalPath);
84
+ expect(anonymizedPath.startsWith('[LocalAppData]\\???')).toBe(true);
85
+ });
86
+ test('getAnonymizedPath() with a tracked npm package under %%LocalAppData%% is anonymized', () => {
87
+ const originalPath = path_1.default.normalize(path_1.default.join(process.env.LocalAppData, 'node_modules/@react-native-windows/cli/index.js'));
88
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
89
+ expect(anonymizedPath).not.toBe(originalPath);
90
+ expect(anonymizedPath).toBe('[node_modules]\\@react-native-windows\\cli\\index.js');
91
+ });
92
+ test('getAnonymizedPath() with arbitrary path not under project dir is anonymized', () => {
93
+ const originalPath = 'test.sln';
94
+ const anonymizedPath = sanitizeUtils.getAnonymizedPath(originalPath);
95
+ expect(anonymizedPath).not.toBe(originalPath);
96
+ expect(anonymizedPath).toBe('[path]');
97
+ });
98
98
  //# sourceMappingURL=sanitizeUtils.test.js.map
@@ -1,7 +1,7 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * @format
6
- */
7
- export {};
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ export {};
@@ -1,115 +1,115 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- *
6
- * @format
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const versionUtils = __importStar(require("../utils/versionUtils"));
36
- const path_1 = __importDefault(require("path"));
37
- const semver_1 = __importDefault(require("semver"));
38
- function expectValidVersion(version, expectSemVer) {
39
- expect(version).not.toBeNull();
40
- expect(version).toBeDefined();
41
- if (expectSemVer) {
42
- expect(semver_1.default.valid(version)).toBe(version);
43
- }
44
- else {
45
- version.split('.').forEach(s => {
46
- const tryParseInt = () => {
47
- parseInt(s, 10);
48
- };
49
- expect(tryParseInt).not.toThrow();
50
- });
51
- }
52
- }
53
- test('getNodeVersion() is valid', async () => {
54
- const version = await versionUtils.getNodeVersion();
55
- expectValidVersion(version, true);
56
- });
57
- test('getNpmVersion() is valid', async () => {
58
- const version = await versionUtils.getNpmVersion();
59
- if (version) {
60
- expectValidVersion(version, true);
61
- }
62
- });
63
- test('getYarnVersion() is valid', async () => {
64
- const version = await versionUtils.getYarnVersion();
65
- if (version) {
66
- expectValidVersion(version, true);
67
- }
68
- });
69
- test('getVisualStudioVersion() is valid', async () => {
70
- const version = await versionUtils.getVisualStudioVersion();
71
- expectValidVersion(version, false);
72
- });
73
- test('getVersionOfNpmPackage() of empty string is null', async () => {
74
- const version = await versionUtils.getVersionOfNpmPackage('');
75
- expect(version).toBeNull();
76
- });
77
- test('getVersionOfNpmPackage() of invalid package is null', async () => {
78
- const version = await versionUtils.getVersionOfNpmPackage('invalidpackage');
79
- expect(version).toBeNull();
80
- });
81
- test('getVersionOfNpmPackage() of valid package is valid', async () => {
82
- const version = await versionUtils.getVersionOfNpmPackage('jest');
83
- expectValidVersion(version, true);
84
- });
85
- test('getVersionsOfNuGetPackages() of valid package in packages.config is valid', async () => {
86
- const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackagesConfig/UsesPackagesConfig.vcxproj');
87
- const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
88
- 'Microsoft.Windows.CppWinRT',
89
- ]);
90
- expect(versions).not.toBeNull();
91
- expectValidVersion(versions['Microsoft.Windows.CppWinRT'], false);
92
- });
93
- test('getVersionsOfNuGetPackages() of invalid package in packages.config is invalid', async () => {
94
- const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackagesConfig/UsesPackagesConfig.vcxproj');
95
- const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
96
- 'Invalid.Package',
97
- ]);
98
- expect(versions).toStrictEqual({});
99
- });
100
- test('getVersionsOfNuGetPackages() of valid package in project is valid', async () => {
101
- const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackageReference/UsesPackageReference.csproj');
102
- const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
103
- 'Microsoft.NETCore.UniversalWindowsPlatform',
104
- ]);
105
- expect(versions).not.toBeNull();
106
- expectValidVersion(versions['Microsoft.NETCore.UniversalWindowsPlatform'], false);
107
- });
108
- test('getVersionsOfNuGetPackages() of invalid package in project is invalid', async () => {
109
- const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackageReference/UsesPackageReference.csproj');
110
- const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
111
- 'Invalid.Package',
112
- ]);
113
- expect(versions).toStrictEqual({});
114
- });
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ * Licensed under the MIT License.
5
+ *
6
+ * @format
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ const versionUtils = __importStar(require("../utils/versionUtils"));
36
+ const path_1 = __importDefault(require("path"));
37
+ const semver_1 = __importDefault(require("semver"));
38
+ function expectValidVersion(version, expectSemVer) {
39
+ expect(version).not.toBeNull();
40
+ expect(version).toBeDefined();
41
+ if (expectSemVer) {
42
+ expect(semver_1.default.valid(version)).toBe(version);
43
+ }
44
+ else {
45
+ version.split('.').forEach(s => {
46
+ const tryParseInt = () => {
47
+ parseInt(s, 10);
48
+ };
49
+ expect(tryParseInt).not.toThrow();
50
+ });
51
+ }
52
+ }
53
+ test('getNodeVersion() is valid', async () => {
54
+ const version = await versionUtils.getNodeVersion();
55
+ expectValidVersion(version, true);
56
+ });
57
+ test('getNpmVersion() is valid', async () => {
58
+ const version = await versionUtils.getNpmVersion();
59
+ if (version) {
60
+ expectValidVersion(version, true);
61
+ }
62
+ });
63
+ test('getYarnVersion() is valid', async () => {
64
+ const version = await versionUtils.getYarnVersion();
65
+ if (version) {
66
+ expectValidVersion(version, true);
67
+ }
68
+ });
69
+ test('getVisualStudioVersion() is valid', async () => {
70
+ const version = await versionUtils.getVisualStudioVersion();
71
+ expectValidVersion(version, false);
72
+ });
73
+ test('getVersionOfNpmPackage() of empty string is null', async () => {
74
+ const version = await versionUtils.getVersionOfNpmPackage('');
75
+ expect(version).toBeNull();
76
+ });
77
+ test('getVersionOfNpmPackage() of invalid package is null', async () => {
78
+ const version = await versionUtils.getVersionOfNpmPackage('invalidpackage');
79
+ expect(version).toBeNull();
80
+ });
81
+ test('getVersionOfNpmPackage() of valid package is valid', async () => {
82
+ const version = await versionUtils.getVersionOfNpmPackage('jest');
83
+ expectValidVersion(version, true);
84
+ });
85
+ test('getVersionsOfNuGetPackages() of valid package in packages.config is valid', async () => {
86
+ const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackagesConfig/UsesPackagesConfig.vcxproj');
87
+ const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
88
+ 'Microsoft.Windows.CppWinRT',
89
+ ]);
90
+ expect(versions).not.toBeNull();
91
+ expectValidVersion(versions['Microsoft.Windows.CppWinRT'], false);
92
+ });
93
+ test('getVersionsOfNuGetPackages() of invalid package in packages.config is invalid', async () => {
94
+ const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackagesConfig/UsesPackagesConfig.vcxproj');
95
+ const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
96
+ 'Invalid.Package',
97
+ ]);
98
+ expect(versions).toStrictEqual({});
99
+ });
100
+ test('getVersionsOfNuGetPackages() of valid package in project is valid', async () => {
101
+ const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackageReference/UsesPackageReference.csproj');
102
+ const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
103
+ 'Microsoft.NETCore.UniversalWindowsPlatform',
104
+ ]);
105
+ expect(versions).not.toBeNull();
106
+ expectValidVersion(versions['Microsoft.NETCore.UniversalWindowsPlatform'], false);
107
+ });
108
+ test('getVersionsOfNuGetPackages() of invalid package in project is invalid', async () => {
109
+ const projectFile = path_1.default.resolve(__dirname, 'projects/UsesPackageReference/UsesPackageReference.csproj');
110
+ const versions = await versionUtils.getVersionsOfNuGetPackages(projectFile, [
111
+ 'Invalid.Package',
112
+ ]);
113
+ expect(versions).toStrictEqual({});
114
+ });
115
115
  //# sourceMappingURL=versionUtils.test.js.map
@@ -1,81 +1,81 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- /**
7
- * Gets a telemetry-safe stable device ID.
8
- * @returns A telemetry-safe stable device ID.
9
- */
10
- export declare function deviceId(): Promise<string>;
11
- /**
12
- * Gets the device architecture, like x86/x64/arm64.
13
- * @returns The device architecture.
14
- */
15
- export declare function deviceArchitecture(): string;
16
- /**
17
- * Gets the node architecture, like x86/x64/arm64.
18
- * @returns The node architecture.
19
- */
20
- export declare function nodeArchitecture(): string;
21
- /**
22
- * Gets the device platform, like darwin/linux/win32.
23
- * @returns The device platform.
24
- */
25
- export declare function devicePlatform(): string;
26
- /**
27
- * Gets the device locale.
28
- * @returns The device locale.
29
- */
30
- export declare function deviceLocale(): Promise<string>;
31
- /**
32
- * Gets the device's number of CPUs.
33
- * @returns The device's number of CPUs.
34
- */
35
- export declare function deviceNumCPUs(): number;
36
- /**
37
- * Gets the device's total memory in bytes.
38
- * @returns The device's total memory in bytes.
39
- */
40
- export declare function deviceTotalMemory(): number;
41
- /**
42
- * Gets the free space of the give drive in bytes.
43
- * @param drivePath A path on the drive to check.
44
- * @returns The free space of the give drive in bytes.
45
- */
46
- export declare function deviceDiskFreeSpace(drivePath?: string | null): number;
47
- /**
48
- * Gets the telemetry sample rate.
49
- * @returns The telemetry sample rate.
50
- */
51
- export declare function sampleRate(): number;
52
- /**
53
- * Gets whether or not telemetry events are captured when running in CI.
54
- * @returns Whether or not telemetry events are captured when running in CI.
55
- */
56
- export declare function captureCI(): boolean;
57
- /**
58
- * Gets the whether the process is currently running in CI.
59
- * @returns Whether the process is currently running in CI.
60
- */
61
- export declare function isCI(): boolean;
62
- /**
63
- * Gets the type of CI the process is running under.
64
- * @returns The type of CI the process is running under.
65
- */
66
- export declare function ciType(): string;
67
- /**
68
- * Gets whether the process is running on a Microsoft owned machine.
69
- * @returns Whether the process is running on a Microsoft owned machine.
70
- */
71
- export declare function isMsftInternal(): boolean;
72
- /**
73
- * Gets whether the process is running as part of our CLI tests.
74
- * @returns Whether the process is running as part of our CLI tests.
75
- */
76
- export declare function isCliTest(): boolean;
77
- /**
78
- * Gets a stable session ID for correlating telemetry events.
79
- * @returns A stable session ID for correlating telemetry events.
80
- */
81
- export declare function getSessionId(): string;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+ /**
7
+ * Gets a telemetry-safe stable device ID.
8
+ * @returns A telemetry-safe stable device ID.
9
+ */
10
+ export declare function deviceId(): Promise<string>;
11
+ /**
12
+ * Gets the device architecture, like x86/x64/arm64.
13
+ * @returns The device architecture.
14
+ */
15
+ export declare function deviceArchitecture(): string;
16
+ /**
17
+ * Gets the node architecture, like x86/x64/arm64.
18
+ * @returns The node architecture.
19
+ */
20
+ export declare function nodeArchitecture(): string;
21
+ /**
22
+ * Gets the device platform, like darwin/linux/win32.
23
+ * @returns The device platform.
24
+ */
25
+ export declare function devicePlatform(): string;
26
+ /**
27
+ * Gets the device locale.
28
+ * @returns The device locale.
29
+ */
30
+ export declare function deviceLocale(): Promise<string>;
31
+ /**
32
+ * Gets the device's number of CPUs.
33
+ * @returns The device's number of CPUs.
34
+ */
35
+ export declare function deviceNumCPUs(): number;
36
+ /**
37
+ * Gets the device's total memory in bytes.
38
+ * @returns The device's total memory in bytes.
39
+ */
40
+ export declare function deviceTotalMemory(): number;
41
+ /**
42
+ * Gets the free space of the give drive in bytes.
43
+ * @param drivePath A path on the drive to check.
44
+ * @returns The free space of the give drive in bytes.
45
+ */
46
+ export declare function deviceDiskFreeSpace(drivePath?: string | null): number;
47
+ /**
48
+ * Gets the telemetry sample rate.
49
+ * @returns The telemetry sample rate.
50
+ */
51
+ export declare function sampleRate(): number;
52
+ /**
53
+ * Gets whether or not telemetry events are captured when running in CI.
54
+ * @returns Whether or not telemetry events are captured when running in CI.
55
+ */
56
+ export declare function captureCI(): boolean;
57
+ /**
58
+ * Gets the whether the process is currently running in CI.
59
+ * @returns Whether the process is currently running in CI.
60
+ */
61
+ export declare function isCI(): boolean;
62
+ /**
63
+ * Gets the type of CI the process is running under.
64
+ * @returns The type of CI the process is running under.
65
+ */
66
+ export declare function ciType(): string;
67
+ /**
68
+ * Gets whether the process is running on a Microsoft owned machine.
69
+ * @returns Whether the process is running on a Microsoft owned machine.
70
+ */
71
+ export declare function isMsftInternal(): boolean;
72
+ /**
73
+ * Gets whether the process is running as part of our CLI tests.
74
+ * @returns Whether the process is running as part of our CLI tests.
75
+ */
76
+ export declare function isCliTest(): boolean;
77
+ /**
78
+ * Gets a stable session ID for correlating telemetry events.
79
+ * @returns A stable session ID for correlating telemetry events.
80
+ */
81
+ export declare function getSessionId(): string;