@sentry/wizard 6.12.0 → 6.13.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 (184) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/bin.js +16 -1
  3. package/dist/bin.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-17.test.js +3 -4
  5. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/angular-19.test.js +3 -4
  7. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/flutter.test.js +60 -0
  9. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/help-message.test.js +8 -3
  11. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
  13. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
  15. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -3
  17. package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +4 -4
  19. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -1
  20. package/dist/e2e-tests/tests/react-router.test.js +3 -6
  21. package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
  22. package/dist/e2e-tests/tests/remix.test.js +2 -4
  23. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  24. package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
  25. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
  26. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +6 -3
  27. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
  28. package/dist/lib/Constants.d.ts +1 -0
  29. package/dist/lib/Constants.js +5 -0
  30. package/dist/lib/Constants.js.map +1 -1
  31. package/dist/lib/Steps/Integrations/Electron.js +2 -2
  32. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  33. package/dist/src/android/android-wizard.js +3 -0
  34. package/dist/src/android/android-wizard.js.map +1 -1
  35. package/dist/src/angular/codemods/main.d.ts +1 -1
  36. package/dist/src/angular/codemods/main.js +0 -1
  37. package/dist/src/angular/codemods/main.js.map +1 -1
  38. package/dist/src/apple/apple-wizard.js +2 -3
  39. package/dist/src/apple/apple-wizard.js.map +1 -1
  40. package/dist/src/apple/check-installed-cli.d.ts +1 -1
  41. package/dist/src/apple/check-installed-cli.js +13 -7
  42. package/dist/src/apple/check-installed-cli.js.map +1 -1
  43. package/dist/src/apple/configure-xcode-project.js +8 -1
  44. package/dist/src/apple/configure-xcode-project.js.map +1 -1
  45. package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
  46. package/dist/src/apple/lookup-xcode-project.js +22 -17
  47. package/dist/src/apple/lookup-xcode-project.js.map +1 -1
  48. package/dist/src/apple/options.d.ts +5 -0
  49. package/dist/src/apple/options.js.map +1 -1
  50. package/dist/src/apple/sentry-swift-package.d.ts +4 -0
  51. package/dist/src/apple/sentry-swift-package.js +17 -0
  52. package/dist/src/apple/sentry-swift-package.js.map +1 -0
  53. package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
  54. package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
  55. package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
  56. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
  57. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
  58. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
  59. package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
  60. package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
  61. package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
  62. package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
  63. package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
  64. package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
  65. package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
  66. package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
  67. package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
  68. package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
  69. package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
  70. package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
  71. package/dist/src/apple/xcode-manager.d.ts +59 -1
  72. package/dist/src/apple/xcode-manager.js +507 -106
  73. package/dist/src/apple/xcode-manager.js.map +1 -1
  74. package/dist/src/flutter/flutter-wizard.js +3 -0
  75. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  76. package/dist/src/nextjs/templates.js +12 -6
  77. package/dist/src/nextjs/templates.js.map +1 -1
  78. package/dist/src/nuxt/templates.js +12 -6
  79. package/dist/src/nuxt/templates.js.map +1 -1
  80. package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
  81. package/dist/src/react-router/codemods/client.entry.js +93 -52
  82. package/dist/src/react-router/codemods/client.entry.js.map +1 -1
  83. package/dist/src/react-router/codemods/server-entry.js +8 -7
  84. package/dist/src/react-router/codemods/server-entry.js.map +1 -1
  85. package/dist/src/react-router/react-router-wizard.js +13 -19
  86. package/dist/src/react-router/react-router-wizard.js.map +1 -1
  87. package/dist/src/react-router/sdk-setup.d.ts +2 -2
  88. package/dist/src/react-router/sdk-setup.js +16 -15
  89. package/dist/src/react-router/sdk-setup.js.map +1 -1
  90. package/dist/src/react-router/templates.d.ts +1 -3
  91. package/dist/src/react-router/templates.js +24 -92
  92. package/dist/src/react-router/templates.js.map +1 -1
  93. package/dist/src/remix/sdk-setup.js +1 -2
  94. package/dist/src/remix/sdk-setup.js.map +1 -1
  95. package/dist/src/run.d.ts +4 -1
  96. package/dist/src/run.js +13 -0
  97. package/dist/src/run.js.map +1 -1
  98. package/dist/src/sourcemaps/tools/remix.js +4 -4
  99. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  100. package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
  101. package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
  102. package/dist/src/sveltekit/templates.js +12 -6
  103. package/dist/src/sveltekit/templates.js.map +1 -1
  104. package/dist/src/utils/clack/index.d.ts +2 -1
  105. package/dist/src/utils/clack/index.js +17 -6
  106. package/dist/src/utils/clack/index.js.map +1 -1
  107. package/dist/src/utils/files.d.ts +2 -0
  108. package/dist/src/utils/files.js +58 -0
  109. package/dist/src/utils/files.js.map +1 -0
  110. package/dist/src/utils/git.d.ts +3 -1
  111. package/dist/src/utils/git.js +2 -1
  112. package/dist/src/utils/git.js.map +1 -1
  113. package/dist/src/utils/line-endings.d.ts +1 -0
  114. package/dist/src/utils/line-endings.js +76 -0
  115. package/dist/src/utils/line-endings.js.map +1 -0
  116. package/dist/src/version.d.ts +1 -1
  117. package/dist/src/version.js +1 -1
  118. package/dist/src/version.js.map +1 -1
  119. package/dist/test/angular/angular-wizard.test.js +0 -5
  120. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  121. package/dist/test/apple/lookup-xcode-project.test.js +167 -0
  122. package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
  123. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
  124. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
  125. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
  126. package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
  127. package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
  128. package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
  129. package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
  130. package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
  131. package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
  132. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
  133. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
  134. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
  135. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
  136. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
  137. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
  138. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
  139. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
  140. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
  141. package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
  142. package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
  143. package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
  144. package/dist/test/apple/xcode-manager.test.js +452 -43
  145. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  146. package/dist/test/constants.test.d.ts +1 -0
  147. package/dist/test/constants.test.js +12 -0
  148. package/dist/test/constants.test.js.map +1 -0
  149. package/dist/test/nextjs/templates.test.js +66 -33
  150. package/dist/test/nextjs/templates.test.js.map +1 -1
  151. package/dist/test/nuxt/templates.test.js +66 -36
  152. package/dist/test/nuxt/templates.test.js.map +1 -1
  153. package/dist/test/react-router/codemods/client-entry.test.js +15 -11
  154. package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
  155. package/dist/test/react-router/codemods/server-entry.test.js +21 -8
  156. package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
  157. package/dist/test/react-router/sdk-setup.test.js +46 -10
  158. package/dist/test/react-router/sdk-setup.test.js.map +1 -1
  159. package/dist/test/react-router/templates.test.js +26 -64
  160. package/dist/test/react-router/templates.test.js.map +1 -1
  161. package/dist/test/remix/build-script.test.d.ts +1 -0
  162. package/dist/test/remix/build-script.test.js +124 -0
  163. package/dist/test/remix/build-script.test.js.map +1 -0
  164. package/dist/test/remix/client-entry.test.js +4 -10
  165. package/dist/test/remix/client-entry.test.js.map +1 -1
  166. package/dist/test/run.test.d.ts +1 -0
  167. package/dist/test/run.test.js +137 -0
  168. package/dist/test/run.test.js.map +1 -0
  169. package/dist/test/sveltekit/templates.test.js +78 -27
  170. package/dist/test/sveltekit/templates.test.js.map +1 -1
  171. package/dist/test/utils/clack/index.test.js +101 -0
  172. package/dist/test/utils/clack/index.test.js.map +1 -1
  173. package/dist/test/utils/git.test.js +10 -0
  174. package/dist/test/utils/git.test.js.map +1 -1
  175. package/dist/test/utils/line-endings.test.d.ts +1 -0
  176. package/dist/test/utils/line-endings.test.js +103 -0
  177. package/dist/test/utils/line-endings.test.js.map +1 -0
  178. package/package.json +2 -2
  179. package/dist/src/react-router/codemods/root.d.ts +0 -1
  180. package/dist/src/react-router/codemods/root.js +0 -170
  181. package/dist/src/react-router/codemods/root.js.map +0 -1
  182. package/dist/test/react-router/codemods/root.test.js +0 -182
  183. package/dist/test/react-router/codemods/root.test.js.map +0 -1
  184. /package/dist/test/{react-router/codemods/root.test.d.ts → apple/lookup-xcode-project.test.d.ts} +0 -0
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const wizardMocks = vitest_1.vi.hoisted(() => ({
5
+ legacyRun: vitest_1.vi.fn(),
6
+ readEnvironment: vitest_1.vi.fn(() => ({})),
7
+ runAndroidWizard: vitest_1.vi.fn(),
8
+ runAngularWizard: vitest_1.vi.fn(),
9
+ runAppleSnapshotsWizard: vitest_1.vi.fn(),
10
+ runAppleWizard: vitest_1.vi.fn(),
11
+ runCloudflareWizard: vitest_1.vi.fn(),
12
+ runFlutterWizard: vitest_1.vi.fn(),
13
+ runNextjsWizard: vitest_1.vi.fn(),
14
+ runNuxtWizard: vitest_1.vi.fn(),
15
+ runReactNativeWizard: vitest_1.vi.fn(),
16
+ runReactRouterWizard: vitest_1.vi.fn(),
17
+ runRemixWizard: vitest_1.vi.fn(),
18
+ runSourcemapsWizard: vitest_1.vi.fn(),
19
+ runSvelteKitWizard: vitest_1.vi.fn(),
20
+ }));
21
+ vitest_1.vi.mock('@clack/prompts', () => ({
22
+ intro: vitest_1.vi.fn(),
23
+ log: {
24
+ error: vitest_1.vi.fn(),
25
+ },
26
+ outro: vitest_1.vi.fn(),
27
+ select: vitest_1.vi.fn(),
28
+ }));
29
+ vitest_1.vi.mock('../lib/Helper/Env', () => ({
30
+ readEnvironment: wizardMocks.readEnvironment,
31
+ }));
32
+ vitest_1.vi.mock('../lib/Setup', () => ({
33
+ run: wizardMocks.legacyRun,
34
+ }));
35
+ vitest_1.vi.mock('../src/android/android-wizard', () => ({
36
+ runAndroidWizard: wizardMocks.runAndroidWizard,
37
+ }));
38
+ vitest_1.vi.mock('../src/angular/angular-wizard', () => ({
39
+ runAngularWizard: wizardMocks.runAngularWizard,
40
+ }));
41
+ vitest_1.vi.mock('../src/apple/apple-wizard', () => ({
42
+ runAppleWizard: wizardMocks.runAppleWizard,
43
+ }));
44
+ vitest_1.vi.mock('../src/apple/snapshots/apple-snapshots-wizard', () => ({
45
+ runAppleSnapshotsWizard: wizardMocks.runAppleSnapshotsWizard,
46
+ }));
47
+ vitest_1.vi.mock('../src/cloudflare/cloudflare-wizard', () => ({
48
+ runCloudflareWizard: wizardMocks.runCloudflareWizard,
49
+ }));
50
+ vitest_1.vi.mock('../src/flutter/flutter-wizard', () => ({
51
+ runFlutterWizard: wizardMocks.runFlutterWizard,
52
+ }));
53
+ vitest_1.vi.mock('../src/nextjs/nextjs-wizard', () => ({
54
+ runNextjsWizard: wizardMocks.runNextjsWizard,
55
+ }));
56
+ vitest_1.vi.mock('../src/nuxt/nuxt-wizard', () => ({
57
+ runNuxtWizard: wizardMocks.runNuxtWizard,
58
+ }));
59
+ vitest_1.vi.mock('../src/react-native/react-native-wizard', () => ({
60
+ runReactNativeWizard: wizardMocks.runReactNativeWizard,
61
+ }));
62
+ vitest_1.vi.mock('../src/react-router/react-router-wizard', () => ({
63
+ runReactRouterWizard: wizardMocks.runReactRouterWizard,
64
+ }));
65
+ vitest_1.vi.mock('../src/remix/remix-wizard', () => ({
66
+ runRemixWizard: wizardMocks.runRemixWizard,
67
+ }));
68
+ vitest_1.vi.mock('../src/sourcemaps/sourcemaps-wizard', () => ({
69
+ runSourcemapsWizard: wizardMocks.runSourcemapsWizard,
70
+ }));
71
+ vitest_1.vi.mock('../src/sveltekit/sveltekit-wizard', () => ({
72
+ runSvelteKitWizard: wizardMocks.runSvelteKitWizard,
73
+ }));
74
+ vitest_1.vi.mock('../src/utils/debug', () => ({
75
+ enableDebugLogs: vitest_1.vi.fn(),
76
+ }));
77
+ vitest_1.vi.mock('../src/utils/clack', () => ({
78
+ abortIfCancelled: async (input) => await input,
79
+ }));
80
+ const run_1 = require("../src/run");
81
+ function getBaseArgs(integration) {
82
+ return {
83
+ integration,
84
+ uninstall: false,
85
+ signup: false,
86
+ skipConnect: false,
87
+ debug: false,
88
+ quiet: false,
89
+ nonInteractive: false,
90
+ disableTelemetry: true,
91
+ };
92
+ }
93
+ (0, vitest_1.describe)('run', () => {
94
+ (0, vitest_1.beforeEach)(() => {
95
+ vitest_1.vi.clearAllMocks();
96
+ wizardMocks.readEnvironment.mockReturnValue({});
97
+ });
98
+ (0, vitest_1.it)('routes appleSnapshots to the Apple Snapshots wizard with Apple target options', async () => {
99
+ await (0, run_1.run)({
100
+ ...getBaseArgs('appleSnapshots'),
101
+ appTarget: 'App',
102
+ hostedTestTarget: 'AppTests',
103
+ nonInteractive: true,
104
+ xcodeProjectDir: '/tmp/MyApp',
105
+ });
106
+ (0, vitest_1.expect)(wizardMocks.runAppleSnapshotsWizard).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
107
+ appTarget: 'App',
108
+ hostedTestTarget: 'AppTests',
109
+ nonInteractive: true,
110
+ telemetryEnabled: false,
111
+ projectDir: '/tmp/MyApp',
112
+ }));
113
+ (0, vitest_1.expect)(wizardMocks.runAppleWizard).not.toHaveBeenCalled();
114
+ });
115
+ (0, vitest_1.it)('passes quiet through to the existing Cordova wizard', async () => {
116
+ await (0, run_1.run)({
117
+ ...getBaseArgs('cordova'),
118
+ quiet: true,
119
+ });
120
+ (0, vitest_1.expect)(wizardMocks.legacyRun).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
121
+ integration: 'cordova',
122
+ quiet: true,
123
+ }), vitest_1.expect.any(Object));
124
+ });
125
+ (0, vitest_1.it)('keeps ios routing on the existing Apple wizard', async () => {
126
+ await (0, run_1.run)({
127
+ ...getBaseArgs('ios'),
128
+ xcodeProjectDir: '/tmp/MyApp',
129
+ });
130
+ (0, vitest_1.expect)(wizardMocks.runAppleWizard).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
131
+ telemetryEnabled: false,
132
+ projectDir: '/tmp/MyApp',
133
+ }));
134
+ (0, vitest_1.expect)(wizardMocks.runAppleSnapshotsWizard).not.toHaveBeenCalled();
135
+ });
136
+ });
137
+ //# sourceMappingURL=run.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.test.js","sourceRoot":"","sources":["../../test/run.test.ts"],"names":[],"mappings":";;AAAA,mCAA8D;AAE9D,MAAM,WAAW,GAAG,WAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACpC,SAAS,EAAE,WAAE,CAAC,EAAE,EAAE;IAClB,eAAe,EAAE,WAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClC,gBAAgB,EAAE,WAAE,CAAC,EAAE,EAAE;IACzB,gBAAgB,EAAE,WAAE,CAAC,EAAE,EAAE;IACzB,uBAAuB,EAAE,WAAE,CAAC,EAAE,EAAE;I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BAAgB,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { beforeEach, describe, expect, it, vi } from 'vitest';\n\nconst wizardMocks = vi.hoisted(() => ({\n legacyRun: vi.fn(),\n readEnvironment: vi.fn(() => ({})),\n runAndroidWizard: vi.fn(),\n runAngularWizard: vi.fn(),\n runAppleSnapshotsWizard: vi.fn(),\n runAppleWizard: vi.fn(),\n runCloudflareWizard: vi.fn(),\n runFlutterWizard: vi.fn(),\n runNextjsWizard: vi.fn(),\n runNuxtWizard: vi.fn(),\n runReactNativeWizard: vi.fn(),\n runReactRouterWizard: vi.fn(),\n runRemixWizard: vi.fn(),\n runSourcemapsWizard: vi.fn(),\n runSvelteKitWizard: vi.fn(),\n}));\n\nvi.mock('@clack/prompts', () => ({\n intro: vi.fn(),\n log: {\n error: vi.fn(),\n },\n outro: vi.fn(),\n select: vi.fn(),\n}));\n\nvi.mock('../lib/Helper/Env', () => ({\n readEnvironment: wizardMocks.readEnvironment,\n}));\n\nvi.mock('../lib/Setup', () => ({\n run: wizardMocks.legacyRun,\n}));\n\nvi.mock('../src/android/android-wizard', () => ({\n runAndroidWizard: wizardMocks.runAndroidWizard,\n}));\n\nvi.mock('../src/angular/angular-wizard', () => ({\n runAngularWizard: wizardMocks.runAngularWizard,\n}));\n\nvi.mock('../src/apple/apple-wizard', () => ({\n runAppleWizard: wizardMocks.runAppleWizard,\n}));\n\nvi.mock('../src/apple/snapshots/apple-snapshots-wizard', () => ({\n runAppleSnapshotsWizard: wizardMocks.runAppleSnapshotsWizard,\n}));\n\nvi.mock('../src/cloudflare/cloudflare-wizard', () => ({\n runCloudflareWizard: wizardMocks.runCloudflareWizard,\n}));\n\nvi.mock('../src/flutter/flutter-wizard', () => ({\n runFlutterWizard: wizardMocks.runFlutterWizard,\n}));\n\nvi.mock('../src/nextjs/nextjs-wizard', () => ({\n runNextjsWizard: wizardMocks.runNextjsWizard,\n}));\n\nvi.mock('../src/nuxt/nuxt-wizard', () => ({\n runNuxtWizard: wizardMocks.runNuxtWizard,\n}));\n\nvi.mock('../src/react-native/react-native-wizard', () => ({\n runReactNativeWizard: wizardMocks.runReactNativeWizard,\n}));\n\nvi.mock('../src/react-router/react-router-wizard', () => ({\n runReactRouterWizard: wizardMocks.runReactRouterWizard,\n}));\n\nvi.mock('../src/remix/remix-wizard', () => ({\n runRemixWizard: wizardMocks.runRemixWizard,\n}));\n\nvi.mock('../src/sourcemaps/sourcemaps-wizard', () => ({\n runSourcemapsWizard: wizardMocks.runSourcemapsWizard,\n}));\n\nvi.mock('../src/sveltekit/sveltekit-wizard', () => ({\n runSvelteKitWizard: wizardMocks.runSvelteKitWizard,\n}));\n\nvi.mock('../src/utils/debug', () => ({\n enableDebugLogs: vi.fn(),\n}));\n\nvi.mock('../src/utils/clack', () => ({\n abortIfCancelled: async <T>(input: T | Promise<T>): Promise<T> => await input,\n}));\n\nimport { run } from '../src/run';\n\ntype RunArgs = Parameters<typeof run>[0];\n\nfunction getBaseArgs(integration: RunArgs['integration']): RunArgs {\n return {\n integration,\n uninstall: false,\n signup: false,\n skipConnect: false,\n debug: false,\n quiet: false,\n nonInteractive: false,\n disableTelemetry: true,\n };\n}\n\ndescribe('run', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n wizardMocks.readEnvironment.mockReturnValue({});\n });\n\n it('routes appleSnapshots to the Apple Snapshots wizard with Apple target options', async () => {\n await run({\n ...getBaseArgs('appleSnapshots'),\n appTarget: 'App',\n hostedTestTarget: 'AppTests',\n nonInteractive: true,\n xcodeProjectDir: '/tmp/MyApp',\n });\n\n expect(wizardMocks.runAppleSnapshotsWizard).toHaveBeenCalledWith(\n expect.objectContaining({\n appTarget: 'App',\n hostedTestTarget: 'AppTests',\n nonInteractive: true,\n telemetryEnabled: false,\n projectDir: '/tmp/MyApp',\n }),\n );\n expect(wizardMocks.runAppleWizard).not.toHaveBeenCalled();\n });\n\n it('passes quiet through to the existing Cordova wizard', async () => {\n await run({\n ...getBaseArgs('cordova'),\n quiet: true,\n });\n\n expect(wizardMocks.legacyRun).toHaveBeenCalledWith(\n expect.objectContaining({\n integration: 'cordova',\n quiet: true,\n }),\n expect.any(Object),\n );\n });\n\n it('keeps ios routing on the existing Apple wizard', async () => {\n await run({\n ...getBaseArgs('ios'),\n xcodeProjectDir: '/tmp/MyApp',\n });\n\n expect(wizardMocks.runAppleWizard).toHaveBeenCalledWith(\n expect.objectContaining({\n telemetryEnabled: false,\n projectDir: '/tmp/MyApp',\n }),\n );\n expect(wizardMocks.runAppleSnapshotsWizard).not.toHaveBeenCalled();\n });\n});\n"]}
@@ -38,9 +38,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
38
38
  // If you don't want to use Session Replay, just remove the line below:
