@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
@@ -23,81 +23,74 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const path = __importStar(require("node:path"));
27
26
  const fs = __importStar(require("node:fs"));
28
27
  const Constants_1 = require("../../lib/Constants");
29
28
  const utils_1 = require("../utils");
30
29
  const utils_2 = require("../utils");
31
- const utils_3 = require("../utils");
32
30
  const vitest_1 = require("vitest");
31
+ //@ts-expect-error - clifty is ESM only
32
+ const clifty_1 = require("clifty");
33
33
  (0, vitest_1.describe)('NextJS-15', () => {
34
34
  const integration = Constants_1.Integration.nextjs;
35
- const projectDir = path.resolve(__dirname, '../test-applications/nextjs-15-test-app');
35
+ let wizardExitCode;
36
+ const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('nextjs-15-test-app');
36
37
  (0, vitest_1.beforeAll)(async () => {
37
- const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
38
- const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
39
- const routeThroughNextJsPrompted = packageManagerPrompted &&
40
- (await wizardInstance.sendStdinAndWaitForOutput(
41
- // Selecting `yarn` as the package manager
42
- [utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Do you want to route Sentry requests in the browser through your Next.js server', {
43
- timeout: 240000,
44
- }));
45
- const tracingOptionPrompted = routeThroughNextJsPrompted &&
46
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
47
- // "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
48
- 'to track the performance of your application?'));
49
- const replayOptionPrompted = tracingOptionPrompted &&
50
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
51
- // "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
52
- 'to get a video-like reproduction of errors during a user session?'));
53
- const logOptionPrompted = replayOptionPrompted &&
54
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
55
- // "Do you want to enable Logs", sometimes doesn't work as `Logs` can be printed in bold.
56
- 'to send your application logs to Sentry?'));
57
- const examplePagePrompted = logOptionPrompted &&
58
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to create an example page', {
59
- optional: true,
60
- }));
61
- const ciCdPrompted = examplePagePrompted &&
62
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Are you using a CI/CD tool'));
63
- // Selecting `No` for CI/CD tool
64
- const mcpPrompted = ciCdPrompted &&
65
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?', { optional: true }));
66
- // Accept MCP config (default is now Yes)
67
- const editorPrompted = mcpPrompted &&
68
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Which editor do you want to configure?'));
69
- // Select Cursor as the editor (first option)
70
- editorPrompted &&
71
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Successfully installed the Sentry Next.js SDK!'));
72
- wizardInstance.kill();
38
+ wizardExitCode = await (0, clifty_1.withEnv)({
39
+ cwd: projectDir,
40
+ })
41
+ .defineInteraction()
42
+ .whenAsked('Please select your package manager.')
43
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Select yarn
44
+ .whenAsked('Do you want to route Sentry requests in the browser through your Next.js server', {
45
+ timeout: 240000, // package installation can take a while in CI
46
+ })
47
+ .respondWith(clifty_1.KEYS.ENTER)
48
+ .whenAsked('to track the performance of your application?')
49
+ .respondWith(clifty_1.KEYS.ENTER)
50
+ .whenAsked('to get a video-like reproduction of errors during a user session?')
51
+ .respondWith(clifty_1.KEYS.ENTER)
52
+ .whenAsked('to send your application logs to Sentry?')
53
+ .respondWith(clifty_1.KEYS.ENTER)
54
+ .whenAsked('Do you want to create an example page')
55
+ .respondWith(clifty_1.KEYS.ENTER)
56
+ .whenAsked('Are you using a CI/CD tool')
57
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Select No
58
+ .whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
59
+ .respondWith(clifty_1.KEYS.ENTER) // Accept MCP config
60
+ .whenAsked('Which editor(s) do you want to configure?')
61
+ .respondWith(clifty_1.KEYS.SPACE, clifty_1.KEYS.ENTER) // Select Cursor
62
+ .expectOutput('Successfully installed the Sentry Next.js SDK!')
63
+ .run((0, utils_2.getWizardCommand)(integration));
73
64
  });
74
65
  (0, vitest_1.afterAll)(() => {
75
- (0, utils_1.revertLocalChanges)(projectDir);
76
- (0, utils_1.cleanupGit)(projectDir);
66
+ cleanup();
67
+ });
68
+ (0, vitest_1.test)('exits with exit code 0', () => {
69
+ (0, vitest_1.expect)(wizardExitCode).toBe(0);
77
70
  });
78
71
  (0, vitest_1.test)('package.json is updated correctly', () => {
79
- (0, utils_3.checkPackageJson)(projectDir, integration);
72
+ (0, utils_2.checkPackageJson)(projectDir, '@sentry/nextjs');
80
73
  });
81
74
  (0, vitest_1.test)('.env-sentry-build-plugin is created and contains the auth token', () => {
82
75
  (0, utils_1.checkEnvBuildPlugin)(projectDir);
83
76
  });
