@sentry/wizard 6.10.0 → 6.12.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 (203) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/ci-ensure-runtime-loaded.sh +82 -0
  3. package/dist/e2e-tests/tests/angular-17.test.js +72 -82
  4. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  5. package/dist/e2e-tests/tests/angular-19.test.js +71 -80
  6. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  7. package/dist/e2e-tests/tests/cloudflare-worker.test.d.ts +1 -0
  8. package/dist/e2e-tests/tests/cloudflare-worker.test.js +69 -0
  9. package/dist/e2e-tests/tests/cloudflare-worker.test.js.map +1 -0
  10. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js +2 -5
  11. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/expo.test.js +36 -61
  13. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/flutter.test.js +63 -70
  15. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/help-message.test.js +2 -2
  17. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/nextjs-14.test.js +48 -76
  19. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  20. package/dist/e2e-tests/tests/nextjs-15.test.js +89 -99
  21. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  22. package/dist/e2e-tests/tests/nextjs-16.test.js +48 -45
  23. package/dist/e2e-tests/tests/nextjs-16.test.js.map +1 -1
  24. package/dist/e2e-tests/tests/nuxt-3.test.js +45 -58
  25. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  26. package/dist/e2e-tests/tests/nuxt-4.test.js +59 -73
  27. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  28. package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -8
  29. package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
  30. package/dist/e2e-tests/tests/react-native.test.js +44 -80
  31. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  32. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.d.ts +1 -0
  33. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +96 -0
  34. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -0
  35. package/dist/e2e-tests/tests/react-router.test.js +165 -145
  36. package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
  37. package/dist/e2e-tests/tests/remix.test.js +162 -132
  38. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  39. package/dist/e2e-tests/tests/sveltekit-hooks.test.js +48 -36
  40. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
  41. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +5 -7
  42. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
  43. package/dist/e2e-tests/utils/index.d.ts +15 -43
  44. package/dist/e2e-tests/utils/index.js +95 -185
  45. package/dist/e2e-tests/utils/index.js.map +1 -1
  46. package/dist/get-e2e-test-matrix.mjs +11 -0
  47. package/dist/lib/Constants.d.ts +1 -0
  48. package/dist/lib/Constants.js +5 -0
  49. package/dist/lib/Constants.js.map +1 -1
  50. package/dist/src/android/android-wizard.js +2 -4
  51. package/dist/src/android/android-wizard.js.map +1 -1
  52. package/dist/src/angular/angular-wizard.js +4 -6
  53. package/dist/src/angular/angular-wizard.js.map +1 -1
  54. package/dist/src/angular/sdk-setup.js +1 -1
  55. package/dist/src/angular/sdk-setup.js.map +1 -1
  56. package/dist/src/apple/apple-wizard.js +2 -4
  57. package/dist/src/apple/apple-wizard.js.map +1 -1
  58. package/dist/src/apple/code-tools.js +17 -3
  59. package/dist/src/apple/code-tools.js.map +1 -1
  60. package/dist/src/apple/configure-package-manager.js +18 -5
  61. package/dist/src/apple/configure-package-manager.js.map +1 -1
  62. package/dist/src/cloudflare/cloudflare-wizard.d.ts +3 -0
  63. package/dist/src/cloudflare/cloudflare-wizard.js +104 -0
  64. package/dist/src/cloudflare/cloudflare-wizard.js.map +1 -0
  65. package/dist/src/cloudflare/sdk-setup.d.ts +8 -0
  66. package/dist/src/cloudflare/sdk-setup.js +47 -0
  67. package/dist/src/cloudflare/sdk-setup.js.map +1 -0
  68. package/dist/src/cloudflare/templates.d.ts +5 -0
  69. package/dist/src/cloudflare/templates.js +50 -0
  70. package/dist/src/cloudflare/templates.js.map +1 -0
  71. package/dist/src/cloudflare/wrangler/create-wrangler-config.d.ts +4 -0
  72. package/dist/src/cloudflare/wrangler/create-wrangler-config.js +27 -0
  73. package/dist/src/cloudflare/wrangler/create-wrangler-config.js.map +1 -0
  74. package/dist/src/cloudflare/wrangler/ensure-wrangler-config.d.ts +4 -0
  75. package/dist/src/cloudflare/wrangler/ensure-wrangler-config.js +25 -0
  76. package/dist/src/cloudflare/wrangler/ensure-wrangler-config.js.map +1 -0
  77. package/dist/src/cloudflare/wrangler/find-wrangler-config.d.ts +4 -0
  78. package/dist/src/cloudflare/wrangler/find-wrangler-config.js +23 -0
  79. package/dist/src/cloudflare/wrangler/find-wrangler-config.js.map +1 -0
  80. package/dist/src/cloudflare/wrangler/get-entry-point-from-wrangler-config.d.ts +6 -0
  81. package/dist/src/cloudflare/wrangler/get-entry-point-from-wrangler-config.js +52 -0
  82. package/dist/src/cloudflare/wrangler/get-entry-point-from-wrangler-config.js.map +1 -0
  83. package/dist/src/cloudflare/wrangler/update-wrangler-config.d.ts +17 -0
  84. package/dist/src/cloudflare/wrangler/update-wrangler-config.js +173 -0
  85. package/dist/src/cloudflare/wrangler/update-wrangler-config.js.map +1 -0
  86. package/dist/src/cloudflare/wrap-worker.d.ts +33 -0
  87. package/dist/src/cloudflare/wrap-worker.js +116 -0
  88. package/dist/src/cloudflare/wrap-worker.js.map +1 -0
  89. package/dist/src/flutter/flutter-wizard.js +3 -6
  90. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  91. package/dist/src/nextjs/nextjs-wizard.js +0 -2
  92. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  93. package/dist/src/nuxt/nuxt-wizard.js +3 -5
  94. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  95. package/dist/src/react-native/expo.d.ts +6 -0
  96. package/dist/src/react-native/expo.js +27 -1
  97. package/dist/src/react-native/expo.js.map +1 -1
  98. package/dist/src/react-native/git.d.ts +5 -0
  99. package/dist/src/react-native/git.js +32 -1
  100. package/dist/src/react-native/git.js.map +1 -1
  101. package/dist/src/react-native/javascript.js +3 -1
  102. package/dist/src/react-native/javascript.js.map +1 -1
  103. package/dist/src/react-native/react-native-wizard.js +14 -10
  104. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  105. package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
  106. package/dist/src/react-router/codemods/client.entry.js +69 -12
  107. package/dist/src/react-router/codemods/client.entry.js.map +1 -1
  108. package/dist/src/react-router/codemods/react-router-config.js +1 -1
  109. package/dist/src/react-router/codemods/react-router-config.js.map +1 -1
  110. package/dist/src/react-router/codemods/root.js +1 -2
  111. package/dist/src/react-router/codemods/root.js.map +1 -1
  112. package/dist/src/react-router/codemods/server-entry.d.ts +1 -1
  113. package/dist/src/react-router/codemods/server-entry.js +39 -4
  114. package/dist/src/react-router/codemods/server-entry.js.map +1 -1
  115. package/dist/src/react-router/codemods/vite.js +46 -1
  116. package/dist/src/react-router/codemods/vite.js.map +1 -1
  117. package/dist/src/react-router/react-router-wizard.js +55 -10
  118. package/dist/src/react-router/react-router-wizard.js.map +1 -1
  119. package/dist/src/react-router/sdk-setup.d.ts +5 -3
  120. package/dist/src/react-router/sdk-setup.js +35 -9
  121. package/dist/src/react-router/sdk-setup.js.map +1 -1
  122. package/dist/src/react-router/templates.d.ts +2 -2
  123. package/dist/src/react-router/templates.js +72 -2
  124. package/dist/src/react-router/templates.js.map +1 -1
  125. package/dist/src/remix/remix-wizard.js +2 -4
  126. package/dist/src/remix/remix-wizard.js.map +1 -1
  127. package/dist/src/run.d.ts +1 -1
  128. package/dist/src/run.js +5 -0
  129. package/dist/src/run.js.map +1 -1
  130. package/dist/src/sourcemaps/tools/vite.js +1 -1
  131. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  132. package/dist/src/sveltekit/sdk-setup/vite.js +1 -1
  133. package/dist/src/sveltekit/sdk-setup/vite.js.map +1 -1
  134. package/dist/src/sveltekit/sveltekit-wizard.js +2 -4
  135. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  136. package/dist/src/utils/abort-if-sportlight-not-supported.d.ts +5 -0
  137. package/dist/src/utils/abort-if-sportlight-not-supported.js +40 -0
  138. package/dist/src/utils/abort-if-sportlight-not-supported.js.map +1 -0
  139. package/dist/src/utils/ast-utils.d.ts +11 -1
  140. package/dist/src/utils/ast-utils.js +19 -1
  141. package/dist/src/utils/ast-utils.js.map +1 -1
  142. package/dist/src/utils/clack/index.d.ts +2 -2
  143. package/dist/src/utils/clack/index.js.map +1 -1
  144. package/dist/src/utils/clack/mcp-config.js +117 -59
  145. package/dist/src/utils/clack/mcp-config.js.map +1 -1
  146. package/dist/src/version.d.ts +1 -1
  147. package/dist/src/version.js +1 -1
  148. package/dist/src/version.js.map +1 -1
  149. package/dist/test/angular/angular-wizard.test.js +2 -4
  150. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  151. package/dist/test/apple/code-tools.test.js +78 -0
  152. package/dist/test/apple/code-tools.test.js.map +1 -1
  153. package/dist/test/apple/configure-package-manager.test.d.ts +1 -0
  154. package/dist/test/apple/configure-package-manager.test.js +161 -0
  155. package/dist/test/apple/configure-package-manager.test.js.map +1 -0
  156. package/dist/test/cloudflare/create-wrangler-config.test.d.ts +1 -0
  157. package/dist/test/cloudflare/create-wrangler-config.test.js +48 -0
  158. package/dist/test/cloudflare/create-wrangler-config.test.js.map +1 -0
  159. package/dist/test/cloudflare/ensure-wrangler-config.test.d.ts +1 -0
  160. package/dist/test/cloudflare/ensure-wrangler-config.test.js +61 -0
  161. package/dist/test/cloudflare/ensure-wrangler-config.test.js.map +1 -0
  162. package/dist/test/cloudflare/find-wrangler-config.test.d.ts +1 -0
  163. package/dist/test/cloudflare/find-wrangler-config.test.js +77 -0
  164. package/dist/test/cloudflare/find-wrangler-config.test.js.map +1 -0
  165. package/dist/test/cloudflare/get-entry-point-from-wrangler-config.test.d.ts +1 -0
  166. package/dist/test/cloudflare/get-entry-point-from-wrangler-config.test.js +81 -0
  167. package/dist/test/cloudflare/get-entry-point-from-wrangler-config.test.js.map +1 -0
  168. package/dist/test/cloudflare/sdk-setup.test.d.ts +1 -0
  169. package/dist/test/cloudflare/sdk-setup.test.js +170 -0
  170. package/dist/test/cloudflare/sdk-setup.test.js.map +1 -0
  171. package/dist/test/cloudflare/templates.test.d.ts +1 -0
  172. package/dist/test/cloudflare/templates.test.js +122 -0
  173. package/dist/test/cloudflare/templates.test.js.map +1 -0
  174. package/dist/test/cloudflare/update-wrangler-config.test.d.ts +1 -0
  175. package/dist/test/cloudflare/update-wrangler-config.test.js +216 -0
  176. package/dist/test/cloudflare/update-wrangler-config.test.js.map +1 -0
  177. package/dist/test/cloudflare/wrap-worker.test.d.ts +1 -0
  178. package/dist/test/cloudflare/wrap-worker.test.js +206 -0
  179. package/dist/test/cloudflare/wrap-worker.test.js.map +1 -0
  180. package/dist/test/react-native/expo.test.js +140 -0
  181. package/dist/test/react-native/expo.test.js.map +1 -1
  182. package/dist/test/react-native/git.test.d.ts +1 -0
  183. package/dist/test/react-native/git.test.js +160 -0
  184. package/dist/test/react-native/git.test.js.map +1 -0
  185. package/dist/test/react-router/codemods/client-entry.test.js +29 -0
  186. package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
  187. package/dist/test/react-router/codemods/root.test.js +4 -0
  188. package/dist/test/react-router/codemods/root.test.js.map +1 -1
  189. package/dist/test/react-router/codemods/server-entry.test.js +70 -0
  190. package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
  191. package/dist/test/react-router/codemods/vite.test.js +89 -0
  192. package/dist/test/react-router/codemods/vite.test.js.map +1 -1
  193. package/dist/test/react-router/sdk-setup.test.js +64 -8
  194. package/dist/test/react-router/sdk-setup.test.js.map +1 -1
  195. package/dist/test/react-router/templates.test.js +50 -0
  196. package/dist/test/react-router/templates.test.js.map +1 -1
  197. package/dist/test/sourcemaps/tools/vite.test.js +12 -8
  198. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  199. package/dist/test/utils/ast-utils.test.js +22 -0
  200. package/dist/test/utils/ast-utils.test.js.map +1 -1
  201. package/dist/test/utils/clack/mcp-config.test.js +176 -51
  202. package/dist/test/utils/clack/mcp-config.test.js.map +1 -1
  203. package/package.json +6 -5
