@sentry/wizard 4.7.0 → 4.9.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.
Files changed (175) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +19 -19
  3. package/dist/e2e-tests/tests/angular-17.test.d.ts +1 -0
  4. package/dist/e2e-tests/tests/angular-17.test.js +196 -0
  5. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -0
  6. package/dist/e2e-tests/tests/angular-19.test.d.ts +1 -0
  7. package/dist/e2e-tests/tests/angular-19.test.js +194 -0
  8. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -0
  9. package/dist/e2e-tests/tests/expo.test.d.ts +1 -0
  10. package/dist/e2e-tests/tests/expo.test.js +103 -0
  11. package/dist/e2e-tests/tests/expo.test.js.map +1 -0
  12. package/dist/e2e-tests/tests/help-message.test.js +2 -2
  13. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/react-native.test.d.ts +1 -0
  15. package/dist/e2e-tests/tests/react-native.test.js +132 -0
  16. package/dist/e2e-tests/tests/react-native.test.js.map +1 -0
  17. package/dist/e2e-tests/tests/remix.test.js +4 -4
  18. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  19. package/dist/e2e-tests/tests/sveltekit.test.js +2 -2
  20. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  21. package/dist/e2e-tests/utils/index.d.ts +7 -0
  22. package/dist/e2e-tests/utils/index.js +32 -7
  23. package/dist/e2e-tests/utils/index.js.map +1 -1
  24. package/dist/lib/Constants.d.ts +1 -0
  25. package/dist/lib/Constants.js +3 -0
  26. package/dist/lib/Constants.js.map +1 -1
  27. package/dist/lib/Helper/SentryCli.d.ts +0 -11
  28. package/dist/lib/Helper/SentryCli.js +0 -52
  29. package/dist/lib/Helper/SentryCli.js.map +1 -1
  30. package/dist/src/android/templates.js +2 -0
  31. package/dist/src/android/templates.js.map +1 -1
  32. package/dist/src/angular/angular-wizard.d.ts +3 -0
  33. package/dist/src/angular/angular-wizard.js +186 -0
  34. package/dist/src/angular/angular-wizard.js.map +1 -0
  35. package/dist/src/angular/codemods/app-config.d.ts +3 -0
  36. package/dist/src/angular/codemods/app-config.js +211 -0
  37. package/dist/src/angular/codemods/app-config.js.map +1 -0
  38. package/dist/src/angular/codemods/main.d.ts +20 -0
  39. package/dist/src/angular/codemods/main.js +62 -0
  40. package/dist/src/angular/codemods/main.js.map +1 -0
  41. package/dist/src/angular/codemods/sourcemaps.d.ts +21 -0
  42. package/dist/src/angular/codemods/sourcemaps.js +94 -0
  43. package/dist/src/angular/codemods/sourcemaps.js.map +1 -0
  44. package/dist/src/angular/example-component.d.ts +8 -0
  45. package/dist/src/angular/example-component.js +286 -0
  46. package/dist/src/angular/example-component.js.map +1 -0
  47. package/dist/src/angular/sdk-setup.d.ts +6 -0
  48. package/dist/src/angular/sdk-setup.js +99 -0
  49. package/dist/src/angular/sdk-setup.js.map +1 -0
  50. package/dist/src/apple/code-tools.d.ts +4 -2
  51. package/dist/src/apple/code-tools.js +21 -11
  52. package/dist/src/apple/code-tools.js.map +1 -1
  53. package/dist/src/apple/inject-code-snippet.js +5 -3
  54. package/dist/src/apple/inject-code-snippet.js.map +1 -1
  55. package/dist/src/apple/macos-system-helper.d.ts +5 -0
  56. package/dist/src/apple/macos-system-helper.js +86 -0
  57. package/dist/src/apple/macos-system-helper.js.map +1 -0
  58. package/dist/src/apple/templates.js +10 -0
  59. package/dist/src/apple/templates.js.map +1 -1
  60. package/dist/src/apple/xcode-manager.d.ts +237 -11
  61. package/dist/src/apple/xcode-manager.js +736 -65
  62. package/dist/src/apple/xcode-manager.js.map +1 -1
  63. package/dist/src/apple/xcode-project-object-with-id.d.ts +5 -0
  64. package/dist/src/apple/xcode-project-object-with-id.js +3 -0
  65. package/dist/src/apple/xcode-project-object-with-id.js.map +1 -0
  66. package/dist/src/flutter/flutter-wizard.js +10 -2
  67. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  68. package/dist/src/flutter/templates.js +7 -1
  69. package/dist/src/flutter/templates.js.map +1 -1
  70. package/dist/src/nextjs/nextjs-wizard.js +27 -15
  71. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  72. package/dist/src/nextjs/templates.js +56 -7
  73. package/dist/src/nextjs/templates.js.map +1 -1
  74. package/dist/src/nuxt/nuxt-wizard.js +1 -3
  75. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  76. package/dist/src/nuxt/templates.js +30 -0
  77. package/dist/src/nuxt/templates.js.map +1 -1
  78. package/dist/src/react-native/expo-env-file.js +5 -0
  79. package/dist/src/react-native/expo-env-file.js.map +1 -1
  80. package/dist/src/react-native/expo-metro.js +22 -6
  81. package/dist/src/react-native/expo-metro.js.map +1 -1
  82. package/dist/src/react-native/expo.js +11 -1
  83. package/dist/src/react-native/expo.js.map +1 -1
  84. package/dist/src/react-native/glob.js +14 -4
  85. package/dist/src/react-native/glob.js.map +1 -1
  86. package/dist/src/react-native/gradle.js +14 -4
  87. package/dist/src/react-native/gradle.js.map +1 -1
  88. package/dist/src/react-native/javascript.d.ts +9 -4
  89. package/dist/src/react-native/javascript.js +52 -23
  90. package/dist/src/react-native/javascript.js.map +1 -1
  91. package/dist/src/react-native/metro.d.ts +1 -1
  92. package/dist/src/react-native/metro.js +36 -4
  93. package/dist/src/react-native/metro.js.map +1 -1
  94. package/dist/src/react-native/react-native-wizard.d.ts +4 -0
  95. package/dist/src/react-native/react-native-wizard.js +32 -4
  96. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  97. package/dist/src/react-native/xcode.js +29 -10
  98. package/dist/src/react-native/xcode.js.map +1 -1
  99. package/dist/src/remix/remix-wizard.js +1 -3
  100. package/dist/src/remix/remix-wizard.js.map +1 -1
  101. package/dist/src/remix/sdk-example.js +30 -1
  102. package/dist/src/remix/sdk-example.js.map +1 -1
  103. package/dist/src/remix/sdk-setup.js +11 -5
  104. package/dist/src/remix/sdk-setup.js.map +1 -1
  105. package/dist/src/run.d.ts +1 -1
  106. package/dist/src/run.js +5 -0
  107. package/dist/src/run.js.map +1 -1
  108. package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +1 -1
  109. package/dist/src/sourcemaps/sourcemaps-wizard.js +35 -20
  110. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  111. package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
  112. package/dist/src/sourcemaps/tools/angular.js +7 -7
  113. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  114. package/dist/src/sourcemaps/tools/sentry-cli.d.ts +5 -1
  115. package/dist/src/sourcemaps/tools/sentry-cli.js +6 -3
  116. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  117. package/dist/src/sourcemaps/tools/tsc.js +5 -1
  118. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  119. package/dist/src/sourcemaps/tools/vite.js +4 -1
  120. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  121. package/dist/src/sourcemaps/tools/webpack.js +4 -1
  122. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  123. package/dist/src/sveltekit/sdk-example.js +1 -1
  124. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  125. package/dist/src/sveltekit/sveltekit-wizard.js +3 -5
  126. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  127. package/dist/src/sveltekit/templates.js +28 -1
  128. package/dist/src/sveltekit/templates.js.map +1 -1
  129. package/dist/src/utils/clack/index.d.ts +13 -15
  130. package/dist/src/utils/clack/index.js +17 -50
  131. package/dist/src/utils/clack/index.js.map +1 -1
  132. package/dist/src/utils/git.d.ts +11 -0
  133. package/dist/src/utils/git.js +69 -0
  134. package/dist/src/utils/git.js.map +1 -0
  135. package/dist/src/utils/sentrycli-utils.js +13 -4
  136. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  137. package/dist/src/version.d.ts +1 -1
  138. package/dist/src/version.js +1 -1
  139. package/dist/src/version.js.map +1 -1
  140. package/dist/test/angular/angular-wizard.test.d.ts +1 -0
  141. package/dist/test/angular/angular-wizard.test.js +27 -0
  142. package/dist/test/angular/angular-wizard.test.js.map +1 -0
  143. package/dist/test/angular/codemods/sourcemaps.test.d.ts +1 -0
  144. package/dist/test/angular/codemods/sourcemaps.test.js +237 -0
  145. package/dist/test/angular/codemods/sourcemaps.test.js.map +1 -0
  146. package/dist/test/angular/example-component.test.d.ts +1 -0
  147. package/dist/test/angular/example-component.test.js +105 -0
  148. package/dist/test/angular/example-component.test.js.map +1 -0
  149. package/dist/test/apple/code-tools.test.js +54 -35
  150. package/dist/test/apple/code-tools.test.js.map +1 -1
  151. package/dist/test/apple/configure-sentry-cli.test.d.ts +1 -0
  152. package/dist/test/apple/configure-sentry-cli.test.js +131 -0
  153. package/dist/test/apple/configure-sentry-cli.test.js.map +1 -0
  154. package/dist/test/apple/macos-system-helper-mocked.test.d.ts +1 -0
  155. package/dist/test/apple/macos-system-helper-mocked.test.js +46 -0
  156. package/dist/test/apple/macos-system-helper-mocked.test.js.map +1 -0
  157. package/dist/test/apple/macos-system-helper.test.d.ts +1 -0
  158. package/dist/test/apple/macos-system-helper.test.js +88 -0
  159. package/dist/test/apple/macos-system-helper.test.js.map +1 -0
  160. package/dist/test/apple/templates.test.js +10 -0
  161. package/dist/test/apple/templates.test.js.map +1 -1
  162. package/dist/test/apple/xcode-manager.test.js +745 -379
  163. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  164. package/dist/test/flutter/templates.test.js +9 -0
  165. package/dist/test/flutter/templates.test.js.map +1 -1
  166. package/dist/test/react-native/javascript.test.js +119 -0
  167. package/dist/test/react-native/javascript.test.js.map +1 -1
  168. package/dist/test/react-native/metro.test.js +113 -0
  169. package/dist/test/react-native/metro.test.js.map +1 -1
  170. package/dist/test/remix/client-entry.test.js +10 -10
  171. package/dist/test/remix/client-entry.test.js.map +1 -1
  172. package/dist/test/utils/git.test.d.ts +1 -0
  173. package/dist/test/utils/git.test.js +70 -0
  174. package/dist/test/utils/git.test.js.map +1 -0
  175. package/package.json +1 -1