84
77
  (0, vitest_1.test)('example page exists', () => {
85
- (0, utils_3.checkFileExists)(`${projectDir}/src/app/sentry-example-page/page.tsx`);
86
- (0, utils_3.checkFileExists)(`${projectDir}/src/app/api/sentry-example-api/route.ts`);
78
+ (0, utils_2.checkFileExists)(`${projectDir}/src/app/sentry-example-page/page.tsx`);
79
+ (0, utils_2.checkFileExists)(`${projectDir}/src/app/api/sentry-example-api/route.ts`);
87
80
  });
88
81
  (0, vitest_1.test)('config files created', () => {
89
- (0, utils_3.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
90
- (0, utils_3.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
82
+ (0, utils_2.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
83
+ (0, utils_2.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
91
84
  });
92
85
  (0, vitest_1.test)('global error file exists', () => {
93
- (0, utils_3.checkFileExists)(`${projectDir}/src/app/global-error.tsx`);
86
+ (0, utils_2.checkFileExists)(`${projectDir}/src/app/global-error.tsx`);
94
87
  });
95
88
  (0, vitest_1.test)('instrumentation files exists', () => {
96
- (0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation.ts`);
97
- (0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation-client.ts`);
89
+ (0, utils_2.checkFileExists)(`${projectDir}/src/instrumentation.ts`);
90
+ (0, utils_2.checkFileExists)(`${projectDir}/src/instrumentation-client.ts`);
98
91
  });
99
92
  (0, vitest_1.test)('instrumentation file contains Sentry initialization', () => {
100
- (0, utils_3.checkFileContents)(`${projectDir}/src/instrumentation.ts`, [
93
+ (0, utils_2.checkFileContents)(`${projectDir}/src/instrumentation.ts`, [
101
94
  'import * as Sentry from "@sentry/nextjs";',
102
95
  `export async function register() {
103
96
  if (process.env.NEXT_RUNTIME === "nodejs") {
@@ -113,70 +106,67 @@ export const onRequestError = Sentry.captureRequestError;`,
113
106
  ]);
114
107
  });
115
108
  (0, vitest_1.test)('next.config file contains Sentry wrapper', () => {
116
- (0, utils_3.checkFileContents)(`${projectDir}/next.config.ts`, [
109
+ (0, utils_2.checkFileContents)(`${projectDir}/next.config.ts`, [
117
110
  'import { withSentryConfig } from "@sentry/nextjs"',
118
111
  'export default withSentryConfig(nextConfig, {',
119
112
  ]);
120
113
  });
121
114
  (0, vitest_1.test)('runs on dev mode correctly', async () => {
122
- await (0, utils_3.checkIfRunsOnDevMode)(projectDir, 'Ready in');
115
+ await (0, utils_2.checkIfRunsOnDevMode)(projectDir, 'Ready in');
123
116
  });
124
117
  (0, vitest_1.test)('builds correctly', async () => {
125
- await (0, utils_3.checkIfBuilds)(projectDir);
118
+ await (0, utils_2.checkIfBuilds)(projectDir);
126
119
  });
127
120
  (0, vitest_1.test)('runs on prod mode correctly', async () => {
128
- await (0, utils_3.checkIfRunsOnProdMode)(projectDir, 'Ready in');
121
+ await (0, utils_2.checkIfRunsOnProdMode)(projectDir, 'Ready in');
129
122
  });
130
123
  (0, vitest_1.test)('MCP configuration file is created for Cursor', () => {
131
- (0, utils_3.checkFileExists)(`${projectDir}/.cursor/mcp.json`);
132
- (0, utils_3.checkFileContents)(`${projectDir}/.cursor/mcp.json`, [
124
+ (0, utils_2.checkFileExists)(`${projectDir}/.cursor/mcp.json`);
125
+ (0, utils_2.checkFileContents)(`${projectDir}/.cursor/mcp.json`, [
133
126
  '"mcpServers"',
134
127
  '"Sentry"',
135
- '"url": "https://mcp.sentry.dev/mcp/sentry-javascript-sdks/sentry-wizard-e2e-tests"',
128
+ `"url": "https://mcp.sentry.dev/mcp/${utils_1.TEST_ARGS.ORG_SLUG}/${utils_1.TEST_ARGS.PROJECT_SLUG}"`,
136
129
  ]);
137
130
  });
138
131
  });
139
132
  (0, vitest_1.describe)('NextJS-15 Spotlight', () => {
140
133
  const integration = Constants_1.Integration.nextjs;
141
- const projectDir = path.resolve(__dirname, '../test-applications/nextjs-15-test-app');
134
+ let wizardExitCode;
135
+ const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('nextjs-15-test-app');
142
136
  (0, vitest_1.beforeAll)(async () => {
143
- // Clean up any previous test artifacts including ignored files like .env.sentry-build-plugin
144
- (0, utils_1.revertLocalChanges)(projectDir);
145
- (0, utils_1.cleanupGit)(projectDir);
146
- // Explicitly remove .env.sentry-build-plugin if it exists
147
- const envBuildPluginPath = path.join(projectDir, '.env.sentry-build-plugin');
148
- if (fs.existsSync(envBuildPluginPath)) {
149
- fs.unlinkSync(envBuildPluginPath);
150
- }
151
- const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir, false, true);
152
- const spotlightModePrompted = await wizardInstance.waitForOutput('Spotlight mode enabled!');
153
- const packageManagerPrompted = spotlightModePrompted &&
154
- (await wizardInstance.waitForOutput('Please select your package manager.'));
155
- const routeThroughNextJsPrompted = packageManagerPrompted &&
156
- (await wizardInstance.sendStdinAndWaitForOutput(
157
- // Selecting `yarn` as the package manager
158
- [utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Do you want to route Sentry requests in the browser through your Next.js server', {
159
- timeout: 240000,
160
- }));
161
- const tracingOptionPrompted = routeThroughNextJsPrompted &&
162
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'to track the performance of your application?'));
163
- const replayOptionPrompted = tracingOptionPrompted &&
164
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'to get a video-like reproduction of errors during a user session?'));
165
- const logOptionPrompted = replayOptionPrompted &&
166
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'to send your application logs to Sentry?'));
167
- // Skip example page creation
168
- logOptionPrompted &&
169
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Successfully installed the Sentry Next.js SDK!', {
170
- optional: true,
171
- }));
172
- wizardInstance.kill();
137
+ wizardExitCode = await (0, clifty_1.withEnv)({
138
+ cwd: projectDir,
139
+ })
140
+ .defineInteraction()
141
+ .expectOutput('Spotlight mode enabled!')
142
+ .whenAsked('Please select your package manager.')
143
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Select yarn
144
+ .expectOutput('Installing @sentry/nextjs')
145
+ .whenAsked('Do you want to route Sentry requests in the browser through your Next.js server', {
146
+ timeout: 240000, // package installation can take a while in CI
147
+ })
148
+ .respondWith(clifty_1.KEYS.ENTER)
149
+ .whenAsked('to track the performance of your application?')
150
+ .respondWith(clifty_1.KEYS.ENTER)
151
+ .whenAsked('to get a video-like reproduction of errors during a user session?')
152
+ .respondWith(clifty_1.KEYS.ENTER)
153
+ .whenAsked('to send your application logs to Sentry?')
154
+ .respondWith(clifty_1.KEYS.ENTER)
155
+ .whenAsked('Do you want to create an example page')
156
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Skip example page
157
+ .whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
158
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Decline MCP config
159
+ .expectOutput('Successfully installed the Sentry Next.js SDK!')
160
+ .run(`${(0, utils_2.getWizardCommand)(integration)} --spotlight`);
173
161
  });