39
39
  integrations: [replayIntegration()],
40
40
 
41
- // Enable sending user PII (Personally Identifiable Information)
42
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
43
- sendDefaultPii: true,
41
+ dataCollection: {
42
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
43
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
44
+ // userInfo: false,
45
+ // httpBodies: [],
46
+ },
44
47
  });
45
48
 
46
49
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -73,9 +76,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
73
76
  // If you don't want to use Session Replay, just remove the line below:
74
77
  integrations: [replayIntegration()],
75
78
 
76
- // Enable sending user PII (Personally Identifiable Information)
77
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
78
- sendDefaultPii: true,
79
+ dataCollection: {
80
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
81
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
82
+ // userInfo: false,
83
+ // httpBodies: [],
84
+ },
79
85
  });
80
86
 
81
87
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -101,9 +107,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
101
107
 
102
108
 
103
109
 
104
- // Enable sending user PII (Personally Identifiable Information)
105
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
106
- sendDefaultPii: true,
110
+ dataCollection: {
111
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
112
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
113
+ // userInfo: false,
114
+ // httpBodies: [],
115
+ },
107
116
  });
108
117
 
109
118
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -129,9 +138,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
129
138
 
130
139
 
131
140
 
132
- // Enable sending user PII (Personally Identifiable Information)
133
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
134
- sendDefaultPii: true,
141
+ dataCollection: {
142
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
143
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
144
+ // userInfo: false,
145
+ // httpBodies: [],
146
+ },
135
147
  });
