@sentry/wizard 4.6.0 → 4.8.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 (218) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +19 -19
  3. package/dist/bin.js +9 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/e2e-tests/tests/angular-17.test.d.ts +1 -0
  6. package/dist/e2e-tests/tests/angular-17.test.js +196 -0
  7. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -0
  8. package/dist/e2e-tests/tests/angular-19.test.d.ts +1 -0
  9. package/dist/e2e-tests/tests/angular-19.test.js +194 -0
  10. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -0
  11. package/dist/e2e-tests/tests/expo.test.d.ts +1 -0
  12. package/dist/e2e-tests/tests/expo.test.js +95 -0
  13. package/dist/e2e-tests/tests/expo.test.js.map +1 -0
  14. package/dist/e2e-tests/tests/flutter.test.js +16 -16
  15. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/help-message.test.d.ts +1 -0
  17. package/dist/e2e-tests/tests/help-message.test.js +56 -0
  18. package/dist/e2e-tests/tests/help-message.test.js.map +1 -0
  19. package/dist/e2e-tests/tests/nextjs-14.test.js +15 -15
  20. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  21. package/dist/e2e-tests/tests/nextjs-15.test.js +15 -15
  22. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  23. package/dist/e2e-tests/tests/nuxt-3.test.js +13 -12
  24. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  25. package/dist/e2e-tests/tests/nuxt-4.test.js +13 -12
  26. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  27. package/dist/e2e-tests/tests/react-native.test.d.ts +1 -0
  28. package/dist/e2e-tests/tests/react-native.test.js +97 -0
  29. package/dist/e2e-tests/tests/react-native.test.js.map +1 -0
  30. package/dist/e2e-tests/tests/remix.test.js +24 -24
  31. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  32. package/dist/e2e-tests/tests/sveltekit.test.js +22 -22
  33. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  34. package/dist/e2e-tests/utils/index.d.ts +7 -0
  35. package/dist/e2e-tests/utils/index.js +33 -12
  36. package/dist/e2e-tests/utils/index.js.map +1 -1
  37. package/dist/lib/Constants.d.ts +6 -1
  38. package/dist/lib/Constants.js +3 -0
  39. package/dist/lib/Constants.js.map +1 -1
  40. package/dist/lib/Helper/Logging.d.ts +1 -1
  41. package/dist/lib/Helper/Logging.js.map +1 -1
  42. package/dist/lib/Helper/__tests__/File.js +9 -9
  43. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  44. package/dist/lib/Helper/__tests__/MergeConfig.js +17 -17
  45. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  46. package/dist/lib/Helper/__tests__/SentryCli.js +23 -22
  47. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  48. package/dist/lib/Setup.d.ts +2 -1
  49. package/dist/lib/Setup.js +12 -2
  50. package/dist/lib/Setup.js.map +1 -1
  51. package/dist/lib/Steps/BaseStep.d.ts +1 -1
  52. package/dist/lib/Steps/BaseStep.js.map +1 -1
  53. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  54. package/dist/lib/Steps/Welcome.js +5 -0
  55. package/dist/lib/Steps/Welcome.js.map +1 -1
  56. package/dist/lib/__tests__/Env.js +4 -3
  57. package/dist/lib/__tests__/Env.js.map +1 -1
  58. package/dist/src/angular/angular-wizard.d.ts +3 -0
  59. package/dist/src/angular/angular-wizard.js +186 -0
  60. package/dist/src/angular/angular-wizard.js.map +1 -0
  61. package/dist/src/angular/codemods/app-config.d.ts +3 -0
  62. package/dist/src/angular/codemods/app-config.js +211 -0
  63. package/dist/src/angular/codemods/app-config.js.map +1 -0
  64. package/dist/src/angular/codemods/main.d.ts +20 -0
  65. package/dist/src/angular/codemods/main.js +62 -0
  66. package/dist/src/angular/codemods/main.js.map +1 -0
  67. package/dist/src/angular/codemods/sourcemaps.d.ts +21 -0
  68. package/dist/src/angular/codemods/sourcemaps.js +94 -0
  69. package/dist/src/angular/codemods/sourcemaps.js.map +1 -0
  70. package/dist/src/angular/example-component.d.ts +8 -0
  71. package/dist/src/angular/example-component.js +286 -0
  72. package/dist/src/angular/example-component.js.map +1 -0
  73. package/dist/src/angular/sdk-setup.d.ts +6 -0
  74. package/dist/src/angular/sdk-setup.js +99 -0
  75. package/dist/src/angular/sdk-setup.js.map +1 -0
  76. package/dist/src/apple/apple-wizard.js +24 -64
  77. package/dist/src/apple/apple-wizard.js.map +1 -1
  78. package/dist/src/apple/configure-package-manager.d.ts +5 -0
  79. package/dist/src/apple/configure-package-manager.js +68 -0
  80. package/dist/src/apple/configure-package-manager.js.map +1 -0
  81. package/dist/src/apple/configure-sentry-cli.d.ts +4 -0
  82. package/dist/src/apple/configure-sentry-cli.js +47 -0
  83. package/dist/src/apple/configure-sentry-cli.js.map +1 -0
  84. package/dist/src/apple/configure-xcode-project.d.ts +8 -0
  85. package/dist/src/apple/configure-xcode-project.js +11 -0
  86. package/dist/src/apple/configure-xcode-project.js.map +1 -0
  87. package/dist/src/apple/inject-code-snippet.d.ts +6 -0
  88. package/dist/src/apple/inject-code-snippet.js +54 -0
  89. package/dist/src/apple/inject-code-snippet.js.map +1 -0
  90. package/dist/src/apple/templates.js +11 -7
  91. package/dist/src/apple/templates.js.map +1 -1
  92. package/dist/src/apple/xcode-manager.js +3 -6
  93. package/dist/src/apple/xcode-manager.js.map +1 -1
  94. package/dist/src/flutter/flutter-wizard.js +10 -2
  95. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  96. package/dist/src/nextjs/nextjs-wizard.js +26 -12
  97. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  98. package/dist/src/nextjs/templates.js +59 -8
  99. package/dist/src/nextjs/templates.js.map +1 -1
  100. package/dist/src/nuxt/templates.js +30 -0
  101. package/dist/src/nuxt/templates.js.map +1 -1
  102. package/dist/src/react-native/expo-metro.js +4 -1
  103. package/dist/src/react-native/expo-metro.js.map +1 -1
  104. package/dist/src/react-native/expo.js +5 -1
  105. package/dist/src/react-native/expo.js.map +1 -1
  106. package/dist/src/react-native/javascript.d.ts +6 -4
  107. package/dist/src/react-native/javascript.js +33 -10
  108. package/dist/src/react-native/javascript.js.map +1 -1
  109. package/dist/src/react-native/metro.js +8 -2
  110. package/dist/src/react-native/metro.js.map +1 -1
  111. package/dist/src/react-native/react-native-wizard.d.ts +4 -0
  112. package/dist/src/react-native/react-native-wizard.js +30 -5
  113. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  114. package/dist/src/react-native/xcode.d.ts +7 -3
  115. package/dist/src/react-native/xcode.js +68 -20
  116. package/dist/src/react-native/xcode.js.map +1 -1
  117. package/dist/src/remix/sdk-example.js +30 -1
  118. package/dist/src/remix/sdk-example.js.map +1 -1
  119. package/dist/src/remix/sdk-setup.js +11 -5
  120. package/dist/src/remix/sdk-setup.js.map +1 -1
  121. package/dist/src/run.d.ts +1 -1
  122. package/dist/src/run.js +7 -2
  123. package/dist/src/run.js.map +1 -1
  124. package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +1 -1
  125. package/dist/src/sourcemaps/sourcemaps-wizard.js +35 -20
  126. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  127. package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
  128. package/dist/src/sourcemaps/tools/angular.js +7 -7
  129. package/dist/src/sourcemaps/tools/angular.js.map +1 -1
  130. package/dist/src/sourcemaps/tools/sentry-cli.d.ts +5 -1
  131. package/dist/src/sourcemaps/tools/sentry-cli.js +6 -3
  132. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  133. package/dist/src/sourcemaps/tools/tsc.js +5 -1
  134. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  135. package/dist/src/sourcemaps/tools/vite.js +4 -1
  136. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  137. package/dist/src/sourcemaps/tools/webpack.js +4 -1
  138. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  139. package/dist/src/sveltekit/sdk-example.js +1 -1
  140. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  141. package/dist/src/sveltekit/sveltekit-wizard.js +2 -2
  142. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  143. package/dist/src/sveltekit/templates.js +28 -1
  144. package/dist/src/sveltekit/templates.js.map +1 -1
  145. package/dist/src/utils/clack/index.d.ts +11 -3
  146. package/dist/src/utils/clack/index.js +12 -4
  147. package/dist/src/utils/clack/index.js.map +1 -1
  148. package/dist/src/utils/package-manager.d.ts +2 -0
  149. package/dist/src/utils/package-manager.js +55 -5
  150. package/dist/src/utils/package-manager.js.map +1 -1
  151. package/dist/src/version.d.ts +1 -1
  152. package/dist/src/version.js +1 -1
  153. package/dist/src/version.js.map +1 -1
  154. package/dist/test/android/code-tools.test.js +13 -12
  155. package/dist/test/android/code-tools.test.js.map +1 -1
  156. package/dist/test/angular/angular-wizard.test.d.ts +1 -0
  157. package/dist/test/angular/angular-wizard.test.js +27 -0
  158. package/dist/test/angular/angular-wizard.test.js.map +1 -0
  159. package/dist/test/angular/codemods/sourcemaps.test.d.ts +1 -0
  160. package/dist/test/angular/codemods/sourcemaps.test.js +237 -0
  161. package/dist/test/angular/codemods/sourcemaps.test.js.map +1 -0
  162. package/dist/test/angular/example-component.test.d.ts +1 -0
  163. package/dist/test/angular/example-component.test.js +105 -0
  164. package/dist/test/angular/example-component.test.js.map +1 -0
  165. package/dist/test/apple/cocoapod.test.js +77 -72
  166. package/dist/test/apple/cocoapod.test.js.map +1 -1
  167. package/dist/test/apple/code-tools.test.js +173 -166
  168. package/dist/test/apple/code-tools.test.js.map +1 -1
  169. package/dist/test/apple/fastfile.test.js +86 -83
  170. package/dist/test/apple/fastfile.test.js.map +1 -1
  171. package/dist/test/apple/templates.test.js +32 -27
  172. package/dist/test/apple/templates.test.js.map +1 -1
  173. package/dist/test/apple/xcode-manager.test.js +182 -183
  174. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  175. package/dist/test/flutter/code-tools.test.js +29 -28
  176. package/dist/test/flutter/code-tools.test.js.map +1 -1
  177. package/dist/test/flutter/templates.test.js +15 -14
  178. package/dist/test/flutter/templates.test.js.map +1 -1
  179. package/dist/test/nextjs/templates.test.js +43 -36
  180. package/dist/test/nextjs/templates.test.js.map +1 -1
  181. package/dist/test/nuxt/templates.test.js +25 -24
  182. package/dist/test/nuxt/templates.test.js.map +1 -1
  183. package/dist/test/react-native/expo-metro.test.js +11 -10
  184. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  185. package/dist/test/react-native/expo.test.js +11 -10
  186. package/dist/test/react-native/expo.test.js.map +1 -1
  187. package/dist/test/react-native/gradle.test.js +27 -26
  188. package/dist/test/react-native/gradle.test.js.map +1 -1
  189. package/dist/test/react-native/javascript.test.js +108 -58
  190. package/dist/test/react-native/javascript.test.js.map +1 -1
  191. package/dist/test/react-native/metro.test.js +178 -64
  192. package/dist/test/react-native/metro.test.js.map +1 -1
  193. package/dist/test/react-native/xcode.test.js +138 -37
  194. package/dist/test/react-native/xcode.test.js.map +1 -1
  195. package/dist/test/remix/client-entry.test.js +18 -17
  196. package/dist/test/remix/client-entry.test.js.map +1 -1
  197. package/dist/test/remix/server-instrumentation.test.js +6 -5
  198. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  199. package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -20
  200. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  201. package/dist/test/sourcemaps/tools/tsc.test.js +13 -14
  202. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  203. package/dist/test/sourcemaps/tools/vite.test.js +13 -14
  204. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  205. package/dist/test/sourcemaps/tools/webpack.test.js +19 -20
  206. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  207. package/dist/test/sveltekit/templates.test.js +13 -12
  208. package/dist/test/sveltekit/templates.test.js.map +1 -1
  209. package/dist/test/utils/ast-utils.test.js +45 -44
  210. package/dist/test/utils/ast-utils.test.js.map +1 -1
  211. package/dist/test/utils/clack/index.test.js +140 -144
  212. package/dist/test/utils/clack/index.test.js.map +1 -1
  213. package/dist/test/utils/package-manager.test.js +8 -7
  214. package/dist/test/utils/package-manager.test.js.map +1 -1
  215. package/package.json +10 -38
  216. package/dist/e2e-tests/jest.config.d.ts +0 -17
  217. package/dist/e2e-tests/jest.config.js +0 -23
  218. package/dist/e2e-tests/jest.config.js.map +0 -1
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // @ts-expect-error - magicast is ESM and TS complains about that. It works though
4
4
  const magicast_1 = require("magicast");