174
162
  (0, vitest_1.afterAll)(() => {
175
- (0, utils_1.revertLocalChanges)(projectDir);
176
- (0, utils_1.cleanupGit)(projectDir);
163
+ cleanup();
164
+ });
165
+ (0, vitest_1.test)('exits with exit code 0', () => {
166
+ (0, vitest_1.expect)(wizardExitCode).toBe(0);
177
167
  });
178
168
  (0, vitest_1.test)('package.json is updated correctly', () => {
179
- (0, utils_3.checkPackageJson)(projectDir, integration);
169
+ (0, utils_2.checkPackageJson)(projectDir, '@sentry/nextjs');
180
170
  });
181
171
  (0, vitest_1.test)('.env-sentry-build-plugin should NOT exist in spotlight mode', () => {
182
172
  const envFilePath = `${projectDir}/.env.sentry-build-plugin`;
@@ -185,33 +175,33 @@ export const onRequestError = Sentry.captureRequestError;`,
185
175
  (0, vitest_1.expect)(fs.existsSync(envFilePath)).toBe(false);
186
176
  });
187
177
  (0, vitest_1.test)('config files created', () => {
188
- (0, utils_3.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
189
- (0, utils_3.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
178
+ (0, utils_2.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
179
+ (0, utils_2.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
190
180
  });
191
181
  (0, vitest_1.test)('server config file contains empty DSN and spotlight flag', () => {
192
- (0, utils_3.checkFileContents)(`${projectDir}/sentry.server.config.ts`, [
182
+ (0, utils_2.checkFileContents)(`${projectDir}/sentry.server.config.ts`, [
193
183
  'dsn: ""',
194
184
  'spotlight: true',
195
185
  ]);
196
186
  });
197
187
  (0, vitest_1.test)('edge config file contains empty DSN and spotlight flag', () => {
198
- (0, utils_3.checkFileContents)(`${projectDir}/sentry.edge.config.ts`, [
188
+ (0, utils_2.checkFileContents)(`${projectDir}/sentry.edge.config.ts`, [
199
189
  'dsn: ""',
200
190
  'spotlight: true',
201
191
  ]);
202
192
  });
203
193
  (0, vitest_1.test)('instrumentation client file contains empty DSN and spotlight flag', () => {
204
- (0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation-client.ts`);
205
- (0, utils_3.checkFileContents)(`${projectDir}/src/instrumentation-client.ts`, [
194
+ (0, utils_2.checkFileExists)(`${projectDir}/src/instrumentation-client.ts`);
195
+ (0, utils_2.checkFileContents)(`${projectDir}/src/instrumentation-client.ts`, [
206
196
  'dsn: ""',
207
197
  'spotlight: true',
208
198
  ]);
209
199
  });
210
200
  (0, vitest_1.test)('builds correctly', async () => {
211
- await (0, utils_3.checkIfBuilds)(projectDir);
201
+ await (0, utils_2.checkIfBuilds)(projectDir);
212
202
  });
213
203
  (0, vitest_1.test)('runs on dev mode correctly', async () => {
214
- await (0, utils_3.checkIfRunsOnDevMode)(projectDir, 'Ready in');
204
+ await (0, utils_2.checkIfRunsOnDevMode)(projectDir, 'Ready in');
215
205
  });
216
206
  });