136
148
 
137
149
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -161,9 +173,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
161
173
  enableLogs: true,
162
174
 
163
175
 
164
- // Enable sending user PII (Personally Identifiable Information)
165
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
166
- sendDefaultPii: true,
176
+ dataCollection: {
177
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
178
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
179
+ // userInfo: false,
180
+ // httpBodies: [],
181
+ },
167
182
 
168
183
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
169
184
  // spotlight: import.meta.env.DEV,
@@ -193,9 +208,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
193
208
 
194
209
 
195
210
 
196
- // Enable sending user PII (Personally Identifiable Information)
197
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
198
- sendDefaultPii: true,
211
+ dataCollection: {
212
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
213
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
214
+ // userInfo: false,
215
+ // httpBodies: [],
216
+ },
199
217
 
200
218
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
201
219
  // spotlight: import.meta.env.DEV,
@@ -227,9 +245,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
227
245
  enableLogs: true,
228
246
 
229
247
 
230
- // Enable sending user PII (Personally Identifiable Information)
231
- // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
232
- sendDefaultPii: true,
248
+ dataCollection: {
249
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
250
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
251
+ // userInfo: false,
252
+ // httpBodies: [],
253
+ },
233
254
 
234
255
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
235
256
  // spotlight: import.meta.env.DEV,