@@ -22,20 +22,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.createSentryCLIRC = void 0;
30
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
31
+ const prompts_1 = __importDefault(require("@clack/prompts"));
32
+ const chalk_1 = __importDefault(require("chalk"));
27
33
  const fs = __importStar(require("fs"));
28
34
  const path = __importStar(require("path"));
29
35
  function createSentryCLIRC(directory, params) {
30
36
  const rcPath = path.join(directory, '.sentryclirc');
31
37
  fs.writeFileSync(rcPath, '[auth]\ntoken=' + params.auth_token);
32
- if (!fs.existsSync('.gitignore')) {
33
- fs.writeFileSync('.gitignore', '.sentryclirc');
38
+ const gitignorePath = path.join(directory, '.gitignore');
39
+ if (!fs.existsSync(gitignorePath)) {
40
+ prompts_1.default.log.info(`Creating .gitignore file at path: ${chalk_1.default.cyan(gitignorePath)}`);
41
+ fs.writeFileSync(gitignorePath, '.sentryclirc');
34
42
  }
35
43
  else {
36
- const gitIgnore = fs.readFileSync('.gitignore').toString();
44
+ const gitIgnore = fs.readFileSync(gitignorePath).toString();
37
45
  if (!gitIgnore.includes('.sentryclirc')) {
38
- fs.appendFileSync('.gitignore', '\n.sentryclirc');
46
+ prompts_1.default.log.info(`Appending .sentryclirc to .gitignore file at path: ${chalk_1.default.cyan(gitignorePath)}`);
47
+ fs.appendFileSync(gitignorePath, '\n.sentryclirc\n');
39
48
  }
40
49
  }
41
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sentrycli-utils.js","sourceRoot":"","sources":["../../../src/utils/sentrycli-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAM7B,SAAgB,iBAAiB,CAC/B,SAAiB,EACjB,MAA8B;IAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACpD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAChC,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;KAChD;SAAM;QACL,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACvC,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;SACnD;KACF;AACH,CAAC;AAfD,8CAeC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nexport interface SentryCLIConfiguration {\n auth_token: string;\n}\n\nexport function createSentryCLIRC(\n directory: string,\n params: SentryCLIConfiguration,\n) {\n const rcPath = path.join(directory, '.sentryclirc');\n fs.writeFileSync(rcPath, '[auth]\\ntoken=' + params.auth_token);\n\n if (!fs.existsSync('.gitignore')) {\n fs.writeFileSync('.gitignore', '.sentryclirc');\n } else {\n const gitIgnore = fs.readFileSync('.gitignore').toString();\n if (!gitIgnore.includes('.sentryclirc')) {\n fs.appendFileSync('.gitignore', '\\n.sentryclirc');\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sentrycli-utils.js","sourceRoot":"","sources":["../../../src/utils/sentrycli-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,uCAAyB;AACzB,2CAA6B;AAM7B,SAAgB,iBAAiB,CAC/B,SAAiB,EACjB,MAA8B;IAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACpD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QACjC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,qCAAqC,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CACjE,CAAC;QACF,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;KACjD;SAAM;QACL,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC5D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACvC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,sDAAsD,eAAK,CAAC,IAAI,CAC9D,aAAa,CACd,EAAE,CACJ,CAAC;YACF,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;SACtD;KACF;AACH,CAAC;AAxBD,8CAwBC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nexport interface SentryCLIConfiguration {\n auth_token: string;\n}\n\nexport function createSentryCLIRC(\n directory: string,\n params: SentryCLIConfiguration,\n) {\n const rcPath = path.join(directory, '.sentryclirc');\n fs.writeFileSync(rcPath, '[auth]\\ntoken=' + params.auth_token);\n\n const gitignorePath = path.join(directory, '.gitignore');\n if (!fs.existsSync(gitignorePath)) {\n clack.log.info(\n `Creating .gitignore file at path: ${chalk.cyan(gitignorePath)}`,\n );\n fs.writeFileSync(gitignorePath, '.sentryclirc');\n } else {\n const gitIgnore = fs.readFileSync(gitignorePath).toString();\n if (!gitIgnore.includes('.sentryclirc')) {\n clack.log.info(\n `Appending .sentryclirc to .gitignore file at path: ${chalk.cyan(\n gitignorePath,\n )}`,\n );\n fs.appendFileSync(gitignorePath, '\\n.sentryclirc\\n');\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- export declare const WIZARD_VERSION = "4.7.0";
1
+ export declare const WIZARD_VERSION = "4.9.0";
@@ -3,5 +3,5 @@
3
3
  // This is file is updated at release time.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.WIZARD_VERSION = void 0;
6
- exports.WIZARD_VERSION = '4.7.0';
6
+ exports.WIZARD_VERSION = '4.9.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,2CAA2C;;;AAE9B,QAAA,cAAc,GAAG,OAAO,CAAC","sourcesContent":["// DO NOT modify this file manually!\n// This is file is updated at release time.\n\nexport const WIZARD_VERSION = '4.7.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,2CAA2C;;;AAE9B,QAAA,cAAc,GAAG,OAAO,CAAC","sourcesContent":["// DO NOT modify this file manually!\n// This is file is updated at release time.\n\nexport const WIZARD_VERSION = '4.9.0';\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const angular_wizard_1 = require("../../src/angular/angular-wizard");
5
+ (0, vitest_1.describe)('buildOutroMessage', () => {
6
+ (0, vitest_1.it)('returns the correct outro message if example component was created', () => {
7
+ (0, vitest_1.expect)((0, angular_wizard_1.buildOutroMessage)(true)).toMatchInlineSnapshot(`
8
+ "
9
+ Successfully installed the Sentry Angular SDK!
10
+
11
+ You can validate your setup by starting your dev environment (ng serve) and throwing an error in the example component.
12
+
13
+ Check out the SDK documentation for further configuration:
14
+ https://docs.sentry.io/platforms/javascript/guides/angular/"
15
+ `);
16
+ });
17
+ (0, vitest_1.it)('returns the correct outro message if example component creation was skipped', () => {
18
+ (0, vitest_1.expect)((0, angular_wizard_1.buildOutroMessage)(false)).toMatchInlineSnapshot(`
19
+ "
20
+ Successfully installed the Sentry Angular SDK!
21
+
22
+ Check out the SDK documentation for further configuration:
23
+ https://docs.sentry.io/platforms/javascript/guides/angular/"
24
+ `);
25
+ });
26
+ });
27
+ //# sourceMappingURL=angular-wizard.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-wizard.test.js","sourceRoot":"","sources":["../../../test/angular/angular-wizard.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAE9C,qEAAqE;AAErE,IAAA,iBAAQ,EAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAA,WAAE,EAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,IAAA,eAAM,EAAC,IAAA,kCAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;KAQrD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,IAAA,WAAE,EAAC,6EAA6E,EAAE,GAAG,EAAE;QACrF,IAAA,eAAM,EAAC,IAAA,kCAAiB,EAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;KAMtD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\n\nimport { buildOutroMessage } from '../../src/angular/angular-wizard';\n\ndescribe('buildOutroMessage', () => {\n it('returns the correct outro message if example component was created', () => {\n expect(buildOutroMessage(true)).toMatchInlineSnapshot(`\n \"\n Successfully installed the Sentry Angular SDK!\n\n You can validate your setup by starting your dev environment (ng serve) and throwing an error in the example component.\n\n Check out the SDK documentation for further configuration:\n https://docs.sentry.io/platforms/javascript/guides/angular/\"\n `);\n });\n it('returns the correct outro message if example component creation was skipped', () => {\n expect(buildOutroMessage(false)).toMatchInlineSnapshot(`\n \"\n Successfully installed the Sentry Angular SDK!\n\n Check out the SDK documentation for further configuration:\n https://docs.sentry.io/platforms/javascript/guides/angular/\"\n `);\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const vitest_1 = require("vitest");
27
+ const sourcemaps_1 = require("../../../src/angular/codemods/sourcemaps");
28
+ const AngularSourceMapsWizard = __importStar(require("../../../src/sourcemaps/tools/angular"));
29
+ const { readFileSyncMock, writeFileSyncMock } = vitest_1.vi.hoisted(() => {
30
+ return {
31
+ readFileSyncMock: vitest_1.vi.fn(),
32
+ writeFileSyncMock: vitest_1.vi.fn(),
33
+ };
34
+ });
35
+ vitest_1.vi.mock('fs', async () => {
36
+ return {
37
+ ...(await vitest_1.vi.importActual('fs')),
38
+ readFileSync: readFileSyncMock,
39
+ writeFileSync: writeFileSyncMock,
40
+ };
41
+ });
42
+ (0, vitest_1.describe)('addSourcemapEntryToAngularJSON', () => {
43
+ const configureAngularSourcemapGenerationFlowSpy = vitest_1.vi
44
+ .spyOn(AngularSourceMapsWizard, 'configureAngularSourcemapGenerationFlow')
45
+ .mockImplementation(() => Promise.resolve());
46
+ (0, vitest_1.beforeEach)(() => {
47
+ vitest_1.vi.clearAllMocks();
48
+ });
49
+ (0, vitest_1.it)('reads and writes the `angular.json` file correctly', async () => {
50
+ const angularJsonPath = 'angular.json';
51
+ const angularJsonContent = JSON.stringify({
52
+ projects: {
53
+ project1: {
54
+ architect: {
55
+ build: {
56
+ configurations: {
57
+ production: {
58
+ someKey: 'someValue',
59
+ },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ },
65
+ });
66
+ readFileSyncMock.mockReturnValue(angularJsonContent);
67
+ await (0, sourcemaps_1.addSourcemapEntryToAngularJSON)();
68
+ (0, vitest_1.expect)(readFileSyncMock).toHaveBeenCalledWith(vitest_1.expect.stringContaining(angularJsonPath), 'utf-8');
69
+ (0, vitest_1.expect)(writeFileSyncMock).toHaveBeenCalledWith(vitest_1.expect.stringContaining(angularJsonPath), JSON.stringify({
70
+ projects: {
71
+ project1: {
72
+ architect: {
73
+ build: {
74
+ configurations: {
75
+ production: {
76
+ someKey: 'someValue',
77
+ sourceMap: true,
78
+ },
79
+ },
80
+ },
81
+ },
82
+ },
83
+ },
84
+ }, null, 2));
85
+ });
86
+ (0, vitest_1.it)('falls back to printing copy/paste instructions when reading fails', async () => {
87
+ readFileSyncMock.mockImplementation(() => {
88
+ throw new Error('File not found');
89
+ });
90
+ await (0, sourcemaps_1.addSourcemapEntryToAngularJSON)();
91
+ (0, vitest_1.expect)(configureAngularSourcemapGenerationFlowSpy).toHaveBeenCalledOnce();
92
+ (0, vitest_1.expect)(writeFileSyncMock).not.toHaveBeenCalled();
93
+ });
94
+ (0, vitest_1.it)('falls back to printing copy/paste instructions when writing fails', async () => {
95
+ const angularJsonContent = JSON.stringify({
96
+ projects: {
97
+ project1: {},
98
+ },
99
+ });
100
+ readFileSyncMock.mockReturnValue(angularJsonContent);
101
+ writeFileSyncMock.mockImplementation(() => {
102
+ throw new Error('Write failed');
103
+ });
104
+ await (0, sourcemaps_1.addSourcemapEntryToAngularJSON)();
105
+ (0, vitest_1.expect)(configureAngularSourcemapGenerationFlowSpy).toHaveBeenCalledOnce();
106
+ (0, vitest_1.expect)(writeFileSyncMock).toHaveBeenCalled();
107
+ });
108
+ (0, vitest_1.it)('falls back to printing copy/paste instructions when angular.json` has no projects', async () => {
109
+ const angularJsonContent = JSON.stringify({
110
+ projects: {},
111
+ });
112
+ readFileSyncMock.mockReturnValue(angularJsonContent);
113
+ await (0, sourcemaps_1.addSourcemapEntryToAngularJSON)();
114
+ (0, vitest_1.expect)(configureAngularSourcemapGenerationFlowSpy).toHaveBeenCalledOnce();
115
+ (0, vitest_1.expect)(writeFileSyncMock).not.toHaveBeenCalled();
116
+ });
117
+ });
118
+ (0, vitest_1.describe)('addSourceMapsSetting', () => {
119
+ (0, vitest_1.it)('adds sourceMap setting to angular.json', () => {
120
+ const angularJson = {
121
+ projects: {
122
+ project1: {
123
+ architect: {
124
+ build: {
125
+ configurations: {
126
+ production: {},
127
+ },
128
+ },
129
+ },
130
+ },
131
+ project2: {
132
+ architect: {},
133
+ },
134
+ },
135
+ };
136
+ const updatedAngularJson = (0, sourcemaps_1.addSourceMapsSetting)(angularJson);
137
+ (0, vitest_1.expect)(updatedAngularJson).toEqual({
138
+ projects: {
139
+ project1: {
140
+ architect: {
141
+ build: {
142
+ configurations: {
143
+ production: { sourceMap: true },
144
+ },
145
+ },
146
+ },
147
+ },
148
+ project2: {
149
+ architect: {
150
+ build: {
151
+ configurations: {
152
+ production: {
153
+ sourceMap: true,
154
+ },
155
+ },
156
+ },
157
+ },
158
+ },
159
+ },
160
+ });
161
+ });
162
+ (0, vitest_1.it)('returns `undefined` if no projects are found', () => {
163
+ const angularJson = {};
164
+ const updatedAngularJson = (0, sourcemaps_1.addSourceMapsSetting)(angularJson);
165
+ (0, vitest_1.expect)(updatedAngularJson).toBeUndefined();
166
+ });
167
+ (0, vitest_1.it)('returns `undefined` if projects have no architect', () => {
168
+ const angularJson = {
169
+ projects: {},
170
+ };
171
+ const updatedAngularJson = (0, sourcemaps_1.addSourceMapsSetting)(angularJson);
172
+ (0, vitest_1.expect)(updatedAngularJson).toBeUndefined();
173
+ });
174
+ vitest_1.it.each([
175
+ {
176
+ projects: {
177
+ project1: {
178
+ architect: {
179
+ build: {
180
+ configurations: {
181
+ production: {},
182
+ },
183
+ },
184
+ },
185
+ },
186
+ },
187
+ },
188
+ {
189
+ projects: {
190
+ project1: {
191
+ architect: {
192
+ build: {
193
+ configurations: {},
194
+ },
195
+ },
196
+ },
197
+ },
198
+ },
199
+ {
200
+ projects: {
201
+ project1: {
202
+ architect: {
203
+ build: {},
204
+ },
205
+ },
206
+ },
207
+ },
208
+ {
209
+ projects: {
210
+ project1: {
211
+ architect: {},
212
+ },
213
+ },
214
+ },
215
+ {
216
+ projects: {
217
+ project1: {},
218
+ },
219
+ },
220
+ ])('handles incomplete project declarations (%s)', (angularJson) => {
221
+ const updatedAngularJson = (0, sourcemaps_1.addSourceMapsSetting)(angularJson);
222
+ (0, vitest_1.expect)(updatedAngularJson).toEqual({
223
+ projects: {
224
+ project1: {
225
+ architect: {
226
+ build: {
227
+ configurations: {
228
+ production: { sourceMap: true },
229
+ },
230
+ },
231
+ },
232
+ },
233
+ },
234
+ });
235
+ });
236
+ });
237
+ //# sourceMappingURL=sourcemaps.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourcemaps.test.js","sourceRoot":"","sources":["../../../../test/angular/codemods/sourcemaps.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8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EAAE;gBACR,QAAQ,EAAE,EAAE;aACb;SACF;KACF,CAAC,CAAC,8CAA8C,EAAE,CAAC,WAAW,EAAE,EAAE;QACjE,MAAM,kBAAkB,GAAG,IAAA,iCAAoB,EAAC,WAAW,CAAC,CAAC;QAE7D,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC;YACjC,QAAQ,EAAE;gBACR,QAAQ,EAAE;oBACR,SAAS,EAAE;wBACT,KAAK,EAAE;4BACL,cAAc,EAAE;gCACd,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;6BAChC;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, vi, expect, beforeEach } from 'vitest';\nimport {\n addSourcemapEntryToAngularJSON,\n addSourceMapsSetting,\n} from '../../../src/angular/codemods/sourcemaps';\n\nimport * as AngularSourceMapsWizard from '../../../src/sourcemaps/tools/angular';\n\nconst { readFileSyncMock, writeFileSyncMock } = vi.hoisted(() => {\n return {\n readFileSyncMock: vi.fn(),\n writeFileSyncMock: vi.fn(),\n };\n});\n\nvi.mock('fs', async () => {\n return {\n ...(await vi.importActual('fs')),\n readFileSync: readFileSyncMock,\n writeFileSync: writeFileSyncMock,\n };\n});\n\ndescribe('addSourcemapEntryToAngularJSON', () => {\n const configureAngularSourcemapGenerationFlowSpy = vi\n .spyOn(AngularSourceMapsWizard, 'configureAngularSourcemapGenerationFlow')\n .mockImplementation(() => Promise.resolve());\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it('reads and writes the `angular.json` file correctly', async () => {\n const angularJsonPath = 'angular.json';\n const angularJsonContent = JSON.stringify({\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {\n production: {\n someKey: 'someValue',\n },\n },\n },\n },\n },\n },\n });\n\n readFileSyncMock.mockReturnValue(angularJsonContent);\n\n await addSourcemapEntryToAngularJSON();\n\n expect(readFileSyncMock).toHaveBeenCalledWith(\n expect.stringContaining(angularJsonPath),\n 'utf-8',\n );\n expect(writeFileSyncMock).toHaveBeenCalledWith(\n expect.stringContaining(angularJsonPath),\n JSON.stringify(\n {\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {\n production: {\n someKey: 'someValue',\n sourceMap: true,\n },\n },\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n );\n });\n\n it('falls back to printing copy/paste instructions when reading fails', async () => {\n readFileSyncMock.mockImplementation(() => {\n throw new Error('File not found');\n });\n\n await addSourcemapEntryToAngularJSON();\n\n expect(configureAngularSourcemapGenerationFlowSpy).toHaveBeenCalledOnce();\n expect(writeFileSyncMock).not.toHaveBeenCalled();\n });\n\n it('falls back to printing copy/paste instructions when writing fails', async () => {\n const angularJsonContent = JSON.stringify({\n projects: {\n project1: {},\n },\n });\n\n readFileSyncMock.mockReturnValue(angularJsonContent);\n writeFileSyncMock.mockImplementation(() => {\n throw new Error('Write failed');\n });\n\n await addSourcemapEntryToAngularJSON();\n\n expect(configureAngularSourcemapGenerationFlowSpy).toHaveBeenCalledOnce();\n expect(writeFileSyncMock).toHaveBeenCalled();\n });\n\n it('falls back to printing copy/paste instructions when angular.json` has no projects', async () => {\n const angularJsonContent = JSON.stringify({\n projects: {},\n });\n\n readFileSyncMock.mockReturnValue(angularJsonContent);\n\n await addSourcemapEntryToAngularJSON();\n\n expect(configureAngularSourcemapGenerationFlowSpy).toHaveBeenCalledOnce();\n expect(writeFileSyncMock).not.toHaveBeenCalled();\n });\n});\n\ndescribe('addSourceMapsSetting', () => {\n it('adds sourceMap setting to angular.json', () => {\n const angularJson = {\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {\n production: {},\n },\n },\n },\n },\n project2: {\n architect: {},\n },\n },\n };\n\n const updatedAngularJson = addSourceMapsSetting(angularJson);\n\n expect(updatedAngularJson).toEqual({\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {\n production: { sourceMap: true },\n },\n },\n },\n },\n project2: {\n architect: {\n build: {\n configurations: {\n production: {\n sourceMap: true,\n },\n },\n },\n },\n },\n },\n });\n });\n\n it('returns `undefined` if no projects are found', () => {\n const angularJson = {};\n\n const updatedAngularJson = addSourceMapsSetting(angularJson);\n\n expect(updatedAngularJson).toBeUndefined();\n });\n\n it('returns `undefined` if projects have no architect', () => {\n const angularJson = {\n projects: {},\n };\n\n const updatedAngularJson = addSourceMapsSetting(angularJson);\n\n expect(updatedAngularJson).toBeUndefined();\n });\n\n it.each([\n {\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {\n production: {},\n },\n },\n },\n },\n },\n },\n {\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {},\n },\n },\n },\n },\n },\n {\n projects: {\n project1: {\n architect: {\n build: {},\n },\n },\n },\n },\n {\n projects: {\n project1: {\n architect: {},\n },\n },\n },\n {\n projects: {\n project1: {},\n },\n },\n ])('handles incomplete project declarations (%s)', (angularJson) => {\n const updatedAngularJson = addSourceMapsSetting(angularJson);\n\n expect(updatedAngularJson).toEqual({\n projects: {\n project1: {\n architect: {\n build: {\n configurations: {\n production: { sourceMap: true },\n },\n },\n },\n },\n },\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const vitest_1 = require("vitest");
27
+ const example_component_1 = require("../../src/angular/example-component");
28
+ const clackUtils = __importStar(require("../../src/utils/clack"));
29
+ const fsMocks = vitest_1.vi.hoisted(() => ({
30
+ existsSyncMock: vitest_1.vi.fn(() => true),
31
+ writeFileSyncMock: vitest_1.vi.fn(),
32
+ mkdirSyncMock: vitest_1.vi.fn(),
33
+ }));
34
+ vitest_1.vi.mock('fs', () => ({
35
+ existsSync: fsMocks.existsSyncMock,
36
+ writeFileSync: fsMocks.writeFileSyncMock,
37
+ mkdirSync: fsMocks.mkdirSyncMock,
38
+ }));
39
+ vitest_1.vi.mock('@clack/prompts', () => ({
40
+ log: {
41
+ info: vitest_1.vi.fn(),
42
+ success: vitest_1.vi.fn(),
43
+ warn: vitest_1.vi.fn(),
44
+ error: vitest_1.vi.fn(),
45
+ step: vitest_1.vi.fn(),
46
+ },
47
+ outro: vitest_1.vi.fn(),
48
+ text: vitest_1.vi.fn(),
49
+ confirm: vitest_1.vi.fn(),
50
+ cancel: vitest_1.vi.fn(),
51
+ // passthrough for abortIfCancelled
52
+ isCancel: vitest_1.vi.fn().mockReturnValue(false),
53
+ spinner: vitest_1.vi
54
+ .fn()
55
+ .mockImplementation(() => ({ start: vitest_1.vi.fn(), stop: vitest_1.vi.fn() })),
56
+ select: vitest_1.vi.fn(),
57
+ }));
58
+ (0, vitest_1.describe)('createExampleComponent', () => {
59
+ const showCopyPasteSnippetSpy = vitest_1.vi.spyOn(clackUtils, 'showCopyPasteInstructions');
60
+ (0, vitest_1.beforeEach)(() => {
61
+ vitest_1.vi.clearAllMocks();
62
+ });
63
+ (0, vitest_1.it)('creates an example component file', async () => {
64
+ const options = {
65
+ url: 'https://sentry.io',
66
+ orgSlug: 'myOrg',
67
+ projectId: '123456789',
68
+ };
69
+ // Mock the abortIfCancelled function to return the appRootPath
70
+ vitest_1.vi.spyOn(clackUtils, 'abortIfCancelled').mockResolvedValue('src/app');
71
+ // Mock the getSentryExampleComponentCode function
72
+ const exampleComponentCode = (0, example_component_1.getSentryExampleComponentCode)(options);
73
+ // Call the function to create the example component
74
+ await (0, example_component_1.createExampleComponent)(options);
75
+ (0, vitest_1.expect)(fsMocks.writeFileSyncMock).toHaveBeenCalledWith('./src/app/sentry-example.component.ts', exampleComponentCode);
76
+ (0, vitest_1.expect)(showCopyPasteSnippetSpy).toHaveBeenCalledWith({
77
+ codeSnippet: `import { SentryExample } from './sentry-example.component'
78
+
79
+ @Component({
80
+ selector: 'app-root',
81
+ standalone: true,
82
+ imports: [RouterOutlet, SentryExample],
83
+ template: \`
84
+ <div class="app">
85
+ <h1>Your Application</h1>
86
+ <app-sentry-example></app-sentry-example>
87
+ </div>
88
+ \`,
89
+ })
90
+ `,
91
+ instructions: 'Add the example component one of your pages or components (for example, in app.component.ts).',
92
+ });
93
+ });
94
+ });
95
+ (0, vitest_1.describe)('getSentryExampleComponentCode', () => {
96
+ (0, vitest_1.it)('includes the correct issue stream URL', () => {
97
+ const exampleComponentCode = (0, example_component_1.getSentryExampleComponentCode)({
98
+ orgSlug: 'myOrg',
99
+ projectId: '123456789',
100
+ url: 'https://sentry.io',
101
+ });
102
+ (0, vitest_1.expect)(exampleComponentCode).toContain('https://myorg.sentry.io/issues/?project=123456789');
103
+ });
104
+ });
105
+ //# sourceMappingURL=example-component.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-component.test.js","sourceRoot":"","sources":["../../../test/angular/example-component.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8D;AAC9D,2EAG6C;AAE7C,kEAAoD;AAEpD,MAAM,OAAO,GAAG,WAAE,CAAC,OAAO,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CACpC,mDAAmD,CACpD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { beforeEach, describe, expect, it, vi } from 'vitest';\nimport {\n createExampleComponent,\n getSentryExampleComponentCode,\n} from '../../src/angular/example-component';\n\nimport * as clackUtils from '../../src/utils/clack';\n\nconst fsMocks = vi.hoisted(() => ({\n existsSyncMock: vi.fn(() => true),\n writeFileSyncMock: vi.fn(),\n mkdirSyncMock: vi.fn(),\n}));\n\nvi.mock('fs', () => ({\n existsSync: fsMocks.existsSyncMock,\n writeFileSync: fsMocks.writeFileSyncMock,\n mkdirSync: fsMocks.mkdirSyncMock,\n}));\n\nvi.mock('@clack/prompts', () => ({\n log: {\n info: vi.fn(),\n success: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n step: vi.fn(),\n },\n outro: vi.fn(),\n text: vi.fn(),\n confirm: vi.fn(),\n cancel: vi.fn(),\n // passthrough for abortIfCancelled\n isCancel: vi.fn().mockReturnValue(false),\n spinner: vi\n .fn()\n .mockImplementation(() => ({ start: vi.fn(), stop: vi.fn() })),\n select: vi.fn(),\n}));\n\ndescribe('createExampleComponent', () => {\n const showCopyPasteSnippetSpy = vi.spyOn(\n clackUtils,\n 'showCopyPasteInstructions',\n );\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it('creates an example component file', async () => {\n const options = {\n url: 'https://sentry.io',\n orgSlug: 'myOrg',\n projectId: '123456789',\n };\n\n // Mock the abortIfCancelled function to return the appRootPath\n vi.spyOn(clackUtils, 'abortIfCancelled').mockResolvedValue('src/app');\n\n // Mock the getSentryExampleComponentCode function\n const exampleComponentCode = getSentryExampleComponentCode(options);\n\n // Call the function to create the example component\n await createExampleComponent(options);\n\n expect(fsMocks.writeFileSyncMock).toHaveBeenCalledWith(\n './src/app/sentry-example.component.ts',\n exampleComponentCode,\n );\n expect(showCopyPasteSnippetSpy).toHaveBeenCalledWith({\n codeSnippet: `import { SentryExample } from './sentry-example.component'\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [RouterOutlet, SentryExample],\n template: \\`\n <div class=\"app\">\n <h1>Your Application</h1>\n <app-sentry-example></app-sentry-example>\n </div>\n \\`,\n})\n`,\n instructions:\n 'Add the example component one of your pages or components (for example, in app.component.ts).',\n });\n });\n});\n\ndescribe('getSentryExampleComponentCode', () => {\n it('includes the correct issue stream URL', () => {\n const exampleComponentCode = getSentryExampleComponentCode({\n orgSlug: 'myOrg',\n projectId: '123456789',\n url: 'https://sentry.io',\n });\n expect(exampleComponentCode).toContain(\n 'https://myorg.sentry.io/issues/?project=123456789',\n );\n });\n});\n"]}