217
207
  //# sourceMappingURL=nextjs-15.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nextjs-15.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-15.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,4CAA8B;AAC9B,mDAAkD;AAClD,oCAMkB;AAClB,oCAA+C;AAC/C,oCAOkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,yCAAyC,CAC1C,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,qCAAqC,CACtC,CAAC;QAEF,MAAM,0BAA0B,GAC9B,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,0CAA0C;YAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC,EACvB,iFAAiF,EACjF;gBACE,OAAO,EAAE,MAAO;aACjB,CACF,CAAC,CAAC;QAEL,MAAM,qBAAqB,GACzB,0BAA0B;YAC1B,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC;YACZ,+FAA+F;YAC/F,+CAA+C,CAChD,CAAC,CAAC;QAEL,MAAM,oBAAoB,GACxB,qBAAqB;YACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC;YACZ,2HAA2H;YAC3H,mEAAmE,CACpE,CAAC,CAAC;QAEL,MAAM,i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AAgC,EAAE;YAC/D,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,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 KEYS,\n checkEnvBuildPlugin,\n checkFileDoesNotExist,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\nimport { describe, beforeAll, afterAll, test, expect } from 'vitest';\n\ndescribe('NextJS-15', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-15-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n const examplePagePrompted =\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n // Selecting `No` for CI/CD tool\n const mcpPrompted =\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n { optional: true },\n ));\n\n // Accept MCP config (default is now Yes)\n const editorPrompted =\n mcpPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Which editor do you want to configure?',\n ));\n\n // Select Cursor as the editor (first option)\n editorPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation files exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n 'import * as Sentry from \"@sentry/nextjs\";',\n `export async function register() {\n if (process.env.NEXT_RUNTIME === \"nodejs\") {\n await import(\"../sentry.server.config\");\n }\n\n if (process.env.NEXT_RUNTIME === \"edge\") {\n await import(\"../sentry.edge.config\");\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.ts`, [\n 'import { withSentryConfig } from \"@sentry/nextjs\"',\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n\n test('MCP configuration file is created for Cursor', () => {\n checkFileExists(`${projectDir}/.cursor/mcp.json`);\n checkFileContents(`${projectDir}/.cursor/mcp.json`, [\n '\"mcpServers\"',\n '\"Sentry\"',\n '\"url\": \"https://mcp.sentry.dev/mcp/sentry-javascript-sdks/sentry-wizard-e2e-tests\"',\n ]);\n });\n});\n\ndescribe('NextJS-15 Spotlight', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-15-test-app',\n );\n\n beforeAll(async () => {\n // Clean up any previous test artifacts including ignored files like .env.sentry-build-plugin\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n\n // Explicitly remove .env.sentry-build-plugin if it exists\n const envBuildPluginPath = path.join(\n projectDir,\n '.env.sentry-build-plugin',\n );\n if (fs.existsSync(envBuildPluginPath)) {\n fs.unlinkSync(envBuildPluginPath);\n }\n\n const wizardInstance = startWizardInstance(\n integration,\n projectDir,\n false,\n true,\n );\n\n const spotlightModePrompted = await wizardInstance.waitForOutput(\n 'Spotlight mode enabled!',\n );\n\n const packageManagerPrompted =\n spotlightModePrompted &&\n (await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n ));\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'to send your application logs to Sentry?',\n ));\n\n // Skip example page creation\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n {\n optional: true,\n },\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin should NOT exist in spotlight mode', () => {\n const envFilePath = `${projectDir}/.env.sentry-build-plugin`;\n checkFileDoesNotExist(envFilePath);\n // Explicit assertion to satisfy linter\n expect(fs.existsSync(envFilePath)).toBe(false);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('server config file contains empty DSN and spotlight flag', () => {\n checkFileContents(`${projectDir}/sentry.server.config.ts`, [\n 'dsn: \"\"',\n 'spotlight: true',\n ]);\n });\n\n test('edge config file contains empty DSN and spotlight flag', () => {\n checkFileContents(`${projectDir}/sentry.edge.config.ts`, [\n 'dsn: \"\"',\n 'spotlight: true',\n ]);\n });\n\n test('instrumentation client file contains empty DSN and spotlight flag', () => {\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n checkFileContents(`${projectDir}/src/instrumentation-client.ts`, [\n 'dsn: \"\"',\n 'spotlight: true',\n ]);\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n});\n"]}