@@ -364,7 +385,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
364
385
  replaysOnErrorSampleRate: 1,
365
386
  integrations: [Sentry.replayIntegration()],
366
387
  enableLogs: true,
367
- sendDefaultPii: true
388
+ dataCollection: {
389
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
390
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
391
+ // userInfo: false,
392
+ // httpBodies: [],
393
+ },
368
394
  })
369
395
 
370
396
  export const handleError = handleErrorWithSentry();"
@@ -394,7 +420,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
394
420
  replaysSessionSampleRate: 0.1,
395
421
  replaysOnErrorSampleRate: 1,
396
422
  integrations: [Sentry.replayIntegration()],
397
- sendDefaultPii: true
423
+ dataCollection: {
424
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
425
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
426
+ // userInfo: false,
427
+ // httpBodies: [],
428
+ },
398
429
  })
399
430
 
400
431
  export const handleError = handleErrorWithSentry();"
@@ -423,7 +454,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
423
454
  dsn: "https://sentry.io/789",
424
455
  tracesSampleRate: 1,
425
456
  enableLogs: true,
426
- sendDefaultPii: true
457
+ dataCollection: {
458
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
459
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
460
+ // userInfo: false,
461
+ // httpBodies: [],
462
+ },
427
463
  })
428
464
 
429
465
  export const handleError = handleErrorWithSentry();"