@@ -32,12 +32,10 @@ const vitest_1 = require("vitest");
32
32
  const clifty_1 = require("clifty");
33
33
  (0, vitest_1.describe)('Sveltekit with instrumentation and tracing', () => {
34
34
  (0, vitest_1.describe)('without existing files', () => {
35
- const projectDir = path.resolve(__dirname, '../test-applications/sveltekit-tracing-test-app');
36
35
  const integration = Constants_1.Integration.sveltekit;
37
36
  let wizardExitCode;
37
+ const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('sveltekit-tracing-test-app');
38
38
  (0, vitest_1.beforeAll)(async () => {
39
- (0, utils_1.initGit)(projectDir);
40
- (0, utils_1.revertLocalChanges)(projectDir);
41
39
  wizardExitCode = await (0, clifty_1.withEnv)({
42
40
  cwd: projectDir,
43
41
  })
@@ -62,14 +60,13 @@ const clifty_1 = require("clifty");
62
60
  .run((0, utils_1.getWizardCommand)(integration));
63
61
  });
64
62
  (0, vitest_1.afterAll)(() => {
65
- (0, utils_1.revertLocalChanges)(projectDir);
66
- (0, utils_1.cleanupGit)(projectDir);
63
+ cleanup();
67
64
  });
68
65
  (0, vitest_1.it)('exits with exit code 0', () => {
69
66
  (0, vitest_1.expect)(wizardExitCode).toBe(0);
70
67
  });
71
68
  (0, vitest_1.it)('adds the SDK dependency to package.json', () => {
72
- (0, utils_1.checkPackageJson)(projectDir, integration);
69
+ (0, utils_1.checkPackageJson)(projectDir, '@sentry/sveltekit');
73
70
  });
74
71
  (0, vitest_1.it)('adds the .env.sentry-build-plugin', () => {
75
72
  (0, utils_1.checkEnvBuildPlugin)(projectDir);
@@ -93,7 +90,8 @@ const clifty_1 = require("clifty");
93
90
  org: "${utils_1.TEST_ARGS.ORG_SLUG}",
94
91
  project: "${utils_1.TEST_ARGS.PROJECT_SLUG}"
95
92
  }), sveltekit()]
96
- });"
93
+ });
94
+ "
97
95
  `);
98
96
  });
99
97
  (0, vitest_1.it)('creates the hook files', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-tracing.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/sveltekit-tracing.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,4CAA8B;AAC9B,mDAAkD;AAClD,oCAakB;AAClB,mCAAmE;AAEnE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,iDAAiD,CAClD,CAAC;QAEF,MAAM,WAAW,GAAG,uBAAW,CAAC,SAAS,CAAC;QAC1C,IAAI,cAAsB,CAAC;QAE3B,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,IAAA,eAAO,EAAC,UAAU,CAAC,CAAC;YACpB,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAE/B,cAAc,GAAG,MAAM,IAAA,gBAAO,EAAC;gBAC7B,GAAG,EAAE,UAAU;aAChB,CAAC;iBACC,iBAAiB,EAAE;iBACnB,YAAY,CACX,8EAA8E,CAC/E;iBACA,IAAI,CA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AE,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC3C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n getWizardCommand,\n initGit,\n revertLocalChanges,\n TEST_ARGS,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Sveltekit with instrumentation and tracing', () => {\n describe('without existing files', () => {\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/sveltekit-tracing-test-app',\n );\n\n const integration = Integration.sveltekit;\n let wizardExitCode: number;\n\n beforeAll(async () => {\n initGit(projectDir);\n revertLocalChanges(projectDir);\n\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry SvelteKit Wizard will help you set up Sentry for your application',\n )\n .step('package installation', ({ expectOutput, whenAsked }) => {\n whenAsked('Please select your package manager.').respondWith(\n KEYS.DOWN,\n KEYS.ENTER,\n );\n expectOutput('Installing @sentry/sveltekit');\n })\n .step('SDK setup', ({ whenAsked }) => {\n whenAsked('Do you want to enable Tracing', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n whenAsked('Do you want to enable Session Replay').respondWith(\n KEYS.ENTER,\n );\n whenAsked('Do you want to enable Logs').respondWith(KEYS.ENTER);\n })\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry SvelteKit SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds the SDK dependency to package.json', () => {\n checkPackageJson(projectDir, integration);\n });\n\n it('adds the .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n it('adds the example page', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n checkFileContents(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n // svelte 5 specific syntax\n ['let hasSentError = $state(false);', 'onclick={getSentryData}'],\n );\n });\n\n it('adds the sentry plugin to vite.config.ts', () => {\n const viteConfig = fs.readFileSync(\n path.resolve(projectDir, 'vite.config.ts'),\n );\n expect(viteConfig.toString()).toMatchInlineSnapshot(`\n \"import { sentrySvelteKit } from \"@sentry/sveltekit\";\n import { sveltekit } from '@sveltejs/kit/vite';\n import { defineConfig } from 'vite';\n\n export default defineConfig({\n \tplugins: [sentrySvelteKit({\n org: \"${TEST_ARGS.ORG_SLUG}\",\n project: \"${TEST_ARGS.PROJECT_SLUG}\"\n }), sveltekit()]\n });\"\n `);\n });\n\n it('creates the hook files', () => {\n const clientHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n );\n const serverHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n );\n\n expect(clientHooks.toString()).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\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 expect(serverHooks.toString()).toMatchInlineSnapshot(`\n \"import {sequence} from \"@sveltejs/kit/hooks\";\n import * as Sentry from \"@sentry/sveltekit\";\n export const handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {\n const response = await resolve(event);\n return response;\n });\n export const handleError = Sentry.handleErrorWithSentry();\"\n `);\n });\n\n it('creates the insturmentation.server file', () => {\n const instrumentationServer = fs.readFileSync(\n path.resolve(projectDir, 'src/instrumentation.server.ts'),\n );\n\n expect(instrumentationServer.toString()).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\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\n it('enables tracing and instrumentation in svelte.config.js', () => {\n const svelteConfig = fs.readFileSync(\n path.resolve(projectDir, 'svelte.config.js'),\n );\n expect(svelteConfig.toString()).toMatchInlineSnapshot(`\n \"import adapter from '@sveltejs/adapter-node';\n import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n /** @type {import('@sveltejs/kit').Config} */\n const config = {\n // Consult https://svelte.dev/docs/kit/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.\n // If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n // See https://svelte.dev/docs/kit/adapters for more information about adapters.\n adapter: adapter(),\n experimental: {\n remoteFunctions: true,\n\n tracing: {\n server: true,\n },\n\n instrumentation: {\n server: true,\n },\n },\n },\n };\n\n export default config;\"\n `);\n });\n\n // checkSvelteKitProject(projectDir, integration);\n it('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'ready in');\n });\n\n it('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'to expose', 'preview');\n });\n });\n});\n"]}