1
+ {"version":3,"file":"nextjs-15.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-15.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,mDAAkD;AAClD,oCAKkB;AAClB,oCAQkB;AAClB,mCAAqE;AAErE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,IAAI,cAAsB,CAAC;IAE3B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EAAC,oBAAoB,CAAC,CAAC;IAE5E,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,cAAc,GAAG,MAAM,IAAA,gBAAO,EAAC;YAC7B,GAAG,EAAE,UAAU;SAChB,CAAC;aACC,iBAAiB,EAAE;aACnB,SAAS,CAAC,qCAAqC,CAAC;aAChD,WAAW,CAAC,aAAI,C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'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileDoesNotExist,\n createIsolatedTestEnv,\n} from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n getWizardCommand,\n} from '../utils';\nimport { describe, beforeAll, afterAll, test, expect } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('NextJS-15', () => {\n const integration = Integration.nextjs;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv('nextjs-15-test-app');\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .whenAsked('Please select your package manager.')\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Select yarn\n .whenAsked(\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000, // package installation can take a while in CI\n },\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('to track the performance of your application?')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'to get a video-like reproduction of errors during a user session?',\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('to send your application logs to Sentry?')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked('Are you using a CI/CD tool')\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Select No\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.ENTER) // Accept MCP config\n .whenAsked('Which editor(s) do you want to configure?')\n .respondWith(KEYS.SPACE, KEYS.ENTER) // Select Cursor\n .expectOutput('Successfully installed the Sentry Next.js SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n test('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, '@sentry/nextjs');\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation files exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n 'import * as Sentry from \"@sentry/nextjs\";',\n `export async function register() {\n if (process.env.NEXT_RUNTIME === \"nodejs\") {\n await import(\"../sentry.server.config\");\n }\n\n if (process.env.NEXT_RUNTIME === \"edge\") {\n await import(\"../sentry.edge.config\");\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.ts`, [\n 'import { withSentryConfig } from \"@sentry/nextjs\"',\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n\n test('MCP configuration file is created for Cursor', () => {\n checkFileExists(`${projectDir}/.cursor/mcp.json`);\n checkFileContents(`${projectDir}/.cursor/mcp.json`, [\n '\"mcpServers\"',\n '\"Sentry\"',\n `\"url\": \"https://mcp.sentry.dev/mcp/${TEST_ARGS.ORG_SLUG}/${TEST_ARGS.PROJECT_SLUG}\"`,\n ]);\n });\n});\n\ndescribe('NextJS-15 Spotlight', () => {\n const integration = Integration.nextjs;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv('nextjs-15-test-app');\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput('Spotlight mode enabled!')\n .whenAsked('Please select your package manager.')\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Select yarn\n .expectOutput('Installing @sentry/nextjs')\n .whenAsked(\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000, // package installation can take a while in CI\n },\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('to track the performance of your application?')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'to get a video-like reproduction of errors during a user session?',\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('to send your application logs to Sentry?')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Skip example page\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Decline MCP config\n .expectOutput('Successfully installed the Sentry Next.js SDK!')\n .run(`${getWizardCommand(integration)} --spotlight`);\n });\n\n afterAll(() => {\n cleanup();\n });\n\n test('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, '@sentry/nextjs');\n });\n\n test('.env-sentry-build-plugin should NOT exist in spotlight mode', () => {\n const envFilePath = `${projectDir}/.env.sentry-build-plugin`;\n checkFileDoesNotExist(envFilePath);\n // Explicit assertion to satisfy linter\n expect(fs.existsSync(envFilePath)).toBe(false);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('server config file contains empty DSN and spotlight flag', () => {\n checkFileContents(`${projectDir}/sentry.server.config.ts`, [\n 'dsn: \"\"',\n 'spotlight: true',\n ]);\n });\n\n test('edge config file contains empty DSN and spotlight flag', () => {\n checkFileContents(`${projectDir}/sentry.edge.config.ts`, [\n 'dsn: \"\"',\n 'spotlight: true',\n ]);\n });\n\n test('instrumentation client file contains empty DSN and spotlight flag', () => {\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n checkFileContents(`${projectDir}/src/instrumentation-client.ts`, [\n 'dsn: \"\"',\n 'spotlight: true',\n ]);\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n});\n"]}
@@ -24,67 +24,70 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("node:fs"));
27
- const path = __importStar(require("node:path"));
28
27
  const Constants_1 = require("../../lib/Constants");