@@ -451,7 +487,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
451
487
  Sentry.init({
452
488
  dsn: "https://sentry.io/xyz",
453
489
  enableLogs: true,
454
- sendDefaultPii: true
490
+ dataCollection: {
491
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
492
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
493
+ // userInfo: false,
494
+ // httpBodies: [],
495
+ },
455
496
  })
456
497
 
457
498
  export const handleError = handleErrorWithSentry();"
@@ -478,7 +519,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
478
519
  // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
479
520
  Sentry.init({
480
521
  dsn: "https://sentry.io/minimal",
481
- sendDefaultPii: true
522
+ dataCollection: {
523
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
524
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
525
+ // userInfo: false,
526
+ // httpBodies: [],
527
+ },
482
528
  })
483
529
 
484
530
  export const handleError = handleErrorWithSentry();"
@@ -509,7 +555,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
509
555
  Sentry.init({
510
556
  dsn: "https://sentry.io/order-test",
511
557
  tracesSampleRate: 1,
512
- sendDefaultPii: true
558
+ dataCollection: {
559
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
560
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
561
+ // userInfo: false,
562
+ // httpBodies: [],
563
+ },
513
564
  })
514
565
 
515
566
  export const handleError = handleErrorWithSentry();
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAMuC;AACvC,+DAA2E;AAC3E,kFAAkF;AAClF,uCAAuC;AAEvC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC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from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getSentryExampleApiRoute,\n getSentryExampleSveltePage,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\nimport { insertClientInitCall } from '../../src/sveltekit/sdk-setup/setup';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n\ndescribe('insertClientInitCall', () => {\n it('should insert client init call with all features enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/123', originalHooksMod, {\n performance: true,\n replay: true,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with performance disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/456', originalHooksMod, {\n performance: false,\n replay: true,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/456\",\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with replay disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/789', originalHooksMod, {\n performance: true,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/789\",\n tracesSampleRate: 1,\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with only logs enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/xyz', originalHooksMod, {\n performance: false,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/xyz\",\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with all features disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/minimal', originalHooksMod, {\n performance: false,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/minimal\",\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert init call after imports', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\n `);\n\n insertClientInitCall('https://sentry.io/order-test', originalHooksMod, {\n performance: true,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/order-test\",\n tracesSampleRate: 1,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\"\n `);\n });\n});\n\ndescribe('getSentryExampleSveltePage', () => {\n it('generates example page template with Svelte 5', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"<!--\n This is just a very simple page with a button to throw an example error.\n Feel free to delete this file and the entire sentry route.\n -->\n\n <script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = $state(false);\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n </script>\n\n <title>sentry-example-page</title>\n\n <div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"https://test-org.sentry.io/issues/?project=test-project\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n onclick={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n </div>\n\n <style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n </style>\n \"\n `);\n });\n\n it('generates example page template pre-Svelte 5', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"<!--\n This is just a very simple page with a button to throw an example error.\n Feel free to delete this file and the entire sentry route.\n -->\n\n <script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = false;\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n </script>\n\n <title>sentry-example-page</title>\n\n <div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"https://test-org.sentry.io/issues/?project=test-project\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n on:click={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n </div>\n\n <style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n </style>\n \"\n `);\n });\n\n it('generates an issues link for self-hosted', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: true,\n url: 'https://sAntry.com/',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toContain(\n 'https://sAntry.com/organizations/test-org/issues/?project=test-project',\n );\n });\n\n it('generates an issues link for saas', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toContain(\n 'https://test-org.sentry.io/issues/?project=test-project',\n );\n });\n});\n\ndescribe('getSentryExampleApiRoute', () => {\n it('generates the correct API route template', () => {\n const result = getSentryExampleApiRoute();\n expect(result).toMatchInlineSnapshot(`\n \"// This is just a very simple API route that throws an example error.\n // Feel free to delete this file and the entire sentry route.\n\n export const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n };\n \"\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAMuC;AACvC,+DAA2E;AAC3E,kFAAkF;AAClF,uCAAuC;AAEvC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GA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ent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getSentryExampleApiRoute,\n getSentryExampleSveltePage,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\nimport { insertClientInitCall } from '../../src/sveltekit/sdk-setup/setup';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n\ndescribe('insertClientInitCall', () => {\n it('should insert client init call with all features enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/123', originalHooksMod, {\n performance: true,\n replay: true,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n enableLogs: true,\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with performance disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/456', originalHooksMod, {\n performance: false,\n replay: true,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/456\",\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with replay disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/789', originalHooksMod, {\n performance: true,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/789\",\n tracesSampleRate: 1,\n enableLogs: true,\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with only logs enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/xyz', originalHooksMod, {\n performance: false,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/xyz\",\n enableLogs: true,\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with all features disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/minimal', originalHooksMod, {\n performance: false,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/minimal\",\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert init call after imports', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\n `);\n\n insertClientInitCall('https://sentry.io/order-test', originalHooksMod, {\n performance: true,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/order-test\",\n tracesSampleRate: 1,\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n })\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\"\n `);\n });\n});\n\ndescribe('getSentryExampleSveltePage', () => {\n it('generates example page template with Svelte 5', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"<!--\n This is just a very simple page with a button to throw an example error.\n Feel free to delete this file and the entire sentry route.\n -->\n\n <script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = $state(false);\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n </script>\n\n <title>sentry-example-page</title>\n\n <div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"https://test-org.sentry.io/issues/?project=test-project\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n onclick={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n </div>\n\n <style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n </style>\n \"\n `);\n });\n\n it('generates example page template pre-Svelte 5', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"<!--\n This is just a very simple page with a button to throw an example error.\n Feel free to delete this file and the entire sentry route.\n -->\n\n <script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = false;\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n </script>\n\n <title>sentry-example-page</title>\n\n <div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"https://test-org.sentry.io/issues/?project=test-project\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n on:click={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n </div>\n\n <style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n </style>\n \"\n `);\n });\n\n it('generates an issues link for self-hosted', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: true,\n url: 'https://sAntry.com/',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toContain(\n 'https://sAntry.com/organizations/test-org/issues/?project=test-project',\n );\n });\n\n it('generates an issues link for saas', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toContain(\n 'https://test-org.sentry.io/issues/?project=test-project',\n );\n });\n});\n\ndescribe('getSentryExampleApiRoute', () => {\n it('generates the correct API route template', () => {\n const result = getSentryExampleApiRoute();\n expect(result).toMatchInlineSnapshot(`\n \"// This is just a very simple API route that throws an example error.\n // Feel free to delete this file and the entire sentry route.\n\n export const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n };\n \"\n `);\n });\n});\n"]}