5
5
  const sdk_setup_1 = require("../../src/remix/sdk-setup");
6
- describe('initializeSentryOnEntryClient', () => {
7
- it('should initialize Sentry on client entry with all features enabled', () => {
6
+ const vitest_1 = require("vitest");
7
+ (0, vitest_1.describe)('initializeSentryOnEntryClient', () => {
8
+ (0, vitest_1.it)('should initialize Sentry on client entry with all features enabled', () => {
8
9
  // Empty entry.client.tsx file for testing
9
10
  const originalEntryClientMod = (0, magicast_1.parseModule)('');
10
11
  const dsn = 'https://sentry.io/123';
@@ -13,7 +14,7 @@ describe('initializeSentryOnEntryClient', () => {
13
14
  replay: true,
14
15
  };
15
16
  const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
16
- expect(result.generate().code).toMatchInlineSnapshot(`
17
+ (0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
17
18
  "import { useEffect,} from "react";
18
19
 
19
20
  import {
@@ -21,17 +22,17 @@ describe('initializeSentryOnEntryClient', () => {
21
22
  useMatches,
22
23
  } from "@remix-run/react";
23
24
 
24
- import * as Sentry from "@sentry/remix";
25
+ import { init, replayIntegration, browserTracingIntegration,} from "@sentry/remix";
25
26
 
26
- Sentry.init({
27
+ init({
27
28
  dsn: "https://sentry.io/123",
28
29
  tracesSampleRate: 1,
29
30
 
30
- integrations: [Sentry.browserTracingIntegration({
31
+ integrations: [browserTracingIntegration({
31
32
  useEffect,
32
33
  useLocation,
33
34
  useMatches
34
- }), Sentry.replayIntegration({
35
+ }), replayIntegration({
35
36
  maskAllText: true,
36
37
  blockAllMedia: true
37
38
  })],
@@ -41,7 +42,7 @@ describe('initializeSentryOnEntryClient', () => {
41
42
  })"
42
43
  `);
43
44
  });
44
- it('should initialize Sentry on client entry when performance disabled', () => {
45
+ (0, vitest_1.it)('should initialize Sentry on client entry when performance disabled', () => {
45
46
  // Empty entry.client.tsx file for testing
46
47
  const originalEntryClientMod = (0, magicast_1.parseModule)('');
47
48
  const dsn = 'https://sentry.io/123';
@@ -50,13 +51,13 @@ describe('initializeSentryOnEntryClient', () => {
50
51
  replay: true,
51
52
  };
52
53
  const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
53
- expect(result.generate().code).toMatchInlineSnapshot(`
54
- "import * as Sentry from "@sentry/remix";
54
+ (0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
55
+ "import { init, replayIntegration,} from "@sentry/remix";
55
56
 
56
- Sentry.init({
57
+ init({
57
58
  dsn: "https://sentry.io/123",
58
59
 
59
- integrations: [Sentry.replayIntegration({
60
+ integrations: [replayIntegration({
60
61
  maskAllText: true,
61
62
  blockAllMedia: true
62
63
  })],
@@ -66,7 +67,7 @@ describe('initializeSentryOnEntryClient', () => {
66
67
  })"
67
68
  `);
68
69
  });
69
- it('should initialize Sentry on client entry when replay disabled', () => {
70
+ (0, vitest_1.it)('should initialize Sentry on client entry when replay disabled', () => {
70
71
  // Empty entry.client.tsx file for testing
71
72
  const originalEntryClientMod = (0, magicast_1.parseModule)('');
72
73
  const dsn = 'https://sentry.io/123';
@@ -75,7 +76,7 @@ describe('initializeSentryOnEntryClient', () => {
75
76
  replay: false,
76
77
  };
77
78
  const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
78
- expect(result.generate().code).toMatchInlineSnapshot(`
79
+ (0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
79
80
  "import { useEffect,} from "react";
80
81
 
81
82
  import {
@@ -83,13 +84,13 @@ describe('initializeSentryOnEntryClient', () => {
83
84
  useMatches,
84
85
  } from "@remix-run/react";
85
86
 
86
- import * as Sentry from "@sentry/remix";
87
+ import { init, browserTracingIntegration,} from "@sentry/remix";
87
88
 
88
- Sentry.init({
89
+ init({
89
90
  dsn: "https://sentry.io/123",
90
91
  tracesSampleRate: 1,
91
92
 
92
- integrations: [Sentry.browserTracingIntegration({
93
+ integrations: [browserTracingIntegration({
93
94
  useEffect,
94
95
  useLocation,
95
96
  useMatches
@@ -1 +1 @@
1
- {"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../test/remix/client-entry.test.ts"],"names":[],"mappings":";;AAAA,kFAAkF;AAClF,uCAAuC;AACvC,yDAAiE;AAEjE,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;KAcpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,KAAK;SACd,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;KAoBpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\nimport { updateEntryClientMod } from '../../src/remix/sdk-setup';\n\ndescribe('initializeSentryOnEntryClient', () => {\n it('should initialize Sentry on client entry with all features enabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [Sentry.browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), Sentry.replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when performance disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: false,\n replay: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n integrations: [Sentry.replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when replay disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [Sentry.browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })]\n })\"\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../test/remix/client-entry.test.ts"],"names":[],"mappings":";;AAAA,kFAAkF;AAClF,uCAAuC;AACvC,yDAAiE;AACjE,mCAA8C;AAE9C,IAAA,iBAAQ,EAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,IAAA,WAAE,EAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,IAAA,eAAM,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,IAAA,eAAM,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;KAcpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,KAAK;SACd,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,IAAA,eAAM,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;KAoBpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\nimport { updateEntryClientMod } from '../../src/remix/sdk-setup';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('initializeSentryOnEntryClient', () => {\n it('should initialize Sentry on client entry with all features enabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, replayIntegration, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when performance disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: false,\n replay: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init, replayIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n\n integrations: [replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when replay disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })]\n })\"\n `);\n });\n});\n"]}
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
3
4
  const sdk_setup_1 = require("../../src/remix/sdk-setup");
4
- describe('generateServerInstrumentationFile', () => {
5
- it('should generate server instrumentation file', () => {
5
+ (0, vitest_1.describe)('generateServerInstrumentationFile', () => {
6
+ (0, vitest_1.it)('should generate server instrumentation file', () => {
6
7
  const result = (0, sdk_setup_1.generateServerInstrumentationFile)('https://sentry.io/123', {
7
8
  performance: true,
8
9
  replay: true,
9
10
  });
10
- expect(result.instrumentationFileMod.generate().code)
11
+ (0, vitest_1.expect)(result.instrumentationFileMod.generate().code)
11
12
  .toMatchInlineSnapshot(`
12
13
  "import * as Sentry from "@sentry/remix";
13
14
 
@@ -17,12 +18,12 @@ describe('generateServerInstrumentationFile', () => {
17
18
  })"
18
19
  `);
19
20
  });
20
- it('should generate server instrumentation file when performance is disabled', () => {
21
+ (0, vitest_1.it)('should generate server instrumentation file when performance is disabled', () => {
21
22
  const result = (0, sdk_setup_1.generateServerInstrumentationFile)('https://sentry.io/123', {
22
23
  performance: false,
23
24
  replay: true,
24
25
  });
25
- expect(result.instrumentationFileMod.generate().code)
26
+ (0, vitest_1.expect)(result.instrumentationFileMod.generate().code)
26
27
  .toMatchInlineSnapshot(`
27
28
  "import * as Sentry from "@sentry/remix";
28
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"server-instrumentation.test.js","sourceRoot":"","sources":["../../../test/remix/server-instrumentation.test.ts"],"names":[],"mappings":";;AAAA,yDAA8E;AAE9E,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,IAAA,6CAAiC,EAAC,uBAAuB,EAAE;YACxE,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;aAClD,qBAAqB,CAAC;;;;;;;KAOxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,MAAM,GAAG,IAAA,6CAAiC,EAAC,uBAAuB,EAAE;YACxE,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;aAClD,qBAAqB,CAAC;;;;;;KAMxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { generateServerInstrumentationFile } from '../../src/remix/sdk-setup';\n\ndescribe('generateServerInstrumentationFile', () => {\n it('should generate server instrumentation file', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: true,\n replay: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1\n })\"\n `);\n });\n\n it('should generate server instrumentation file when performance is disabled', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: false,\n replay: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\"\n })\"\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"server-instrumentation.test.js","sourceRoot":"","sources":["../../../test/remix/server-instrumentation.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,yDAA8E;AAE9E,IAAA,iBAAQ,EAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAA,WAAE,EAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,IAAA,6CAAiC,EAAC,uBAAuB,EAAE;YACxE,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;aAClD,qBAAqB,CAAC;;;;;;;KAOxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,MAAM,GAAG,IAAA,6CAAiC,EAAC,uBAAuB,EAAE;YACxE,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;aAClD,qBAAqB,CAAC;;;;;;KAMxB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { generateServerInstrumentationFile } from '../../src/remix/sdk-setup';\n\ndescribe('generateServerInstrumentationFile', () => {\n it('should generate server instrumentation file', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: true,\n replay: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1\n })\"\n `);\n });\n\n it('should generate server instrumentation file when performance is disabled', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: false,\n replay: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\"\n })\"\n `);\n });\n});\n"]}
@@ -27,57 +27,57 @@ const fs = __importStar(require("fs"));
27
27
  const sentry_cli_1 = require("../../../src/sourcemaps/tools/sentry-cli");
28
28
  const packageManagerHelpers = __importStar(require("../../../src/utils/package-manager"));
29
29
  const clack_1 = require("../../../src/utils/clack");
30
- const writeFileSpy = jest
30
+ const vitest_1 = require("vitest");
31
+ const writeFileSpy = vitest_1.vi
31
32
  .spyOn(fs.promises, 'writeFile')
32
33
  .mockImplementation(() => Promise.resolve());
33
- jest.mock('@clack/prompts', () => {
34
+ vitest_1.vi.mock('@clack/prompts', () => {
34
35
  return {
35
36
  log: {
36
- info: jest.fn(),
37
- success: jest.fn(),
37
+ info: vitest_1.vi.fn(),
38
+ success: vitest_1.vi.fn(),
38
39
  },
39
- confirm: jest.fn().mockResolvedValue(true),
40
- isCancel: jest.fn().mockReturnValue(false),
40
+ confirm: vitest_1.vi.fn().mockResolvedValue(true),
41
+ isCancel: vitest_1.vi.fn().mockReturnValue(false),
41
42
  };
42
43
  });
43
44
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
44
- jest.mock('../../../src/utils/clack', () => ({
45
- ...jest.requireActual('../../../src/utils/clack'),
46
- getPackageDotJson: jest.fn().mockResolvedValue({
45
+ vitest_1.vi.mock('../../../src/utils/clack', async () => ({
46
+ ...(await vitest_1.vi.importActual('../../../src/utils/clack')),
47
+ getPackageDotJson: vitest_1.vi.fn().mockResolvedValue({
47
48
  scripts: {
48
49
  build: 'tsc',
49
50
  },
50
51
  version: '1.0.0',
51
52
  }),
52
53
  }));
53
- describe('addSentryCommandToBuildCommand', () => {
54
- afterEach(() => {
55
- jest.clearAllMocks();
54
+ (0, vitest_1.describe)('addSentryCommandToBuildCommand', () => {
55
+ (0, vitest_1.afterEach)(() => {
56
+ vitest_1.vi.clearAllMocks();
56
57
  });
57
- it.each([
58
+ vitest_1.it.each([
58
59
  [
59
60
  packageManagerHelpers.NPM,
60
61
  packageManagerHelpers.PNPM,
61
62
  packageManagerHelpers.YARN_V1,
62
63
  packageManagerHelpers.YARN_V2,
63
64
  packageManagerHelpers.BUN,
65
+ packageManagerHelpers.DENO,
64
66
  ],
65
67
  ])('adds the cli command to the script command (%s)', async (_, pacMan) => {
66
- jest
67
- .spyOn(packageManagerHelpers, '_detectPackageManger')
68
- .mockReturnValue(pacMan);
68
+ vitest_1.vi.spyOn(packageManagerHelpers, '_detectPackageManger').mockReturnValue(pacMan);
69
69
  await (0, sentry_cli_1.addSentryCommandToBuildCommand)();
70
- expect(writeFileSpy).toHaveBeenCalledWith(expect.stringContaining('package.json'), expect.stringContaining(`tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`));
70
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledWith(vitest_1.expect.stringContaining('package.json'), vitest_1.expect.stringContaining(`tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`));
71
71
  });
72
- it('does not add the cli command to the script command if it is already in there', async () => {
73
- jest.mocked(clack_1.getPackageDotJson).mockResolvedValue({
72
+ (0, vitest_1.it)('does not add the cli command to the script command if it is already in there', async () => {
73
+ vitest_1.vi.mocked(clack_1.getPackageDotJson).mockResolvedValue({
74
74
  scripts: {
75
75
  build: 'tsc && sentry:sourcemaps',
76
76
  },
77
77
  version: '1.0.0',
78
78
  });
79
79
  await (0, sentry_cli_1.addSentryCommandToBuildCommand)();
80
- expect(writeFileSpy).not.toHaveBeenCalled();
80
+ (0, vitest_1.expect)(writeFileSpy).not.toHaveBeenCalled();
81
81
  });
82
82
  });
83
83
  //# sourceMappingURL=sentry-cli.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-cli.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/sentry-cli.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,yEAA0F;AAE1F,0FAA4E;AAC5E,oDAA6D;AAC7D,MAAM,YAAY,GAAG,IAAI;KACtB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAE/C,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;SACnB;QACD,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;QAC1C,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;KAC3C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,+DAA+D;AAC/D,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,E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C,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { addSentryCommandToBuildCommand } from '../../../src/sourcemaps/tools/sentry-cli';\n\nimport * as packageManagerHelpers from '../../../src/utils/package-manager';\nimport { getPackageDotJson } from '../../../src/utils/clack';\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve());\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n confirm: jest.fn().mockResolvedValue(true),\n isCancel: jest.fn().mockReturnValue(false),\n };\n});\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-return\njest.mock('../../../src/utils/clack', () => ({\n ...jest.requireActual('../../../src/utils/clack'),\n getPackageDotJson: jest.fn().mockResolvedValue({\n scripts: {\n build: 'tsc',\n },\n version: '1.0.0',\n }),\n}));\n\ndescribe('addSentryCommandToBuildCommand', () => {\n afterEach(() => {\n jest.clearAllMocks();\n });\n it.each([\n [\n packageManagerHelpers.NPM,\n packageManagerHelpers.PNPM,\n packageManagerHelpers.YARN_V1,\n packageManagerHelpers.YARN_V2,\n packageManagerHelpers.BUN,\n ],\n ])('adds the cli command to the script command (%s)', async (_, pacMan) => {\n jest\n .spyOn(packageManagerHelpers, '_detectPackageManger')\n .mockReturnValue(pacMan);\n await addSentryCommandToBuildCommand();\n expect(writeFileSpy).toHaveBeenCalledWith(\n expect.stringContaining('package.json'),\n expect.stringContaining(\n `tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`,\n ),\n );\n });\n\n it('does not add the cli command to the script command if it is already in there', async () => {\n jest.mocked(getPackageDotJson).mockResolvedValue({\n scripts: {\n build: 'tsc && sentry:sourcemaps',\n },\n version: '1.0.0',\n });\n\n await addSentryCommandToBuildCommand();\n\n expect(writeFileSpy).not.toHaveBeenCalled();\n });\n});\n"]}
1
+ {"version":3,"file":"s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AAC,GAAG;YACzB,qBAAqB,CAAC,IAAI;YAC1B,qBAAqB,CAAC,OAAO;YAC7B,qBAAqB,CAAC,OAAO;YAC7B,qBAAqB,CAAC,GAAG;YACzB,qBAAqB,CAAC,IAAI;SAC3B;KACF,CAAC,CAAC,iDAAiD,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;QACxE,WAAE,CAAC,KAAK,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC,eAAe,CACrE,MAAM,CACP,CAAC;QACF,MAAM,IAAA,2CAA8B,GAAE,CAAC;QACvC,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,oBAAoB,CACvC,eAAM,CAAC,gBAAgB,CAAC,cAAc,CAAC,EACvC,eAAM,CAAC,gBAAgB,CACrB,UAAU,MAAM,CAAC,gBAAgB,oBAAoB,CACtD,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;QAC5F,WAAE,CAAC,MAAM,CAAC,yBAAiB,CAAC,CAAC,iBAAiB,CAAC;YAC7C,OAAO,EAAE;gBACP,KAAK,EAAE,0BAA0B;aAClC;YACD,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAEH,MAAM,IAAA,2CAA8B,GAAE,CAAC;QAEvC,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { addSentryCommandToBuildCommand } from '../../../src/sourcemaps/tools/sentry-cli';\n\nimport * as packageManagerHelpers from '../../../src/utils/package-manager';\nimport { getPackageDotJson } from '../../../src/utils/clack';\n\nimport { vi, it, describe, expect, afterEach } from 'vitest';\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve());\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n confirm: vi.fn().mockResolvedValue(true),\n isCancel: vi.fn().mockReturnValue(false),\n };\n});\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-return\nvi.mock('../../../src/utils/clack', async () => ({\n ...(await vi.importActual('../../../src/utils/clack')),\n getPackageDotJson: vi.fn().mockResolvedValue({\n scripts: {\n build: 'tsc',\n },\n version: '1.0.0',\n }),\n}));\n\ndescribe('addSentryCommandToBuildCommand', () => {\n afterEach(() => {\n vi.clearAllMocks();\n });\n it.each([\n [\n packageManagerHelpers.NPM,\n packageManagerHelpers.PNPM,\n packageManagerHelpers.YARN_V1,\n packageManagerHelpers.YARN_V2,\n packageManagerHelpers.BUN,\n packageManagerHelpers.DENO,\n ],\n ])('adds the cli command to the script command (%s)', async (_, pacMan) => {\n vi.spyOn(packageManagerHelpers, '_detectPackageManger').mockReturnValue(\n pacMan,\n );\n await addSentryCommandToBuildCommand();\n expect(writeFileSpy).toHaveBeenCalledWith(\n expect.stringContaining('package.json'),\n expect.stringContaining(\n `tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`,\n ),\n );\n });\n\n it('does not add the cli command to the script command if it is already in there', async () => {\n vi.mocked(getPackageDotJson).mockResolvedValue({\n scripts: {\n build: 'tsc && sentry:sourcemaps',\n },\n version: '1.0.0',\n });\n\n await addSentryCommandToBuildCommand();\n\n expect(writeFileSpy).not.toHaveBeenCalled();\n });\n});\n"]}
@@ -25,30 +25,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs"));
27
27
  const tsc_1 = require("../../../src/sourcemaps/tools/tsc");
28
+ const vitest_1 = require("vitest");
28
29
  function updateFileContent(content) {
29
30
  fileContent = content;
30
31
  }
31
32
  let fileContent = '';
32
- jest.mock('@clack/prompts', () => {
33
+ vitest_1.vi.mock('@clack/prompts', () => {
33
34
  return {
34
35
  log: {
35
- info: jest.fn(),
36
- success: jest.fn(),
36
+ info: vitest_1.vi.fn(),
37
+ success: vitest_1.vi.fn(),
37
38
  },
38
39
  };
39
40
  });
40
- jest
41
- .spyOn(fs.promises, 'readFile')
42
- .mockImplementation(() => Promise.resolve(fileContent));
43
- const writeFileSpy = jest
41
+ vitest_1.vi.spyOn(fs.promises, 'readFile').mockImplementation(() => Promise.resolve(fileContent));
42
+ const writeFileSpy = vitest_1.vi
44
43
  .spyOn(fs.promises, 'writeFile')
45
44
  .mockImplementation(() => Promise.resolve(void 0));
46
- describe('enableSourcemaps', () => {
47
- afterEach(() => {
45
+ (0, vitest_1.describe)('enableSourcemaps', () => {
46
+ (0, vitest_1.afterEach)(() => {
48
47
  fileContent = '';
49
- jest.clearAllMocks();
48
+ vitest_1.vi.clearAllMocks();
50
49
  });
51
- it.each([
50
+ vitest_1.it.each([
52
51
  [
53
52
  'no sourcemaps options',
54
53
  `
@@ -186,10 +185,10 @@ describe('enableSourcemaps', () => {
186
185
  ])('adds the plugin and enables source maps generation (%s)', async (_, originalCode, expectedCode) => {
187
186
  updateFileContent(originalCode);
188
187
  const addedCode = await (0, tsc_1.enableSourcemaps)('');
189
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
188
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
190
189
  const [[, fileContent]] = writeFileSpy.mock.calls;
191
- expect(fileContent).toBe(expectedCode);
192
- expect(addedCode).toBe(true);
190
+ (0, vitest_1.expect)(fileContent).toBe(expectedCode);
191
+ (0, vitest_1.expect)(addedCode).toBe(true);
193
192
  });
194
193
  });
195
194
  //# sourceMappingURL=tsc.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsc.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/tsc.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2DAAqE;AAErE,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CA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EAAE,CAAC,CAAC;QAE7C,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { enableSourcemaps } from '../../../src/sourcemaps/tools/tsc';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n };\n});\n\njest\n .spyOn(fs.promises, 'readFile')\n .mockImplementation(() => Promise.resolve(fileContent));\n\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('enableSourcemaps', () => {\n afterEach(() => {\n fileContent = '';\n jest.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\" // another inline comment\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'a few sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\", // another inline comment\n \"sourceMap\": false,\n \"sourceRoot\": \"/src\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\",\n\n \"inlineSources\": true\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'no compiler options',\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ],\n\n \"compilerOptions\": {\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n }\n}\n`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await enableSourcemaps('');\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
1
+ {"version":3,"file":"tsc.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/tsc.test.ts"],"names":[],"mappings":";;;;;;;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,EACzD,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;QACtC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAEhC,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;QAE7C,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { enableSourcemaps } from '../../../src/sourcemaps/tools/tsc';\n\nimport { vi, it, describe, expect, afterEach } from 'vitest';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n});\n\nvi.spyOn(fs.promises, 'readFile').mockImplementation(() =>\n Promise.resolve(fileContent),\n);\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('enableSourcemaps', () => {\n afterEach(() => {\n fileContent = '';\n vi.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\" // another inline comment\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'a few sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\", // another inline comment\n \"sourceMap\": false,\n \"sourceRoot\": \"/src\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\",\n\n \"inlineSources\": true\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'no compiler options',\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ],\n\n \"compilerOptions\": {\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n }\n}\n`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await enableSourcemaps('');\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
@@ -25,30 +25,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs"));
27
27
  const vite_1 = require("../../../src/sourcemaps/tools/vite");
28
+ const vitest_1 = require("vitest");
28
29
  function updateFileContent(content) {
29
30
  fileContent = content;
30
31
  }
31
32
  let fileContent = '';
32
- jest.mock('@clack/prompts', () => {
33
+ vitest_1.vi.mock('@clack/prompts', () => {
33
34
  return {
34
35
  log: {
35
- info: jest.fn(),
36
- success: jest.fn(),
36
+ info: vitest_1.vi.fn(),
37
+ success: vitest_1.vi.fn(),
37
38
  },
38
39
  };
39
40
  });
40
- jest
41
- .spyOn(fs.promises, 'readFile')
42
- .mockImplementation(() => Promise.resolve(fileContent));
43
- const writeFileSpy = jest
41
+ vitest_1.vi.spyOn(fs.promises, 'readFile').mockImplementation(() => Promise.resolve(fileContent));
42
+ const writeFileSpy = vitest_1.vi
44
43
  .spyOn(fs.promises, 'writeFile')
45
44
  .mockImplementation(() => Promise.resolve(void 0));
46
- describe('addVitePluginToConfig', () => {
47
- afterEach(() => {
45
+ (0, vitest_1.describe)('addVitePluginToConfig', () => {
46
+ (0, vitest_1.afterEach)(() => {
48
47
  fileContent = '';
49
- jest.clearAllMocks();
48
+ vitest_1.vi.clearAllMocks();
50
49
  });
51
- it.each([
50
+ vitest_1.it.each([
52
51
  [
53
52
  'no build options',
54
53
  `
@@ -154,10 +153,10 @@ export default cfg;`,
154
153
  selfHosted: false,
155
154
  url: 'https://sentry.io/',
156
155
  });
157
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
156
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
158
157
  const [[, fileContent]] = writeFileSpy.mock.calls;
159
- expect(fileContent).toBe(expectedCode);
160
- expect(addedCode).toBe(true);
158
+ (0, vitest_1.expect)(fileContent).toBe(expectedCode);
159
+ (0, vitest_1.expect)(addedCode).toBe(true);
161
160
  });
162
161
  });
163
162
  //# sourceMappingURL=vite.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/vite.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,6DAA2E;AAE3E,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;SACnB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI;KACD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;KAC9B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAE1D,MAAM,YAAY,GAAG,IAAI;KACtB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC;QACN;YACE,kBAAkB;YAClB;;;;;;CAML;YACK;;;;;;;;;;GAUH;SACE;QACD;YACE,4BAA4B;YAC5B;;;;;;;;;GASH;YACG;;;;;;;;;;GAUH;SACE;QACD;YACE,0BAA0B;YAC1B;;;;;;;;;KASD;YACC;;;;;;;;;EASJ;SACG;QACD;YACE,kCAAkC;YAClC;;;;;;;;;;;OAWC;YACD;;;;;;;;;;;;oBAYc;SACf;KACF,CAAC,CACA,yDAAyD,EACzD,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;QACtC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAEhC,MAAM,SAAS,GAAG,MAAM,IAAA,4BAAqB,EAAC,EAAE,EAAE;YAChD,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,KAAK;YACjB,GAAG,EAAE,oBAAoB;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { addVitePluginToConfig } from '../../../src/sourcemaps/tools/vite';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n };\n});\n\njest\n .spyOn(fs.promises, 'readFile')\n .mockImplementation(() => Promise.resolve(fileContent));\n\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('addVitePluginToConfig', () => {\n afterEach(() => {\n fileContent = '';\n jest.clearAllMocks();\n });\n\n it.each([\n [\n 'no build options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n})\n`,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true\n }\n})`,\n ],\n [\n 'no build.sourcemap options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n build: {\n test: 1, \n }\n})\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n test: 1,\n sourcemap: true\n }\n})`,\n ],\n [\n 'keep sourcemap: \"hidden\"',\n `\nexport default {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: \"hidden\",\n }\n}\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n sourcemap: \"hidden\",\n }\n}`,\n ],\n [\n 'rewrite sourcemap: false to true',\n `\nconst cfg = {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: false,\n }\n}\n\nexport default cfg;\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nconst cfg = {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true,\n }\n}\n\nexport default cfg;`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await addVitePluginToConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
1
+ {"version":3,"file":"vite.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/vite.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,6DAA2E;AAE3E,mCAA6D;AAE7D,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CACxD,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAC7B,CAAC;AAEF,MAAM,YAAY,GAAG,WAAE;KACpB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,WAAW,GAAG,EAAE,CAAC;QACjB,WAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,WAAE,CAAC,IAAI,CAAC;QACN;YACE,kBAAkB;YAClB;;;;;;CAML;YACK;;;;;;;;;;GAUH;SACE;QACD;YACE,4BAA4B;YAC5B;;;;;;;;;GASH;YACG;;;;;;;;;;GAUH;SACE;QACD;YACE,0BAA0B;YAC1B;;;;;;;;;KASD;YACC;;;;;;;;;EASJ;SACG;QACD;YACE,kCAAkC;YAClC;;;;;;;;;;;OAWC;YACD;;;;;;;;;;;;oBAYc;SACf;KACF,CAAC,CACA,yDAAyD,EACzD,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;QACtC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAEhC,MAAM,SAAS,GAAG,MAAM,IAAA,4BAAqB,EAAC,EAAE,EAAE;YAChD,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,KAAK;YACjB,GAAG,EAAE,oBAAoB;SAC1B,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { addVitePluginToConfig } from '../../../src/sourcemaps/tools/vite';\n\nimport { vi, it, describe, expect, afterEach } from 'vitest';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n});\n\nvi.spyOn(fs.promises, 'readFile').mockImplementation(() =>\n Promise.resolve(fileContent),\n);\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('addVitePluginToConfig', () => {\n afterEach(() => {\n fileContent = '';\n vi.clearAllMocks();\n });\n\n it.each([\n [\n 'no build options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n})\n`,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true\n }\n})`,\n ],\n [\n 'no build.sourcemap options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n build: {\n test: 1, \n }\n})\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n test: 1,\n sourcemap: true\n }\n})`,\n ],\n [\n 'keep sourcemap: \"hidden\"',\n `\nexport default {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: \"hidden\",\n }\n}\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n sourcemap: \"hidden\",\n }\n}`,\n ],\n [\n 'rewrite sourcemap: false to true',\n `\nconst cfg = {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: false,\n }\n}\n\nexport default cfg;\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nconst cfg = {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true,\n }\n}\n\nexport default cfg;`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await addVitePluginToConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
@@ -25,24 +25,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs"));
27
27
  const webpack_1 = require("../../../src/sourcemaps/tools/webpack");
28
+ const vitest_1 = require("vitest");
28
29
  function updateFileContent(content) {
29
30
  fileContent = content;
30
31
  }
31
32
  let fileContent = '';
32
- jest.mock('@clack/prompts', () => {
33
+ vitest_1.vi.mock('@clack/prompts', () => {
33
34
  return {
34
35
  log: {
35
- info: jest.fn(),
36
- success: jest.fn(),
36
+ info: vitest_1.vi.fn(),
37
+ success: vitest_1.vi.fn(),
37
38
  },
38
- select: jest.fn().mockImplementation(() => Promise.resolve(true)),
39
- isCancel: jest.fn().mockReturnValue(false),
39
+ select: vitest_1.vi.fn().mockImplementation(() => Promise.resolve(true)),
40
+ isCancel: vitest_1.vi.fn().mockReturnValue(false),
40
41
  };
41
42
  });
42
- jest
43
- .spyOn(fs.promises, 'readFile')
44
- .mockImplementation(() => Promise.resolve(fileContent));
45
- const writeFileSpy = jest
43
+ vitest_1.vi.spyOn(fs.promises, 'readFile').mockImplementation(() => Promise.resolve(fileContent));
44
+ const writeFileSpy = vitest_1.vi
46
45
  .spyOn(fs.promises, 'writeFile')
47
46
  .mockImplementation(() => Promise.resolve(void 0));
48
47
  const noSourcemapNoPluginsPojo = `module.exports = {
@@ -234,12 +233,12 @@ module.exports = {
234
233
 
235
234
  devtool: "source-map"
236
235
  };`;
237
- describe('modifyWebpackConfig', () => {
238
- afterEach(() => {
236
+ (0, vitest_1.describe)('modifyWebpackConfig', () => {
237
+ (0, vitest_1.afterEach)(() => {
239
238
  fileContent = '';
240
- jest.clearAllMocks();
239
+ vitest_1.vi.clearAllMocks();
241
240
  });
242
- it.each([
241
+ vitest_1.it.each([
243
242
  [
244
243
  'no sourcemap option, no plugins, object',
245
244
  noSourcemapNoPluginsPojo,
@@ -280,12 +279,12 @@ describe('modifyWebpackConfig', () => {
280
279
  selfHosted: false,
281
280
  url: 'https://sentry.io/',
282
281
  });
283
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
282
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
284
283
  const [[, fileContent]] = writeFileSpy.mock.calls;
285
- expect(fileContent).toBe(expectedCode);
286
- expect(addedCode).toBe(true);
284
+ (0, vitest_1.expect)(fileContent).toBe(expectedCode);
285
+ (0, vitest_1.expect)(addedCode).toBe(true);
287
286
  });
288
- it('adds the url parameter to the webpack plugin options if self-hosted', async () => {
287
+ (0, vitest_1.it)('adds the url parameter to the webpack plugin options if self-hosted', async () => {
289
288
  updateFileContent(noSourcemapNoPluginsPojo);
290
289
  const addedCode = await (0, webpack_1.modifyWebpackConfig)('', {
291
290
  authToken: '',
@@ -294,10 +293,10 @@ describe('modifyWebpackConfig', () => {
294
293
  selfHosted: true,
295
294
  url: 'https://santry.io/',
296
295
  });
297
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
296
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
298
297
  const [[, fileContent]] = writeFileSpy.mock.calls;
299
- expect(fileContent).toContain('url: "https://santry.io/"');
300
- expect(addedCode).toBe(true);
298
+ (0, vitest_1.expect)(fileContent).toContain('url: "https://santry.io/"');
299
+ (0, vitest_1.expect)(addedCode).toBe(true);
301
300
  });
302
301
  });
303
302
  //# sourceMappingURL=webpack.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/webpack.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,mEAA4E;AAE5E,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,IAAI,CAAC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CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;IAEF,EAAE,CAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;QACnF,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;QAE5C,MAAM,SAAS,GAAG,MAAM,IAAA,6BAAmB,EAAC,EAAE,EAAE;YAC9C,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,oBAAoB;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { modifyWebpackConfig } from '../../../src/sourcemaps/tools/webpack';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n select: jest.fn().mockImplementation(() => Promise.resolve(true)),\n isCancel: jest.fn().mockReturnValue(false),\n };\n});\n\njest\n .spyOn(fs.promises, 'readFile')\n .mockImplementation(() => Promise.resolve(fileContent));\n\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\nconst noSourcemapNoPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapNoPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};`;\n\nconst noSourcemapsNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapsNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst hiddenSourcemapNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-cheap-source-map\",\n};\n\nmodule.exports = config;\n `;\nconst hiddenSourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst arbitrarySourcemapNoPluginsId = `\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: getSourcemapSetting(),\n};\n\nmodule.exports = config;\n `;\nconst arbitrarySourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapUndefinedPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: undefined,\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapUndefinedPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\nconst noSourcemapPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: [\n new HtmlWebpackPlugin(),\n new MiniCssExtractPlugin(),\n ],\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [new HtmlWebpackPlugin(), new MiniCssExtractPlugin(), sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\ndescribe('modifyWebpackConfig', () => {\n afterEach(() => {\n fileContent = '';\n jest.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemap option, no plugins, object',\n noSourcemapNoPluginsPojo,\n noSourcemapNoPluginsPojoResult,\n ],\n [\n 'no sourcemap option, no plugins, identifier',\n noSourcemapsNoPluginsId,\n noSourcemapsNoPluginsIdResult,\n ],\n [\n 'hidden sourcemap option, no plugins, identifier',\n hiddenSourcemapNoPluginsId,\n hiddenSourcemapNoPluginsIdResult,\n ],\n [\n 'arbitrary sourcemap option, no plugins, identifier',\n arbitrarySourcemapNoPluginsId,\n arbitrarySourcemapNoPluginsIdResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapUndefinedPluginsPojo,\n noSourcemapUndefinedPluginsPojoResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapPluginsPojo,\n noSourcemapPluginsPojoResult,\n ],\n ])(\n 'adds plugin and source maps emission to the webpack config (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n // updateFileContent(originalCode);\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n\n it('adds the url parameter to the webpack plugin options if self-hosted', async () => {\n updateFileContent(noSourcemapNoPluginsPojo);\n\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n url: 'https://santry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toContain('url: \"https://santry.io/\"');\n expect(addedCode).toBe(true);\n });\n});\n"]}
1
+ {"version":3,"file":"webpack.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/webpack.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,u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EH,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;IAEF,IAAA,WAAE,EAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;QACnF,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;QAE5C,MAAM,SAAS,GAAG,MAAM,IAAA,6BAAmB,EAAC,EAAE,EAAE;YAC9C,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,oBAAoB;SAC1B,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC3D,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { modifyWebpackConfig } from '../../../src/sourcemaps/tools/webpack';\n\nimport { vi, it, expect, describe, afterEach } from 'vitest';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n select: vi.fn().mockImplementation(() => Promise.resolve(true)),\n isCancel: vi.fn().mockReturnValue(false),\n };\n});\n\nvi.spyOn(fs.promises, 'readFile').mockImplementation(() =>\n Promise.resolve(fileContent),\n);\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\nconst noSourcemapNoPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapNoPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};`;\n\nconst noSourcemapsNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapsNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst hiddenSourcemapNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-cheap-source-map\",\n};\n\nmodule.exports = config;\n `;\nconst hiddenSourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst arbitrarySourcemapNoPluginsId = `\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: getSourcemapSetting(),\n};\n\nmodule.exports = config;\n `;\nconst arbitrarySourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapUndefinedPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: undefined,\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapUndefinedPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\nconst noSourcemapPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: [\n new HtmlWebpackPlugin(),\n new MiniCssExtractPlugin(),\n ],\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [new HtmlWebpackPlugin(), new MiniCssExtractPlugin(), sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\ndescribe('modifyWebpackConfig', () => {\n afterEach(() => {\n fileContent = '';\n vi.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemap option, no plugins, object',\n noSourcemapNoPluginsPojo,\n noSourcemapNoPluginsPojoResult,\n ],\n [\n 'no sourcemap option, no plugins, identifier',\n noSourcemapsNoPluginsId,\n noSourcemapsNoPluginsIdResult,\n ],\n [\n 'hidden sourcemap option, no plugins, identifier',\n hiddenSourcemapNoPluginsId,\n hiddenSourcemapNoPluginsIdResult,\n ],\n [\n 'arbitrary sourcemap option, no plugins, identifier',\n arbitrarySourcemapNoPluginsId,\n arbitrarySourcemapNoPluginsIdResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapUndefinedPluginsPojo,\n noSourcemapUndefinedPluginsPojoResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapPluginsPojo,\n noSourcemapPluginsPojoResult,\n ],\n ])(\n 'adds plugin and source maps emission to the webpack config (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n // updateFileContent(originalCode);\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n\n it('adds the url parameter to the webpack plugin options if self-hosted', async () => {\n updateFileContent(noSourcemapNoPluginsPojo);\n\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n url: 'https://santry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toContain('url: \"https://santry.io/\"');\n expect(addedCode).toBe(true);\n });\n});\n"]}