29
28
  const utils_1 = require("../utils");
30
- const utils_2 = require("../utils");
31
- const utils_3 = require("../utils");
32
29
  const vitest_1 = require("vitest");
30
+ //@ts-expect-error - clifty is ESM only
31
+ const clifty_1 = require("clifty");
33
32
  (0, vitest_1.describe)('NextJS-16 with Prettier, Biome, and ESLint', () => {
34
33
  const integration = Constants_1.Integration.nextjs;
35
- const projectDir = path.resolve(__dirname, '../test-applications/nextjs-16-test-app');
34
+ let wizardExitCode;
35
+ const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('nextjs-16-test-app');
36
36
  (0, vitest_1.beforeAll)(async () => {
37
- const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
38
- // Wait for package manager selection and select npm
39
- const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager', {
37
+ wizardExitCode = await (0, clifty_1.withEnv)({
38
+ cwd: projectDir,
39
+ })
40
+ .defineInteraction()
41
+ .whenAsked('Please select your package manager', {
40
42
  timeout: 300000,
41
- });
42
- // Select npm (first option)
43
- const routingPrompted = packageManagerPrompted &&
44
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to route Sentry requests in the browser through your Next.js server', { timeout: 300000 }));
45
- const tracingOptionPrompted = routingPrompted &&
46
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'to track the performance of your application?'));
47
- const replayOptionPrompted = tracingOptionPrompted &&
48
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'to get a video-like reproduction of errors during a user session?'));
49
- const logOptionPrompted = replayOptionPrompted &&
50
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'to send your application logs to Sentry?'));
51
- // Skip example page creation
52
- const ciCdPrompted = logOptionPrompted &&
53
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Are you using a CI/CD tool', {
54
- optional: true,
55
- }));
56
- // Selecting `No` for CI/CD tool
57
- // Should prompt for BOTH Prettier and Biome
58
- const formattersPrompted = ciCdPrompted &&
59
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Looks like you have Prettier and Biome in your project', { optional: true }));
60
- // Accept formatter run (default is Yes)
61
- const mcpPrompted = formattersPrompted &&
62
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?', { optional: true }));
63
- // Skip MCP config
64
- mcpPrompted &&
65
- (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Successfully installed the Sentry Next.js SDK!', { optional: true }));
66
- wizardInstance.kill();
43
+ })
44
+ .respondWith(clifty_1.KEYS.ENTER) // Select npm (first option)
45
+ .expectOutput('Installing @sentry/nextjs')
46
+ .whenAsked('Do you want to route Sentry requests in the browser through your Next.js server', {
47
+ timeout: 300000, // package installation can take a while in CI
48
+ })
49
+ .respondWith(clifty_1.KEYS.ENTER)
50
+ .whenAsked('to track the performance of your application?')
51
+ .respondWith(clifty_1.KEYS.ENTER)
52
+ .whenAsked('to get a video-like reproduction of errors during a user session?')
53
+ .respondWith(clifty_1.KEYS.ENTER)
54
+ .whenAsked('to send your application logs to Sentry?')
55
+ .respondWith(clifty_1.KEYS.ENTER)
56
+ .whenAsked('Do you want to create an example page')
57
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Skip example page
58
+ .whenAsked('Are you using a CI/CD tool')
59
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Select No
60
+ .whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
61
+ .respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Skip MCP config
62
+ .whenAsked('Looks like you have Prettier and Biome in your project')
63
+ .respondWith(clifty_1.KEYS.ENTER) // Accept formatter run
64
+ .expectOutput('Running formatters on your files...')
65
+ .expectOutput('Formatters have processed your files', { timeout: 60000 })
66
+ .expectOutput('Successfully installed the Sentry Next.js SDK!')
67
+ .run((0, utils_1.getWizardCommand)(integration));
67
68
  });
68
69
  (0, vitest_1.afterAll)(() => {
69
- (0, utils_1.revertLocalChanges)(projectDir);
70
- (0, utils_1.cleanupGit)(projectDir);
70
+ cleanup();
71
+ });
72
+ (0, vitest_1.test)('exits with exit code 0', () => {
73
+ (0, vitest_1.expect)(wizardExitCode).toBe(0);
71
74
  });
