@sentry/wizard 4.5.0 → 4.7.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 (293) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/README.md +23 -19
  3. package/dist/bin.js +22 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/e2e-tests/tests/flutter.test.js +16 -16
  6. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  7. package/dist/e2e-tests/tests/help-message.test.js +56 -0
  8. package/dist/e2e-tests/tests/help-message.test.js.map +1 -0
  9. package/dist/e2e-tests/tests/nextjs-14.test.js +17 -16
  10. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  11. package/dist/e2e-tests/tests/nextjs-15.test.js +16 -16
  12. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  13. package/dist/e2e-tests/tests/nuxt-3.test.js +13 -12
  14. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  15. package/dist/e2e-tests/tests/nuxt-4.test.js +13 -12
  16. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  17. package/dist/e2e-tests/tests/remix.test.js +20 -20
  18. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  19. package/dist/e2e-tests/tests/sveltekit.test.js +20 -20
  20. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  21. package/dist/e2e-tests/utils/index.d.ts +1 -1
  22. package/dist/e2e-tests/utils/index.js +35 -13
  23. package/dist/e2e-tests/utils/index.js.map +1 -1
  24. package/dist/lib/Constants.d.ts +7 -1
  25. package/dist/lib/Constants.js.map +1 -1
  26. package/dist/lib/Helper/File.d.ts +1 -1
  27. package/dist/lib/Helper/File.js +1 -3
  28. package/dist/lib/Helper/File.js.map +1 -1
  29. package/dist/lib/Helper/Logging.d.ts +4 -1
  30. package/dist/lib/Helper/Logging.js +3 -0
  31. package/dist/lib/Helper/Logging.js.map +1 -1
  32. package/dist/lib/Helper/Package.d.ts +5 -3
  33. package/dist/lib/Helper/Package.js +2 -2
  34. package/dist/lib/Helper/Package.js.map +1 -1
  35. package/dist/lib/Helper/SentryCli.d.ts +20 -7
  36. package/dist/lib/Helper/SentryCli.js +21 -13
  37. package/dist/lib/Helper/SentryCli.js.map +1 -1
  38. package/dist/lib/Helper/Wizard.js +9 -5
  39. package/dist/lib/Helper/Wizard.js.map +1 -1
  40. package/dist/lib/Helper/__tests__/File.js +9 -9
  41. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  42. package/dist/lib/Helper/__tests__/MergeConfig.js +17 -17
  43. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  44. package/dist/lib/Helper/__tests__/SentryCli.js +39 -21
  45. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  46. package/dist/lib/Setup.d.ts +4 -1
  47. package/dist/lib/Setup.js +12 -2
  48. package/dist/lib/Setup.js.map +1 -1
  49. package/dist/lib/Steps/BaseStep.d.ts +1 -1
  50. package/dist/lib/Steps/BaseStep.js.map +1 -1
  51. package/dist/lib/Steps/Integrations/BaseIntegration.js +1 -2
  52. package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
  53. package/dist/lib/Steps/Integrations/Cordova.js +14 -10
  54. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  55. package/dist/lib/Steps/Integrations/Electron.d.ts +4 -1
  56. package/dist/lib/Steps/Integrations/Electron.js +1 -1
  57. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  58. package/dist/lib/Steps/Integrations/MobileProject.d.ts +3 -1
  59. package/dist/lib/Steps/Integrations/MobileProject.js +1 -1
  60. package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
  61. package/dist/lib/Steps/PromptForParameters.d.ts +4 -1
  62. package/dist/lib/Steps/PromptForParameters.js.map +1 -1
  63. package/dist/lib/Steps/SentryProjectSelector.d.ts +42 -1
  64. package/dist/lib/Steps/SentryProjectSelector.js +1 -1
  65. package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
  66. package/dist/lib/Steps/WaitForSentry.d.ts +3 -1
  67. package/dist/lib/Steps/WaitForSentry.js +4 -4
  68. package/dist/lib/Steps/WaitForSentry.js.map +1 -1
  69. package/dist/lib/Steps/Welcome.js +5 -0
  70. package/dist/lib/Steps/Welcome.js.map +1 -1
  71. package/dist/lib/Types.d.ts +14 -0
  72. package/dist/lib/Types.js +3 -0
  73. package/dist/lib/Types.js.map +1 -0
  74. package/dist/lib/__tests__/Env.js +10 -16
  75. package/dist/lib/__tests__/Env.js.map +1 -1
  76. package/dist/src/android/android-wizard.js +15 -12
  77. package/dist/src/android/android-wizard.js.map +1 -1
  78. package/dist/src/android/code-tools.js +1 -1
  79. package/dist/src/android/code-tools.js.map +1 -1
  80. package/dist/src/android/gradle.js +4 -4
  81. package/dist/src/android/gradle.js.map +1 -1
  82. package/dist/src/android/manifest.js +1 -1
  83. package/dist/src/android/manifest.js.map +1 -1
  84. package/dist/src/apple/apple-wizard.d.ts +2 -2
  85. package/dist/src/apple/apple-wizard.js +54 -175
  86. package/dist/src/apple/apple-wizard.js.map +1 -1
  87. package/dist/src/apple/check-installed-cli.d.ts +1 -0
  88. package/dist/src/apple/check-installed-cli.js +60 -0
  89. package/dist/src/apple/check-installed-cli.js.map +1 -0
  90. package/dist/src/apple/cocoapod.js +1 -1
  91. package/dist/src/apple/cocoapod.js.map +1 -1
  92. package/dist/src/apple/code-tools.js +1 -1
  93. package/dist/src/apple/code-tools.js.map +1 -1
  94. package/dist/src/apple/configure-fastlane.d.ts +5 -0
  95. package/dist/src/apple/configure-fastlane.js +66 -0
  96. package/dist/src/apple/configure-fastlane.js.map +1 -0
  97. package/dist/src/apple/configure-package-manager.d.ts +5 -0
  98. package/dist/src/apple/configure-package-manager.js +68 -0
  99. package/dist/src/apple/configure-package-manager.js.map +1 -0
  100. package/dist/src/apple/configure-sentry-cli.d.ts +4 -0
  101. package/dist/src/apple/configure-sentry-cli.js +47 -0
  102. package/dist/src/apple/configure-sentry-cli.js.map +1 -0
  103. package/dist/src/apple/configure-xcode-project.d.ts +8 -0
  104. package/dist/src/apple/configure-xcode-project.js +11 -0
  105. package/dist/src/apple/configure-xcode-project.js.map +1 -0
  106. package/dist/src/apple/fastlane.d.ts +1 -1
  107. package/dist/src/apple/fastlane.js +5 -5
  108. package/dist/src/apple/fastlane.js.map +1 -1
  109. package/dist/src/apple/inject-code-snippet.d.ts +6 -0
  110. package/dist/src/apple/inject-code-snippet.js +54 -0
  111. package/dist/src/apple/inject-code-snippet.js.map +1 -0
  112. package/dist/src/apple/lookup-xcode-project.d.ts +7 -0
  113. package/dist/src/apple/lookup-xcode-project.js +98 -0
  114. package/dist/src/apple/lookup-xcode-project.js.map +1 -0
  115. package/dist/src/apple/options.d.ts +4 -0
  116. package/dist/src/apple/options.js +3 -0
  117. package/dist/src/apple/options.js.map +1 -0
  118. package/dist/src/apple/search-xcode-project-at-path.d.ts +1 -0
  119. package/dist/src/apple/search-xcode-project-at-path.js +70 -0
  120. package/dist/src/apple/search-xcode-project-at-path.js.map +1 -0
  121. package/dist/src/apple/templates.js +11 -7
  122. package/dist/src/apple/templates.js.map +1 -1
  123. package/dist/src/apple/xcode-manager.js +4 -7
  124. package/dist/src/apple/xcode-manager.js.map +1 -1
  125. package/dist/src/flutter/code-tools.js +3 -3
  126. package/dist/src/flutter/code-tools.js.map +1 -1
  127. package/dist/src/flutter/flutter-wizard.js +21 -15
  128. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  129. package/dist/src/flutter/templates.js +4 -4
  130. package/dist/src/flutter/templates.js.map +1 -1
  131. package/dist/src/nextjs/nextjs-wizard.js +118 -43
  132. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  133. package/dist/src/nextjs/templates.d.ts +10 -1
  134. package/dist/src/nextjs/templates.js +192 -62
  135. package/dist/src/nextjs/templates.js.map +1 -1
  136. package/dist/src/nuxt/nuxt-wizard.js +21 -16
  137. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  138. package/dist/src/nuxt/sdk-example.js +3 -3
  139. package/dist/src/nuxt/sdk-example.js.map +1 -1
  140. package/dist/src/nuxt/sdk-setup.js +9 -9
  141. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  142. package/dist/src/nuxt/templates.js +173 -58
  143. package/dist/src/nuxt/templates.js.map +1 -1
  144. package/dist/src/nuxt/utils.js +6 -3
  145. package/dist/src/nuxt/utils.js.map +1 -1
  146. package/dist/src/react-native/expo-env-file.js +1 -1
  147. package/dist/src/react-native/expo-env-file.js.map +1 -1
  148. package/dist/src/react-native/expo-metro.js +4 -4
  149. package/dist/src/react-native/expo-metro.js.map +1 -1
  150. package/dist/src/react-native/expo.js +4 -4
  151. package/dist/src/react-native/expo.js.map +1 -1
  152. package/dist/src/react-native/javascript.d.ts +6 -4
  153. package/dist/src/react-native/javascript.js +31 -15
  154. package/dist/src/react-native/javascript.js.map +1 -1
  155. package/dist/src/react-native/metro.js +8 -8
  156. package/dist/src/react-native/metro.js.map +1 -1
  157. package/dist/src/react-native/react-native-wizard.d.ts +5 -1
  158. package/dist/src/react-native/react-native-wizard.js +66 -36
  159. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  160. package/dist/src/react-native/uninstall.js +8 -5
  161. package/dist/src/react-native/uninstall.js.map +1 -1
  162. package/dist/src/react-native/xcode.d.ts +9 -4
  163. package/dist/src/react-native/xcode.js +65 -22
  164. package/dist/src/react-native/xcode.js.map +1 -1
  165. package/dist/src/remix/codemods/handle-error.js +4 -1
  166. package/dist/src/remix/codemods/handle-error.js.map +1 -1
  167. package/dist/src/remix/remix-wizard.js +23 -18
  168. package/dist/src/remix/remix-wizard.js.map +1 -1
  169. package/dist/src/remix/sdk-example.js +163 -64
  170. package/dist/src/remix/sdk-example.js.map +1 -1
  171. package/dist/src/remix/sdk-setup.js +11 -7
  172. package/dist/src/remix/sdk-setup.js.map +1 -1
  173. package/dist/src/run.d.ts +3 -1
  174. package/dist/src/run.js +29 -9
  175. package/dist/src/run.js.map +1 -1
  176. package/dist/src/sourcemaps/sourcemaps-wizard.js +30 -28
  177. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  178. package/dist/src/sourcemaps/tools/angular.js +3 -3
  179. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  180. package/dist/src/sourcemaps/tools/create-react-app.js +3 -3
  181. package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
  182. package/dist/src/sourcemaps/tools/esbuild.js +6 -6
  183. package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
  184. package/dist/src/sourcemaps/tools/nextjs.js +5 -5
  185. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
  186. package/dist/src/sourcemaps/tools/remix.js +4 -4
  187. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  188. package/dist/src/sourcemaps/tools/rollup.js +6 -6
  189. package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
  190. package/dist/src/sourcemaps/tools/sentry-cli.js +15 -15
  191. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  192. package/dist/src/sourcemaps/tools/tsc.js +6 -6
  193. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  194. package/dist/src/sourcemaps/tools/vite.js +12 -12
  195. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  196. package/dist/src/sourcemaps/tools/webpack.js +10 -10
  197. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  198. package/dist/src/sourcemaps/utils/detect-tool.js +2 -2
  199. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  200. package/dist/src/sourcemaps/utils/other-wizards.js +5 -5
  201. package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
  202. package/dist/src/sourcemaps/utils/sdk-version.js +7 -7
  203. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  204. package/dist/src/sveltekit/sdk-example.js +1 -1
  205. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  206. package/dist/src/sveltekit/sdk-setup.js +15 -14
  207. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  208. package/dist/src/sveltekit/sveltekit-wizard.js +25 -20
  209. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  210. package/dist/src/sveltekit/templates.js +126 -37
  211. package/dist/src/sveltekit/templates.js.map +1 -1
  212. package/dist/src/telemetry.js +11 -0
  213. package/dist/src/telemetry.js.map +1 -1
  214. package/dist/src/utils/{clack-utils.d.ts → clack/index.d.ts} +45 -7
  215. package/dist/src/utils/{clack-utils.js → clack/index.js} +75 -20
  216. package/dist/src/utils/clack/index.js.map +1 -0
  217. package/dist/src/utils/debug.js +1 -1
  218. package/dist/src/utils/debug.js.map +1 -1
  219. package/dist/src/utils/find-files-with-extension.d.ts +1 -0
  220. package/dist/src/utils/find-files-with-extension.js +39 -0
  221. package/dist/src/utils/find-files-with-extension.js.map +1 -0
  222. package/dist/src/utils/package-manager.d.ts +8 -1
  223. package/dist/src/utils/package-manager.js +79 -23
  224. package/dist/src/utils/package-manager.js.map +1 -1
  225. package/dist/src/utils/sentrycli-utils.js +0 -1
  226. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  227. package/dist/src/utils/types.d.ts +4 -0
  228. package/dist/src/utils/types.js.map +1 -1
  229. package/dist/src/version.d.ts +1 -1
  230. package/dist/src/version.js +1 -1
  231. package/dist/src/version.js.map +1 -1
  232. package/dist/test/android/code-tools.test.js +13 -13
  233. package/dist/test/android/code-tools.test.js.map +1 -1
  234. package/dist/test/apple/cocoapod.test.js +78 -73
  235. package/dist/test/apple/cocoapod.test.js.map +1 -1
  236. package/dist/test/apple/code-tools.test.js +174 -167
  237. package/dist/test/apple/code-tools.test.js.map +1 -1
  238. package/dist/test/apple/fastfile.test.js +87 -84
  239. package/dist/test/apple/fastfile.test.js.map +1 -1
  240. package/dist/test/apple/templates.test.js +32 -27
  241. package/dist/test/apple/templates.test.js.map +1 -1
  242. package/dist/test/apple/xcode-manager.test.js +208 -185
  243. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  244. package/dist/test/flutter/code-tools.test.js +29 -30
  245. package/dist/test/flutter/code-tools.test.js.map +1 -1
  246. package/dist/test/flutter/templates.test.js +38 -37
  247. package/dist/test/flutter/templates.test.js.map +1 -1
  248. package/dist/test/nextjs/templates.test.js +155 -103
  249. package/dist/test/nextjs/templates.test.js.map +1 -1
  250. package/dist/test/nuxt/templates.test.js +25 -24
  251. package/dist/test/nuxt/templates.test.js.map +1 -1
  252. package/dist/test/react-native/expo-metro.test.js +12 -11
  253. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  254. package/dist/test/react-native/expo.test.js +11 -10
  255. package/dist/test/react-native/expo.test.js.map +1 -1
  256. package/dist/test/react-native/gradle.test.js +27 -26
  257. package/dist/test/react-native/gradle.test.js.map +1 -1
  258. package/dist/test/react-native/javascript.test.js +109 -59
  259. package/dist/test/react-native/javascript.test.js.map +1 -1
  260. package/dist/test/react-native/metro.test.js +66 -65
  261. package/dist/test/react-native/metro.test.js.map +1 -1
  262. package/dist/test/react-native/xcode.test.js +138 -37
  263. package/dist/test/react-native/xcode.test.js.map +1 -1
  264. package/dist/test/remix/client-entry.test.js +8 -7
  265. package/dist/test/remix/client-entry.test.js.map +1 -1
  266. package/dist/test/remix/server-instrumentation.test.js +6 -5
  267. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  268. package/dist/test/sourcemaps/tools/sentry-cli.test.js +21 -21
  269. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  270. package/dist/test/sourcemaps/tools/tsc.test.js +13 -14
  271. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  272. package/dist/test/sourcemaps/tools/vite.test.js +13 -14
  273. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  274. package/dist/test/sourcemaps/tools/webpack.test.js +19 -20
  275. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  276. package/dist/test/sveltekit/templates.test.js +13 -12
  277. package/dist/test/sveltekit/templates.test.js.map +1 -1
  278. package/dist/test/utils/ast-utils.test.js +45 -44
  279. package/dist/test/utils/ast-utils.test.js.map +1 -1
  280. package/dist/test/utils/clack/index.test.d.ts +1 -0
  281. package/dist/test/utils/clack/index.test.js +375 -0
  282. package/dist/test/utils/clack/index.test.js.map +1 -0
  283. package/dist/test/utils/package-manager.test.d.ts +1 -0
  284. package/dist/test/utils/package-manager.test.js +30 -0
  285. package/dist/test/utils/package-manager.test.js.map +1 -0
  286. package/package.json +10 -38
  287. package/dist/e2e-tests/jest.config.d.ts +0 -17
  288. package/dist/e2e-tests/jest.config.js +0 -23
  289. package/dist/e2e-tests/jest.config.js.map +0 -1
  290. package/dist/src/utils/clack-utils.js.map +0 -1
  291. package/dist/test/utils/clack-utils.test.js +0 -306
  292. package/dist/test/utils/clack-utils.test.js.map +0 -1
  293. /package/dist/{test/utils/clack-utils.test.d.ts → e2e-tests/tests/help-message.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/flutter/templates.test.ts"],"names":[],"mappings":";;AAAA,2DAIqC;AAErC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAA,0BAAc,EAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;YAClE,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;OAOtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAA,4BAAgB,EAAC,eAAe,CAAC,CAAC;YACnD,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,4BAA4B,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI;aAChB,EACD,eAAe,CAChB,CAAC;YACF,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;OAetC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,KAAK;aACjB,EACD,eAAe,CAChB,CAAC;YACF,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;OAYtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,KAAK;gBACd,SAAS,EAAE,KAAK;aACjB,EACD,eAAe,CAChB,CAAC;YACF,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;OAStC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n pubspecOptions,\n sentryProperties,\n initSnippet,\n} from '../../src/flutter/templates';\n\ndescribe('Flutter code templates', () => {\n describe('pubspec', () => {\n it('generates pubspec with project and org', () => {\n const template = pubspecOptions('fixture-project', 'fixture-org');\n expect(template).toMatchInlineSnapshot(`\n \"sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: fixture-project\n org: fixture-org\n \"\n `);\n });\n });\n describe('sentry.properties', () => {\n it('generates sentry.properties with token', () => {\n const template = sentryProperties('fixture-token');\n expect(template).toMatchInlineSnapshot(`\"auth_token=fixture-token\"`);\n });\n });\n describe('init', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: true,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(Exception('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with profiling disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(Exception('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with tracing disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: false,\n profiling: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(Exception('This is a sample exception.'));\"\n `);\n });\n });\n});\n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O,EAAE,IAAI;gBACb,SAAS,EAAE,KAAK;aACjB,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;OAYtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,KAAK;gBACd,SAAS,EAAE,KAAK;aACjB,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;OAStC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n pubspecOptions,\n sentryProperties,\n initSnippet,\n} from '../../src/flutter/templates';\n\ndescribe('Flutter code templates', () => {\n describe('pubspec', () => {\n it('generates pubspec with project and org', () => {\n const template = pubspecOptions('fixture-project', 'fixture-org');\n expect(template).toMatchInlineSnapshot(`\n \"sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: fixture-project\n org: fixture-org\n \"\n `);\n });\n });\n describe('sentry.properties', () => {\n it('generates sentry.properties with token', () => {\n const template = sentryProperties('fixture-token');\n expect(template).toMatchInlineSnapshot(`\"auth_token=fixture-token\"`);\n });\n });\n describe('init', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: true,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with profiling disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with tracing disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: false,\n profiling: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n });\n});\n"]}
@@ -1,112 +1,116 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
3
4
  const templates_1 = require("../../src/nextjs/templates");
4
- describe('Next.js code templates', () => {
5
- describe('getSentryConfigContents', () => {
6
- describe('client-side', () => {
7
- it('generates client-side Sentry config with all features enabled', () => {
8
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'client', {
9
- performance: true,
10
- replay: true,
11
- });
12
- expect(template).toMatchInlineSnapshot(`
13
- "// This file configures the initialization of Sentry on the client.
14
- // The config you add here will be used whenever a users loads a page in their browser.
15
- // https://docs.sentry.io/platforms/javascript/guides/nextjs/
5
+ (0, vitest_1.describe)('Next.js code templates', () => {
6
+ (0, vitest_1.describe)('getInstrumentationClientFileContents', () => {
7
+ (0, vitest_1.it)('generates client-side Sentry config with all features enabled', () => {
8
+ const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
9
+ performance: true,
10
+ replay: true,
11
+ });
12
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
13
+ "// This file configures the initialization of Sentry on the client.
14
+ // The added config here will be used whenever a users loads a page in their browser.
15
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/
16
16
 
17
- import * as Sentry from "@sentry/nextjs";
17
+ import * as Sentry from "@sentry/nextjs";
18
18
 
19
- Sentry.init({
20
- dsn: "my-dsn",
19
+ Sentry.init({
20
+ dsn: "my-dsn",
21
21
 
22
- // Add optional integrations for additional features
23
- integrations: [
24
- Sentry.replayIntegration(),
25
- ],
22
+ // Add optional integrations for additional features
23
+ integrations: [
24
+ Sentry.replayIntegration(),
25
+ ],
26
26
 
27
- // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
28
- tracesSampleRate: 1,
27
+ // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
28
+ tracesSampleRate: 1,
29
29
 
30
- // Define how likely Replay events are sampled.
31
- // This sets the sample rate to be 10%. You may want this to be 100% while
32
- // in development and sample at a lower rate in production
33
- replaysSessionSampleRate: 0.1,
30
+ // Define how likely Replay events are sampled.
31
+ // This sets the sample rate to be 10%. You may want this to be 100% while
32
+ // in development and sample at a lower rate in production
33
+ replaysSessionSampleRate: 0.1,
34
34
 
35
- // Define how likely Replay events are sampled when an error occurs.
36
- replaysOnErrorSampleRate: 1.0,
35
+ // Define how likely Replay events are sampled when an error occurs.
36
+ replaysOnErrorSampleRate: 1.0,
37
37
 
38
- // Setting this option to true will print useful information to the console while you're setting up Sentry.
39
- debug: false,
40
- });
41
- "
42
- `);
38
+ // Setting this option to true will print useful information to the console while you're setting up Sentry.
39
+ debug: false,
40
+ });
41
+
42
+ export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;"
43
+ `);
44
+ });
45
+ (0, vitest_1.it)('generates client-side Sentry config with performance monitoring disabled', () => {
46
+ const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
47
+ performance: false,
48
+ replay: true,
43
49
  });
44
- it('generates client-side Sentry config with performance monitoring disabled', () => {
45
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'client', {
46
- performance: false,
47
- replay: true,
48
- });
49
- expect(template).toMatchInlineSnapshot(`
50
- "// This file configures the initialization of Sentry on the client.
51
- // The config you add here will be used whenever a users loads a page in their browser.
52
- // https://docs.sentry.io/platforms/javascript/guides/nextjs/
50
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
51
+ "// This file configures the initialization of Sentry on the client.
52
+ // The added config here will be used whenever a users loads a page in their browser.
53
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/
53
54
 
54
- import * as Sentry from "@sentry/nextjs";
55
+ import * as Sentry from "@sentry/nextjs";
55
56
 
56
- Sentry.init({
57
- dsn: "my-dsn",
57
+ Sentry.init({
58
+ dsn: "my-dsn",
58
59
 
59
- // Add optional integrations for additional features
60
- integrations: [
61
- Sentry.replayIntegration(),
62
- ],
60
+ // Add optional integrations for additional features
61
+ integrations: [
62
+ Sentry.replayIntegration(),
63
+ ],
63
64
 
64
- // Define how likely Replay events are sampled.
65
- // This sets the sample rate to be 10%. You may want this to be 100% while
66
- // in development and sample at a lower rate in production
67
- replaysSessionSampleRate: 0.1,
65
+ // Define how likely Replay events are sampled.
66
+ // This sets the sample rate to be 10%. You may want this to be 100% while
67
+ // in development and sample at a lower rate in production
68
+ replaysSessionSampleRate: 0.1,
68
69
 
69
- // Define how likely Replay events are sampled when an error occurs.
70
- replaysOnErrorSampleRate: 1.0,
70
+ // Define how likely Replay events are sampled when an error occurs.
71
+ replaysOnErrorSampleRate: 1.0,
71
72
 
72
- // Setting this option to true will print useful information to the console while you're setting up Sentry.
73
- debug: false,
74
- });
75
- "
76
- `);
73
+ // Setting this option to true will print useful information to the console while you're setting up Sentry.
74
+ debug: false,
75
+ });
76
+
77
+ export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;"
78
+ `);
79
+ });
80
+ (0, vitest_1.it)('generates client-side Sentry config with session replay disabled', () => {
81
+ const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
82
+ performance: true,
83
+ replay: false,
77
84
  });
78
- it('generates client-side Sentry config with session replay disabled', () => {
79
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'client', {
80
- performance: true,
81
- replay: false,
82
- });
83
- expect(template).toMatchInlineSnapshot(`
84
- "// This file configures the initialization of Sentry on the client.
85
- // The config you add here will be used whenever a users loads a page in their browser.
86
- // https://docs.sentry.io/platforms/javascript/guides/nextjs/
85
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
86
+ "// This file configures the initialization of Sentry on the client.
87
+ // The added config here will be used whenever a users loads a page in their browser.
88
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/
87
89
 
88
- import * as Sentry from "@sentry/nextjs";
90
+ import * as Sentry from "@sentry/nextjs";
89
91
 
90
- Sentry.init({
91
- dsn: "my-dsn",
92
+ Sentry.init({
93
+ dsn: "my-dsn",
92
94
 
93
- // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
94
- tracesSampleRate: 1,
95
+ // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
96
+ tracesSampleRate: 1,
95
97
 
96
- // Setting this option to true will print useful information to the console while you're setting up Sentry.
97
- debug: false,
98
- });
99
- "
100
- `);
101
- });
98
+ // Setting this option to true will print useful information to the console while you're setting up Sentry.
99
+ debug: false,
100
+ });
101
+
102
+ export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;"
103
+ `);
102
104
  });
103
- describe('server-side', () => {
104
- it('generates server-side Sentry config with all features enabled', () => {
105
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'server', {
105
+ });
106
+ (0, vitest_1.describe)('getSentryServersideConfigContents', () => {
107
+ (0, vitest_1.describe)('server-side', () => {
108
+ (0, vitest_1.it)('generates server-side Sentry config with all features enabled', () => {
109
+ const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
106
110
  performance: true,
107
111
  replay: true,
108
112
  });
109
- expect(template).toMatchInlineSnapshot(`
113
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
110
114
  "// This file configures the initialization of Sentry on the server.
111
115
  // The config you add here will be used whenever the server handles a request.
112
116
  // https://docs.sentry.io/platforms/javascript/guides/nextjs/
@@ -125,12 +129,12 @@ describe('Next.js code templates', () => {
125
129
  "
126
130
  `);
127
131
  });
128
- it('generates server-side Sentry config with performance monitoring disabled', () => {
129
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'server', {
132
+ (0, vitest_1.it)('generates server-side Sentry config with performance monitoring disabled', () => {
133
+ const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
130
134
  performance: false,
131
135
  replay: true,
132
136
  });
133
- expect(template).toMatchInlineSnapshot(`
137
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
134
138
  "// This file configures the initialization of Sentry on the server.
135
139
  // The config you add here will be used whenever the server handles a request.
136
140
  // https://docs.sentry.io/platforms/javascript/guides/nextjs/
@@ -146,12 +150,12 @@ describe('Next.js code templates', () => {
146
150
  "
147
151
  `);
148
152
  });
149
- it('generates server-side Sentry config with spotlight disabled', () => {
150
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'server', {
153
+ (0, vitest_1.it)('generates server-side Sentry config with spotlight disabled', () => {
154
+ const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
151
155
  performance: true,
152
156
  replay: true,
153
157
  });
154
- expect(template).toMatchInlineSnapshot(`
158
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
155
159
  "// This file configures the initialization of Sentry on the server.
156
160
  // The config you add here will be used whenever the server handles a request.
157
161
  // https://docs.sentry.io/platforms/javascript/guides/nextjs/
@@ -171,13 +175,13 @@ describe('Next.js code templates', () => {
171
175
  `);
172
176
  });
173
177
  });
174
- describe('edge', () => {
175
- it('generates edge Sentry config with all features enabled', () => {
176
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'edge', {
178
+ (0, vitest_1.describe)('edge', () => {
179
+ (0, vitest_1.it)('generates edge Sentry config with all features enabled', () => {
180
+ const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'edge', {
177
181
  performance: true,
178
182
  replay: true,
179
183
  });
180
- expect(template).toMatchInlineSnapshot(`
184
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
181
185
  "// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
182
186
  // The config you add here will be used whenever one of the edge features is loaded.
183
187
  // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
@@ -197,12 +201,12 @@ describe('Next.js code templates', () => {
197
201
  "
198
202
  `);
199
203
  });
200
- it('generates edge Sentry config with performance monitoring disabled', () => {
201
- const template = (0, templates_1.getSentryConfigContents)('my-dsn', 'edge', {
204
+ (0, vitest_1.it)('generates edge Sentry config with performance monitoring disabled', () => {
205
+ const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'edge', {
202
206
  performance: false,
203
207
  replay: true,
204
208
  });
205
- expect(template).toMatchInlineSnapshot(`
209
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
206
210
  "// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
207
211
  // The config you add here will be used whenever one of the edge features is loaded.
208
212
  // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
@@ -221,8 +225,8 @@ describe('Next.js code templates', () => {
221
225
  });
222
226
  });
223
227
  });
224
- describe('getWithSentryConfigOptionsTemplate', () => {
225
- it('generates options for SaaS', () => {
228
+ (0, vitest_1.describe)('getWithSentryConfigOptionsTemplate', () => {
229
+ (0, vitest_1.it)('generates options for SaaS', () => {
226
230
  const template = (0, templates_1.getWithSentryConfigOptionsTemplate)({
227
231
  orgSlug: 'my-org',
228
232
  projectSlug: 'my-project',
@@ -230,7 +234,7 @@ describe('Next.js code templates', () => {
230
234
  sentryUrl: 'https://dont-use-this-url.com',
231
235
  tunnelRoute: true,
232
236
  });
233
- expect(template).toMatchInlineSnapshot(`
237
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
234
238
  "{
235
239
  // For all available options, see:
236
240
  // https://www.npmjs.com/package/@sentry/webpack-plugin#options
@@ -264,7 +268,7 @@ describe('Next.js code templates', () => {
264
268
  }"
265
269
  `);
266
270
  });
267
- it('generates options for self-hosted', () => {
271
+ (0, vitest_1.it)('generates options for self-hosted', () => {
268
272
  const template = (0, templates_1.getWithSentryConfigOptionsTemplate)({
269
273
  orgSlug: 'my-org',
270
274
  projectSlug: 'my-project',
@@ -272,7 +276,7 @@ describe('Next.js code templates', () => {
272
276
  sentryUrl: 'https://my-sentry.com',
273
277
  tunnelRoute: true,
274
278
  });
275
- expect(template).toMatchInlineSnapshot(`
279
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
276
280
  "{
277
281
  // For all available options, see:
278
282
  // https://www.npmjs.com/package/@sentry/webpack-plugin#options
@@ -307,7 +311,7 @@ describe('Next.js code templates', () => {
307
311
  }"
308
312
  `);
309
313
  });
310
- it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {
314
+ (0, vitest_1.it)('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {
311
315
  const template = (0, templates_1.getWithSentryConfigOptionsTemplate)({
312
316
  orgSlug: 'my-org',
313
317
  projectSlug: 'my-project',
@@ -315,7 +319,7 @@ describe('Next.js code templates', () => {
315
319
  sentryUrl: 'https://dont-use-this-url.com',
316
320
  tunnelRoute: false,
317
321
  });
318
- expect(template).toMatchInlineSnapshot(`
322
+ (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
319
323
  "{
320
324
  // For all available options, see:
321
325
  // https://www.npmjs.com/package/@sentry/webpack-plugin#options
@@ -350,5 +354,53 @@ describe('Next.js code templates', () => {
350
354
  `);
351
355
  });
352
356
  });
357
+ (0, vitest_1.describe)('getRootLayout', () => {
358
+ (0, vitest_1.it)('generates a root layout component with types', () => {
359
+ (0, vitest_1.expect)((0, templates_1.getRootLayout)(true)).toMatchInlineSnapshot(`
360
+ "// This file was generated by the Sentry wizard because we couldn't find a root layout file.
361
+ // You can delete this file at any time.
362
+
363
+ export const metadata = {
364
+ title: 'Sentry NextJS Example',
365
+ description: 'Generated by Sentry',
366
+ }
367
+
368
+ export default function RootLayout({
369
+ children,
370
+ }: {
371
+ children: React.ReactNode
372
+ }) {
373
+ return (
374
+ <html lang="en">
375
+ <body>{children}</body>
376
+ </html>
377
+ )
378
+ }
379
+ "
380
+ `);
381
+ });
382
+ (0, vitest_1.it)('generates a root layout component without types', () => {
383
+ (0, vitest_1.expect)((0, templates_1.getRootLayout)(false)).toMatchInlineSnapshot(`
384
+ "// This file was generated by the Sentry wizard because we couldn't find a root layout file.
385
+ // You can delete this file at any time.
386
+
387
+ export const metadata = {
388
+ title: 'Sentry NextJS Example',
389
+ description: 'Generated by Sentry',
390
+ }
391
+
392
+ export default function RootLayout({
393
+ children,
394
+ }) {
395
+ return (
396
+ <html lang="en">
397
+ <body>{children}</body>
398
+ </html>
399
+ )
400
+ }
401
+ "
402
+ `);
403
+ });
404
+ });
353
405
  });
354
406
  //# sourceMappingURL=templates.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,0DAGoC;AAEpC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;YAC3B,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;gBACvE,MAAM,QAAQ,GAAG,IAAA,mCAAuB,EAAC,QAAQ,EAAE,QAAQ,EAAE;oBAC3D,WAAW,EAAE,IAAI;oBACjB,MA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Contents,\n getWithSentryConfigOptionsTemplate,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getSentryConfigContents', () => {\n describe('client-side', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getSentryConfigContents('my-dsn', 'client', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The config you add here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents('my-dsn', 'client', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The config you add here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getSentryConfigContents('my-dsn', 'client', {\n performance: true,\n replay: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The config you add here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0DAKoC;AAEpC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,sCAAsC,EAAE,GAAG,EA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AE,YAAY;gBACzB,UAAU,EAAE,KAAK;gBACjB,SAAS,EAAE,+BAA+B;gBAC1C,WAAW,EAAE,KAAK;aACnB,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,IAAA,WAAE,EAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,IAAA,eAAM,EAAC,IAAA,yBAAa,EAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;OAqBjD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,IAAA,WAAE,EAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,IAAA,eAAM,EAAC,IAAA,yBAAa,EAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;OAmBlD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n});\n"]}