1
+ {"version":3,"file":"sveltekit-tracing.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/sveltekit-tracing.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,4CAA8B;AAC9B,mDAAkD;AAClD,oCAWkB;AAClB,mCAAmE;AAEnE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,WAAW,GAAG,uBAAW,CAAC,SAAS,CAAC;QAC1C,IAAI,cAAsB,CAAC;QAE3B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EACnD,4BAA4B,CAC7B,CAAC;QAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,cAAc,GAAG,MAAM,IAAA,gBAAO,EAAC;gBAC7B,GAAG,EAAE,UAAU;aAChB,CAAC;iBACC,iBAAiB,EAAE;iBACnB,YAAY,CACX,8EAA8E,CAC/E;iBACA,IAAI,CAAC,sBAAsB,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE;gBA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AC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n TEST_ARGS,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Sveltekit with instrumentation and tracing', () => {\n describe('without existing files', () => {\n const integration = Integration.sveltekit;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'sveltekit-tracing-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry SvelteKit Wizard will help you set up Sentry for your application',\n )\n .step('package installation', ({ expectOutput, whenAsked }) => {\n whenAsked('Please select your package manager.').respondWith(\n KEYS.DOWN,\n KEYS.ENTER,\n );\n expectOutput('Installing @sentry/sveltekit');\n })\n .step('SDK setup', ({ whenAsked }) => {\n whenAsked('Do you want to enable Tracing', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n whenAsked('Do you want to enable Session Replay').respondWith(\n KEYS.ENTER,\n );\n whenAsked('Do you want to enable Logs').respondWith(KEYS.ENTER);\n })\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry SvelteKit SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds the SDK dependency to package.json', () => {\n checkPackageJson(projectDir, '@sentry/sveltekit');\n });\n\n it('adds the .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n it('adds the example page', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n checkFileContents(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n // svelte 5 specific syntax\n ['let hasSentError = $state(false);', 'onclick={getSentryData}'],\n );\n });\n\n it('adds the sentry plugin to vite.config.ts', () => {\n const viteConfig = fs.readFileSync(\n path.resolve(projectDir, 'vite.config.ts'),\n );\n expect(viteConfig.toString()).toMatchInlineSnapshot(`\n \"import { sentrySvelteKit } from \"@sentry/sveltekit\";\n import { sveltekit } from '@sveltejs/kit/vite';\n import { defineConfig } from 'vite';\n\n export default defineConfig({\n \tplugins: [sentrySvelteKit({\n org: \"${TEST_ARGS.ORG_SLUG}\",\n project: \"${TEST_ARGS.PROJECT_SLUG}\"\n }), sveltekit()]\n });\n \"\n `);\n });\n\n it('creates the hook files', () => {\n const clientHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n );\n const serverHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n );\n\n expect(clientHooks.toString()).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\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 expect(serverHooks.toString()).toMatchInlineSnapshot(`\n \"import {sequence} from \"@sveltejs/kit/hooks\";\n import * as Sentry from \"@sentry/sveltekit\";\n export const handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {\n const response = await resolve(event);\n return response;\n });\n export const handleError = Sentry.handleErrorWithSentry();\"\n `);\n });\n\n it('creates the insturmentation.server file', () => {\n const instrumentationServer = fs.readFileSync(\n path.resolve(projectDir, 'src/instrumentation.server.ts'),\n );\n\n expect(instrumentationServer.toString()).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\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\n it('enables tracing and instrumentation in svelte.config.js', () => {\n const svelteConfig = fs.readFileSync(\n path.resolve(projectDir, 'svelte.config.js'),\n );\n expect(svelteConfig.toString()).toMatchInlineSnapshot(`\n \"import adapter from '@sveltejs/adapter-node';\n import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n /** @type {import('@sveltejs/kit').Config} */\n const config = {\n // Consult https://svelte.dev/docs/kit/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.\n // If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n // See https://svelte.dev/docs/kit/adapters for more information about adapters.\n adapter: adapter(),\n experimental: {\n remoteFunctions: true,\n\n tracing: {\n server: true,\n },\n\n instrumentation: {\n server: true,\n },\n },\n },\n };\n\n export default config;\"\n `);\n });\n\n // checkSvelteKitProject(projectDir, integration);\n it('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'ready in');\n });\n\n it('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'to expose', 'preview');\n });\n });\n});\n"]}
@@ -20,22 +20,24 @@ export declare const log: {
20
20
  info: (message: string) => void;
21
21
  error: (message: unknown) => void;
22
22
  };