72
75
  (0, vitest_1.test)('package.json is updated correctly', () => {
73
- (0, utils_3.checkPackageJson)(projectDir, integration);
76
+ (0, utils_1.checkPackageJson)(projectDir, '@sentry/nextjs');
74
77
  });
75
78
  (0, vitest_1.test)('config files created', () => {
76
- (0, utils_3.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
77
- (0, utils_3.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
79
+ (0, utils_1.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
80
+ (0, utils_1.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
78
81
  });
79
82
  (0, vitest_1.test)('global error file exists', () => {
80
- (0, utils_3.checkFileExists)(`${projectDir}/app/global-error.tsx`);
83
+ (0, utils_1.checkFileExists)(`${projectDir}/app/global-error.tsx`);
81
84
  });
82
85
  (0, vitest_1.test)('instrumentation files exist', () => {
83
- (0, utils_3.checkFileExists)(`${projectDir}/instrumentation.ts`);
84
- (0, utils_3.checkFileExists)(`${projectDir}/instrumentation-client.ts`);
86
+ (0, utils_1.checkFileExists)(`${projectDir}/instrumentation.ts`);
87
+ (0, utils_1.checkFileExists)(`${projectDir}/instrumentation-client.ts`);
85
88
  });
86
89
  (0, vitest_1.test)('instrumentation file contains Sentry initialization', () => {
87
- (0, utils_3.checkFileContents)(`${projectDir}/instrumentation.ts`, [
90
+ (0, utils_1.checkFileContents)(`${projectDir}/instrumentation.ts`, [
88
91
  'import * as Sentry from "@sentry/nextjs";',
89
92
  `export async function register() {
90
93
  if (process.env.NEXT_RUNTIME === "nodejs") {
@@ -100,7 +103,7 @@ export const onRequestError = Sentry.captureRequestError;`,
100
103
  ]);
101
104
  });
102
105
  (0, vitest_1.test)('next.config file contains Sentry wrapper', () => {
103
- (0, utils_3.checkFileContents)(`${projectDir}/next.config.ts`, [
106
+ (0, utils_1.checkFileContents)(`${projectDir}/next.config.ts`, [
104
107
  'import { withSentryConfig } from "@sentry/nextjs"',
105
108
  'withSentryConfig(nextConfig, {',
106
109
  ]);
@@ -111,10 +114,10 @@ export const onRequestError = Sentry.captureRequestError;`,
111
114
  (0, vitest_1.expect)(configContent).toMatch(/import\s+{\s+\w+\s+}\s+from/);
112
115
  });
113
116
  (0, vitest_1.test)('builds correctly', async () => {
114
- await (0, utils_3.checkIfBuilds)(projectDir);
117
+ await (0, utils_1.checkIfBuilds)(projectDir);
115
118
  });
116
119
  (0, vitest_1.test)('lints correctly', async () => {
117
- await (0, utils_3.checkIfLints)(projectDir);
120
+ await (0, utils_1.checkIfLints)(projectDir);
118
121
  });
119
122
  });
120
123
  //# sourceMappingURL=nextjs-16.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nextjs-16.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-16.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,mDAAkD;AAClD,oCAAgE;AAChE,oCAA+C;AAC/C,oCAMkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,yCAAyC,CAC1C,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAEpE,oDAAoD;QACpD,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,oCAAoC,EACpC;YACE,OAAO,EAAE,MAAO;SACjB,CACF,CAAC;QAEF,4BAA4B;QAC5B,MAAM,eAAe,GACnB,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,iFAAiF,EACjF,EAAE,OAAO,EAAE,MAAO,EAAE,CACrB,CAAC,CAAC;QAEL,MAAM,qBAAqB,GACzB,eAAe;YACf,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,+CAA+C,CAChD,CAAC,CAAC;QAEL,MAAM,oBAAoB,GACxB,qBAAqB;YACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,mEAAmE,CACpE,CAAC,CAAC;QAEL,MAAM,iBAAiB,G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kB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QACjC,MAAM,IAAA,oBAAY,EAAC,UAAU,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport { KEYS, cleanupGit, revertLocalChanges } from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfLints,\n checkPackageJson,\n} from '../utils';\nimport { describe, beforeAll, afterAll, test, expect } from 'vitest';\n\ndescribe('NextJS-16 with Prettier, Biome, and ESLint', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-16-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n // Wait for package manager selection and select npm\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager',\n {\n timeout: 300_000,\n },\n );\n\n // Select npm (first option)\n const routingPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n { timeout: 300_000 },\n ));\n\n const tracingOptionPrompted =\n routingPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'to send your application logs to Sentry?',\n ));\n\n // Skip example page creation\n const ciCdPrompted =\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Are you using a CI/CD tool',\n {\n optional: true,\n },\n ));\n\n // Selecting `No` for CI/CD tool\n // Should prompt for BOTH Prettier and Biome\n const formattersPrompted =\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Looks like you have Prettier and Biome in your project',\n { optional: true },\n ));\n\n // Accept formatter run (default is Yes)\n const mcpPrompted =\n formattersPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n { optional: true },\n ));\n\n // Skip MCP config\n mcpPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n { optional: true },\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/app/global-error.tsx`);\n });\n\n test('instrumentation files exist', () => {\n checkFileExists(`${projectDir}/instrumentation.ts`);\n checkFileExists(`${projectDir}/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/instrumentation.ts`, [\n 'import * as Sentry from \"@sentry/nextjs\";',\n `export async function register() {\n if (process.env.NEXT_RUNTIME === \"nodejs\") {\n await import(\"./sentry.server.config\");\n }\n\n if (process.env.NEXT_RUNTIME === \"edge\") {\n await import(\"./sentry.edge.config\");\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.ts`, [\n 'import { withSentryConfig } from \"@sentry/nextjs\"',\n 'withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('Generated code has proper import formatting', () => {\n const configContent = fs.readFileSync(\n `${projectDir}/next.config.ts`,\n 'utf-8',\n );\n // Verify proper spacing: import { withSentryConfig } from\n expect(configContent).toMatch(/import\\s+{\\s+\\w+\\s+}\\s+from/);\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('lints correctly', async () => {\n await checkIfLints(projectDir);\n });\n});\n"]}
1
+ {"version":3,"file":"nextjs-16.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-16.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,mDAAkD;AAClD,oCAQkB;AAClB,mCAAqE;AAErE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,IAAI,cAAsB,CAAC;IAE3B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EAAC,oBAAoB,CAAC,CAAC;IAE5E,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,cAAc,GAAG,MAAM,IAAA,gBAAO,EAAC;YAC7B,GAAG,EAAE,UAAU;SAChB,CAAC;aACC,iBAAiB,EAAE;aACnB,SAAS,CAAC,oCAAoC,EAAE;YAC/C,OAAO,EAAE,MAAO;SACjB,CAAC;aACD,WAAW,CAAC,aAAI,CAAC,KAAK,CAAC,CAAC,4BAA4B;aACpD,YAAY,CAAC,2BAA2B,CAAC;aACzC,SAAS,CACR,iFAAiF,EACjF;YACE,OAAO,EAAE,MAAO,EAAE,8CAA8C;SACjE,CACF;aACA,WAAW,CAAC,aAAI,CAAC,KAAK,CAAC;aACvB,SAAS,CAAC,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CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QACjC,MAAM,IAAA,oBAAY,EAAC,UAAU,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfLints,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n} from '../utils';\nimport { describe, beforeAll, afterAll, test, expect } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('NextJS-16 with Prettier, Biome, and ESLint', () => {\n const integration = Integration.nextjs;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv('nextjs-16-test-app');\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .whenAsked('Please select your package manager', {\n timeout: 300_000,\n })\n .respondWith(KEYS.ENTER) // Select npm (first option)\n .expectOutput('Installing @sentry/nextjs')\n .whenAsked(\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 300_000, // package installation can take a while in CI\n },\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('to track the performance of your application?')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'to get a video-like reproduction of errors during a user session?',\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('to send your application logs to Sentry?')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Skip example page\n .whenAsked('Are you using a CI/CD tool')\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Select No\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER) // Skip MCP config\n .whenAsked('Looks like you have Prettier and Biome in your project')\n .respondWith(KEYS.ENTER) // Accept formatter run\n .expectOutput('Running formatters on your files...')\n .expectOutput('Formatters have processed your files', { timeout: 60_000 })\n .expectOutput('Successfully installed the Sentry Next.js SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n test('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, '@sentry/nextjs');\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/app/global-error.tsx`);\n });\n\n test('instrumentation files exist', () => {\n checkFileExists(`${projectDir}/instrumentation.ts`);\n checkFileExists(`${projectDir}/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/instrumentation.ts`, [\n 'import * as Sentry from \"@sentry/nextjs\";',\n `export async function register() {\n if (process.env.NEXT_RUNTIME === \"nodejs\") {\n await import(\"./sentry.server.config\");\n }\n\n if (process.env.NEXT_RUNTIME === \"edge\") {\n await import(\"./sentry.edge.config\");\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.ts`, [\n 'import { withSentryConfig } from \"@sentry/nextjs\"',\n 'withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('Generated code has proper import formatting', () => {\n const configContent = fs.readFileSync(\n `${projectDir}/next.config.ts`,\n 'utf-8',\n );\n // Verify proper spacing: import { withSentryConfig } from\n expect(configContent).toMatch(/import\\s+{\\s+\\w+\\s+}\\s+from/);\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('lints correctly', async () => {\n await checkIfLints(projectDir);\n });\n});\n"]}