23
- export declare class WizardTestEnv {
23
+ /**
24
+ * Creates an isolated test environment by copying a test application to a temporary directory.
25
+ * Each call creates a NEW unique temporary directory, allowing multiple isolated environments
26
+ * per test file (useful for tests that run the wizard multiple times with different configs).
27
+ *
28
+ * @param testAppName - Name of the test application folder (e.g., 'nextjs-16-test-app')
29
+ * @returns Object with projectDir path and cleanup function
30
+ */
31
+ export declare function createIsolatedTestEnv(testAppName: string): {
32
+ projectDir: string;
33
+ cleanup: () => void;
34
+ };
35
+ export declare class ProcessRunner {
24
36
  taskHandle: ChildProcess;
25
37
  constructor(cmd: string, args: string[], opts?: {
26
38
  cwd?: string;
27
39
  debug?: boolean;
28
40
  });
29
- sendStdin(input: string): void;
30
- /**
31
- * Sends the input and waits for the output.
32
- * @returns a promise that resolves when the output was found
33
- * @throws an error when the output was not found within the timeout
34
- */
35
- sendStdinAndWaitForOutput(input: string | string[], output: string, options?: {
36
- timeout?: number;
37
- optional?: boolean;
38
- }): Promise<boolean>;
39
41
  /**
40
42
  * Waits for the task to exit with a given `statusCode`.
41
43
  *
@@ -60,37 +62,7 @@ export declare class WizardTestEnv {
60
62
  }): Promise<boolean>;
61
63
  kill(): void;
62
64
  }
63
- /**
64
- * Initialize a git repository in the given directory
65
- * @param projectDir
66
- */
67
- export declare function initGit(projectDir: string): void;
68
- /**
69
- * Cleanup the git repository in the given directory
70
- *
71
- * Caution! Make sure `projectDir` is a test project directory,
72
- * if in doubt, please commit your local non-test changes first!
73
- * @param projectDir
74
- */
75
- export declare function cleanupGit(projectDir: string): void;
76
- /**
77
- * Revert local changes in the given directory
78
- *
79
- * Caution! Make sure `projectDir` is a test project directory,
80
- * if in doubt, please commit your local non-test changes first!
81
- *
82
- * @param projectDir
83
- */
84
- export declare function revertLocalChanges(projectDir: string): void;
85
65
  export declare function getWizardCommand(integration: Integration): string;
86
- /**
87
- * Start the wizard instance with the given integration and project directory
88
- * @param integration
89
- * @param projectDir
90
- *
91
- * @returns WizardTestEnv
92
- */
93
- export declare function startWizardInstance(integration: Integration, projectDir: string, debug?: boolean, spotlight?: boolean): WizardTestEnv;
94
66
  /**
95
67
  * Create a file with the given content
96
68
  *
@@ -133,12 +105,12 @@ export declare function checkFileExists(filePath: string): void;
133
105
  */
134
106
  export declare function checkFileDoesNotExist(filePath: string): void;
135
107
  /**
136
- * Check if the package.json contains the given integration
108
+ * Check if the package.json lists the given package as a dependency or dev dependency
137
109
  *
138
110
  * @param projectDir
139
111
  * @param integration
140
112
  */
141
- export declare function checkPackageJson(projectDir: string, integration: Integration): void;
113
+ export declare function checkPackageJson(projectDir: string, packageName: string, devDependency?: boolean): void;
142
114
  /**
143
115
  * Check if the .sentryclirc contains the auth token
144
116
  *
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.checkIfRunsOnProdMode = exports.checkIfRunsOnDevMode = exports.checkIfExpoBundles = exports.checkIfReactNativeBundles = exports.checkIfFlutterBuilds = exports.checkIfLints = exports.checkIfBuilds = exports.checkSentryProperties = exports.checkEnvBuildPlugin = exports.checkSentryCliRc = exports.checkPackageJson = exports.checkFileDoesNotExist = exports.checkFileExists = exports.checkFileContents = exports.checkFileDoesNotContain = exports.modifyFile = exports.createFile = exports.startWizardInstance = exports.getWizardCommand = exports.revertLocalChanges = exports.cleanupGit = exports.initGit = exports.WizardTestEnv = exports.log = exports.TEST_ARGS = exports.KEYS = void 0;
26
+ exports.checkIfRunsOnProdMode = exports.checkIfRunsOnDevMode = exports.checkIfExpoBundles = exports.checkIfReactNativeBundles = exports.checkIfFlutterBuilds = exports.checkIfLints = exports.checkIfBuilds = exports.checkSentryProperties = exports.checkEnvBuildPlugin = exports.checkSentryCliRc = exports.checkPackageJson = exports.checkFileDoesNotExist = exports.checkFileExists = exports.checkFileContents = exports.checkFileDoesNotContain = exports.modifyFile = exports.createFile = exports.getWizardCommand = exports.ProcessRunner = exports.createIsolatedTestEnv = exports.log = exports.TEST_ARGS = exports.KEYS = void 0;
27
27
  const fs = __importStar(require("node:fs"));
28
+ const os = __importStar(require("node:os"));
28
29
  const path = __importStar(require("node:path"));
29
- const Constants_1 = require("../../lib/Constants");
30
30
  const node_child_process_1 = require("node:child_process");
31
31
  const Logging_1 = require("../../lib/Helper/Logging");
32
32
  const vitest_1 = require("vitest");
@@ -73,7 +73,51 @@ exports.log = {
73
73
  (0, Logging_1.red)(`[ERROR] ${formatMessage(message, 0)}`);
74
74
  },
75
75
  };
76
- class WizardTestEnv {
76
+ /**
77
+ * Creates an isolated test environment by copying a test application to a temporary directory.
78
+ * Each call creates a NEW unique temporary directory, allowing multiple isolated environments
79
+ * per test file (useful for tests that run the wizard multiple times with different configs).
80
+ *
81
+ * @param testAppName - Name of the test application folder (e.g., 'nextjs-16-test-app')
82
+ * @returns Object with projectDir path and cleanup function
83
+ */
84
+ function createIsolatedTestEnv(testAppName) {
85
+ const sourceDir = path.resolve(__dirname, '../test-applications', testAppName);
86
+ const tmpBaseDir = path.join(os.tmpdir(), 'sentry-wizard-e2e');
87
+ if (!fs.existsSync(tmpBaseDir)) {
88
+ fs.mkdirSync(tmpBaseDir, { recursive: true });
89
+ }
90
+ const projectDir = fs.mkdtempSync(path.join(tmpBaseDir, `${testAppName}-`));
91
+ exports.log.info(`Created isolated test env at: ${projectDir}`);
92
+ try {
93
+ fs.cpSync(sourceDir, projectDir, { recursive: true });
94
+ }
95
+ catch (e) {
96
+ exports.log.error('Error copying test application');
97
+ exports.log.error(e);
98
+ throw e;
99
+ }
100
+ initGit(projectDir);
101
+ const cleanup = () => {
102
+ try {
103
+ const keepOnFailure = process.env.SENTRY_WIZARD_E2E_KEEP_TEMP === 'true';
104
+ if (keepOnFailure) {
105
+ exports.log.info(`Keeping temp directory for debugging: ${projectDir}`);
106
+ }
107
+ else {
108
+ fs.rmSync(projectDir, { recursive: true, force: true });
109
+ exports.log.info(`Cleaned up isolated test env: ${projectDir}`);
110
+ }
111
+ }
112
+ catch (e) {
113
+ exports.log.error(`Error cleaning up test environment at ${projectDir}`);
114
+ exports.log.error(e);
115
+ }
116
+ };
117
+ return { projectDir, cleanup };
118
+ }
119
+ exports.createIsolatedTestEnv = createIsolatedTestEnv;
120
+ class ProcessRunner {
77
121
  taskHandle;
78
122
  constructor(cmd, args, opts) {
79
123
  this.taskHandle = (0, node_child_process_1.spawn)(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });
@@ -82,26 +126,6 @@ class WizardTestEnv {
82
126
  this.taskHandle.stderr?.pipe(process.stderr);
83
127
  }
84
128
  }
85
- sendStdin(input) {
86
- this.taskHandle.stdin?.write(input);
87
- }
88
- /**
89
- * Sends the input and waits for the output.
90
- * @returns a promise that resolves when the output was found
91
- * @throws an error when the output was not found within the timeout
92
- */
93
- sendStdinAndWaitForOutput(input, output, options) {
94
- const outputPromise = this.waitForOutput(output, options);
95
- if (Array.isArray(input)) {
96
- for (const i of input) {
97
- this.sendStdin(i);
98
- }
99
- }
100
- else {
101
- this.sendStdin(input);
102
- }
103
- return outputPromise;
104
- }
105
129
  /**
106
130
  * Waits for the task to exit with a given `statusCode`.
107
131
  *
@@ -182,73 +206,7 @@ class WizardTestEnv {
182
206
  this.taskHandle.unref();
183
207
  }
184
208
  }
185
- exports.WizardTestEnv = WizardTestEnv;
186
- /**
187
- * Initialize a git repository in the given directory
188
- * @param projectDir
189
- */
190
- function initGit(projectDir) {
191
- try {
192
- (0, node_child_process_1.execSync)('git init', { cwd: projectDir });
193
- // Add all files to the git repo
194
- (0, node_child_process_1.execSync)('git add -A', { cwd: projectDir });
195
- // Add author info to avoid git commit error
196
- (0, node_child_process_1.execSync)('git config user.email test@test.sentry.io', { cwd: projectDir });
197
- (0, node_child_process_1.execSync)('git config user.name Test', { cwd: projectDir });
198
- (0, node_child_process_1.execSync)('git commit -m init', { cwd: projectDir });
199
- }
200
- catch (e) {
201
- exports.log.error('Error initializing git');
202
- exports.log.error(e);
203
- }
204
- }
205
- exports.initGit = initGit;
206
- /**
207
- * Cleanup the git repository in the given directory
208
- *
209
- * Caution! Make sure `projectDir` is a test project directory,
210
- * if in doubt, please commit your local non-test changes first!
211
- * @param projectDir
212
- */
213
- function cleanupGit(projectDir) {
214
- try {
215
- // Remove the .git directory
216
- (0, node_child_process_1.execSync)(`rm -rf ${projectDir}/.git`);
217
- }
218
- catch (e) {
219
- exports.log.error('Error cleaning up git');
220
- exports.log.error(e);
221
- }
222
- }
223
- exports.cleanupGit = cleanupGit;
224
- /**
225
- * Revert local changes in the given directory
226
- *
227
- * Caution! Make sure `projectDir` is a test project directory,
228
- * if in doubt, please commit your local non-test changes first!
229
- *
230
- * @param projectDir
231
- */
232
- function revertLocalChanges(projectDir) {
233
- try {
234
- // Check if this is a git repository first
235
- const isGitRepo = fs.existsSync(path.join(projectDir, '.git'));
236
- if (isGitRepo) {
237
- // Revert tracked files
238
- (0, node_child_process_1.execSync)('git restore .', { cwd: projectDir });
239
- // Revert untracked files
240
- (0, node_child_process_1.execSync)('git clean -fd .', { cwd: projectDir });
241
- }
242
- // Remove node_modules and dist (.gitignore'd and therefore not removed via git clean)
243
- (0, node_child_process_1.execSync)('rm -rf node_modules', { cwd: projectDir });
244
- (0, node_child_process_1.execSync)('rm -rf dist', { cwd: projectDir });
245
- }
246
- catch (e) {
247
- exports.log.error('Error reverting local changes');
248
- exports.log.error(e);
249
- }
250
- }
251
- exports.revertLocalChanges = revertLocalChanges;
209
+ exports.ProcessRunner = ProcessRunner;
252
210
  function getWizardCommand(integration) {
253
211
  const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN
254
212
  ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]
@@ -271,33 +229,6 @@ function getWizardCommand(integration) {
271
229
  return `${binPath} ${args.join(' ')}`;
272
230
  }
273
231
  exports.getWizardCommand = getWizardCommand;
274
- /**
275
- * Start the wizard instance with the given integration and project directory
276
- * @param integration
277
- * @param projectDir
278
- *
279
- * @returns WizardTestEnv
280
- */
281
- function startWizardInstance(integration, projectDir, debug = false, spotlight = false) {
282
- const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN
283
- ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]
284
- : ['dist', 'bin.js'];
285
- const binPath = path.join(__dirname, '..', '..', ...binName);
286
- revertLocalChanges(projectDir);
287
- cleanupGit(projectDir);
288
- initGit(projectDir);
289
- const args = ['--debug', '-i', integration];
290
- if (spotlight) {
291
- // Spotlight mode: skip authentication
292
- args.push('--spotlight');
293
- }
294
- else {
295
- args.push('--preSelectedProject.authToken', exports.TEST_ARGS.AUTH_TOKEN, '--preSelectedProject.dsn', exports.TEST_ARGS.PROJECT_DSN, '--preSelectedProject.orgSlug', exports.TEST_ARGS.ORG_SLUG, '--preSelectedProject.projectSlug', exports.TEST_ARGS.PROJECT_SLUG);
296
- }
297
- args.push('--disable-telemetry');
298
- return new WizardTestEnv(binPath, args, { cwd: projectDir, debug });
299
- }
300
- exports.startWizardInstance = startWizardInstance;
301
232
  /**
302
233
  * Create a file with the given content
303
234
  *
@@ -371,54 +302,17 @@ function checkFileDoesNotExist(filePath) {
371
302
  }
372
303
  exports.checkFileDoesNotExist = checkFileDoesNotExist;
373
304
  /**
374
- * Map integration to its corresponding Sentry package name
375
- * @param type Integration type
376
- * @returns Package name or undefined if no package exists
377
- */
378
- function mapIntegrationToPackageName(type) {
379
- switch (type) {
380
- case Constants_1.Integration.android:
381
- return undefined; // Android doesn't have a JavaScript package
382
- case Constants_1.Integration.reactNative:
383
- return '@sentry/react-native';
384
- case Constants_1.Integration.flutter:
385
- return undefined; // Flutter doesn't have a JavaScript package
386
- case Constants_1.Integration.cordova:
387
- return '@sentry/cordova';
388
- case Constants_1.Integration.angular:
389
- return '@sentry/angular';
390
- case Constants_1.Integration.electron:
391
- return '@sentry/electron';
392
- case Constants_1.Integration.nextjs:
393
- return '@sentry/nextjs';
394
- case Constants_1.Integration.nuxt:
395
- return '@sentry/nuxt';
396
- case Constants_1.Integration.remix:
397
- return '@sentry/remix';
398
- case Constants_1.Integration.reactRouter:
399
- return '@sentry/react-router';
400
- case Constants_1.Integration.sveltekit:
401
- return '@sentry/sveltekit';
402
- case Constants_1.Integration.sourcemaps:
403
- return undefined; // Sourcemaps doesn't install a package
404
- case Constants_1.Integration.ios:
405
- return undefined; // iOS doesn't have a JavaScript package
406
- default:
407
- return undefined;
408
- }
409
- }
410
- /**
411
- * Check if the package.json contains the given integration
305
+ * Check if the package.json lists the given package as a dependency or dev dependency
412
306
  *
413
307
  * @param projectDir
414
308
  * @param integration
415
309
  */
416
- function checkPackageJson(projectDir, integration) {
417
- const packageName = mapIntegrationToPackageName(integration);
418
- if (!packageName) {
419
- throw new Error(`No package name found for integration: ${integration}`);
420
- }
421
- checkFileContents(`${projectDir}/package.json`, packageName);
310
+ function checkPackageJson(projectDir, packageName, devDependency = false) {
311
+ const packageJson = fs.readFileSync(`${projectDir}/package.json`, 'utf-8');
312
+ const packageJsonObject = JSON.parse(packageJson);
313
+ const packageVersion = packageJsonObject.dependencies?.[packageName] ||
314
+ (devDependency && packageJsonObject.devDependencies?.[packageName]);
315
+ (0, vitest_1.expect)(packageVersion).toBeTruthy();
422
316
  }
423
317
  exports.checkPackageJson = checkPackageJson;
424
318
  /**
@@ -452,10 +346,10 @@ exports.checkSentryProperties = checkSentryProperties;
452
346
  * @param projectDir
453
347
  */
454
348
  async function checkIfBuilds(projectDir) {
455
- const testEnv = new WizardTestEnv('npm', ['run', 'build'], {
349
+ const npmRunner = new ProcessRunner('npm', ['run', 'build'], {
456
350
  cwd: projectDir,
457
351
  });
458
- const builtSuccessfully = await testEnv.waitForStatusCode(0, {
352
+ const builtSuccessfully = await npmRunner.waitForStatusCode(0, {
459
353
  timeout: 120000,
460
354
  });
461
355
  (0, vitest_1.expect)(builtSuccessfully).toBe(true);
@@ -467,10 +361,10 @@ exports.checkIfBuilds = checkIfBuilds;
467
361
  * @param projectDir
468
362
  */
469
363
  async function checkIfLints(projectDir) {
470
- const testEnv = new WizardTestEnv('npm', ['run', 'lint'], {
364
+ const npmRunner = new ProcessRunner('npm', ['run', 'lint'], {
471
365
  cwd: projectDir,
472
366
  });
473
- const lintedSuccessfully = await testEnv.waitForStatusCode(0, {
367
+ const lintedSuccessfully = await npmRunner.waitForStatusCode(0, {
474
368
  timeout: 120000,
475
369
  });
476
370
  (0, vitest_1.expect)(lintedSuccessfully).toBe(true);
@@ -481,11 +375,11 @@ exports.checkIfLints = checkIfLints;
481
375
  * @param projectDir
482
376
  */
483
377
  async function checkIfFlutterBuilds(projectDir, expectedOutput, debug = false) {
484
- const testEnv = new WizardTestEnv('flutter', ['build', 'web'], {
378
+ const flutterRunner = new ProcessRunner('flutter', ['build', 'web'], {
485
379
  cwd: projectDir,
486
380
  debug: debug,
487
381
  });
488
- const outputReceived = await testEnv.waitForOutput(expectedOutput, {
382
+ const outputReceived = await flutterRunner.waitForOutput(expectedOutput, {
489
383
  timeout: 120000,
490
384
  });
491
385
  (0, vitest_1.expect)(outputReceived).toBe(true);
@@ -526,14 +420,14 @@ async function checkIfReactNativeBundles(projectDir, platform, debug = false) {
526
420
  '--assets-dest',
527
421
  assetsDest,
528
422
  ];
529
- const testEnv = new WizardTestEnv('npx', bundleCommandArgs, {
423
+ const npxRunner = new ProcessRunner('npx', bundleCommandArgs, {
530
424
  cwd: projectDir,
531
425
  debug: debug,
532
426
  });
533
- const builtSuccessfully = await testEnv.waitForStatusCode(0, {
427
+ const builtSuccessfully = await npxRunner.waitForStatusCode(0, {
534
428
  timeout: 300000,
535
429
  });
536
- testEnv.kill();
430
+ npxRunner.kill();
537
431
  return builtSuccessfully;
538
432
  }
539
433
  exports.checkIfReactNativeBundles = checkIfReactNativeBundles;
@@ -545,20 +439,15 @@ exports.checkIfReactNativeBundles = checkIfReactNativeBundles;
545
439
  * @param debug runs the command in debug mode if true
546
440
  */
547
441
  async function checkIfExpoBundles(projectDir, platform, debug = false) {
548
- const exportCommandArgs = [
549
- 'expo',
550
- 'export',
551
- '--platform',
552
- platform,
553
- ];
554
- const testEnv = new WizardTestEnv('npx', exportCommandArgs, {
442
+ const exportCommandArgs = ['expo', 'export', '--platform', platform];
443
+ const npxRunner = new ProcessRunner('npx', exportCommandArgs, {
555
444
  cwd: projectDir,
556
445
  debug: debug,
557
446
  });
558
- const builtSuccessfully = await testEnv.waitForStatusCode(0, {
447
+ const builtSuccessfully = await npxRunner.waitForStatusCode(0, {
559
448
  timeout: 300000,
560
449
  });
561
- testEnv.kill();
450
+ npxRunner.kill();
562
451
  return builtSuccessfully;
563
452
  }
564
453
  exports.checkIfExpoBundles = checkIfExpoBundles;
@@ -568,11 +457,13 @@ exports.checkIfExpoBundles = checkIfExpoBundles;
568
457
  * @param expectedOutput
569
458
  */
570
459
  async function checkIfRunsOnDevMode(projectDir, expectedOutput) {
571
- const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });
572
- (0, vitest_1.expect)(await testEnv.waitForOutput(expectedOutput, {
460
+ const npmRunner = new ProcessRunner('npm', ['run', 'dev'], {
461
+ cwd: projectDir,
462
+ });
463
+ (0, vitest_1.expect)(await npmRunner.waitForOutput(expectedOutput, {
573
464
  timeout: 120000,
574
465
  })).toBe(true);
575
- testEnv.kill();
466
+ npmRunner.kill();
576
467
  }
577
468
  exports.checkIfRunsOnDevMode = checkIfRunsOnDevMode;
578
469
  /**
@@ -581,13 +472,32 @@ exports.checkIfRunsOnDevMode = checkIfRunsOnDevMode;
581
472
  * @param expectedOutput
582
473
  */
583
474
  async function checkIfRunsOnProdMode(projectDir, expectedOutput, startCommand = 'start') {
584
- const testEnv = new WizardTestEnv('npm', ['run', startCommand], {
475
+ const npmRunner = new ProcessRunner('npm', ['run', startCommand], {
585
476
  cwd: projectDir,
586
477
  });
587
- (0, vitest_1.expect)(await testEnv.waitForOutput(expectedOutput, {
478
+ (0, vitest_1.expect)(await npmRunner.waitForOutput(expectedOutput, {
588
479
  timeout: 120000,
589
480
  })).toBe(true);
590
- testEnv.kill();
481
+ npmRunner.kill();
591
482
  }
592
483
  exports.checkIfRunsOnProdMode = checkIfRunsOnProdMode;
484
+ /**
485
+ * Initialize a git repository in the given directory
486
+ * @param projectDir
487
+ */
488
+ function initGit(projectDir) {
489
+ try {
490
+ (0, node_child_process_1.execSync)('git init', { cwd: projectDir });
491
+ // Add all files to the git repo
492
+ (0, node_child_process_1.execSync)('git add -A', { cwd: projectDir });
493
+ // Add author info to avoid git commit error
494
+ (0, node_child_process_1.execSync)('git config user.email test@test.sentry.io', { cwd: projectDir });
495
+ (0, node_child_process_1.execSync)('git config user.name Test', { cwd: projectDir });
496
+ (0, node_child_process_1.execSync)('git commit -m init', { cwd: projectDir });
497
+ }
498
+ catch (e) {
499
+ exports.log.error('Error initializing git');
500
+ exports.log.error(e);
501
+ }
502
+ }
593
503
  //# sourceMappingURL=index.js.map