@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
@@ -31,29 +31,34 @@ const cocoapod_1 = require("../../src/apple/cocoapod");
31
31
  const bash = __importStar(require("../../src/utils/bash"));
32
32
  // @ts-expect-error - clack is ESM and TS complains about that. It works though
33
33
  const clack = __importStar(require("@clack/prompts"));
34
- jest.mock('@clack/prompts', () => ({
34
+ const vitest_1 = require("vitest");
35
+ vitest_1.vi.mock('@clack/prompts', async () => ({
35
36
  __esModule: true,
36
- ...jest.requireActual('@clack/prompts'),
37
+ ...(await vitest_1.vi.importActual('@clack/prompts')),
37
38
  }));
38
- jest.mock('../../src/utils/bash');
39
- jest.spyOn(Sentry, 'setTag').mockImplementation();
40
- jest.spyOn(Sentry, 'captureException').mockImplementation();
39
+ vitest_1.vi.mock('../../src/utils/bash');
40
+ vitest_1.vi.spyOn(Sentry, 'setTag').mockImplementation(() => {
41
+ /* empty */
42
+ });
43
+ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
41
44
  const clackSpinnerMock = {
42
- start: jest.fn(),
43
- stop: jest.fn(),
44
- message: jest.fn(),
45
+ start: vitest_1.vi.fn(),
46
+ stop: vitest_1.vi.fn(),
47
+ message: vitest_1.vi.fn(),
45
48
  };
46
- describe('cocoapod', () => {
47
- beforeEach(() => {
48
- jest.spyOn(clack, 'spinner').mockReturnValue(clackSpinnerMock);
49
- jest.spyOn(clack.log, 'error').mockImplementation();
49
+ (0, vitest_1.describe)('cocoapod', () => {
50
+ (0, vitest_1.beforeEach)(() => {
51
+ vitest_1.vi.spyOn(clack, 'spinner').mockReturnValue(clackSpinnerMock);
52
+ vitest_1.vi.spyOn(clack.log, 'error').mockImplementation(() => {
53
+ /* empty */
54
+ });
50
55
  });
51
- afterEach(() => {
52
- jest.clearAllMocks();
56
+ (0, vitest_1.afterEach)(() => {
57
+ vitest_1.vi.clearAllMocks();
53
58
  });
54
- describe('usesCocoaPod', () => {
55
- describe('Podfile exists', () => {
56
- it('should return true', () => {
59
+ (0, vitest_1.describe)('usesCocoaPod', () => {
60
+ (0, vitest_1.describe)('Podfile exists', () => {
61
+ (0, vitest_1.it)('should return true', () => {
57
62
  // -- Arrange --
58
63
  const projPath = path.join(os.tmpdir(), 'test-project-with-podfile');
59
64
  const tempDir = fs.mkdtempSync(projPath);
@@ -62,33 +67,33 @@ describe('cocoapod', () => {
62
67
  // -- Act --
63
68
  const result = (0, cocoapod_1.usesCocoaPod)(tempDir);
64
69
  // -- Assert --
65
- expect(result).toBeTruthy();
70
+ (0, vitest_1.expect)(result).toBeTruthy();
66
71
  });
67
72
  });
68
- describe('Podfile does not exist', () => {
69
- it('should return false', () => {
73
+ (0, vitest_1.describe)('Podfile does not exist', () => {
74
+ (0, vitest_1.it)('should return false', () => {
70
75
  // -- Arrange --
71
76
  const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');
72
77
  const tempDir = fs.mkdtempSync(projPath);
73
78
  // -- Act --
74
79
  const result = (0, cocoapod_1.usesCocoaPod)(tempDir);
75
80
  // -- Assert --
76
- expect(result).toBeFalsy();
81
+ (0, vitest_1.expect)(result).toBeFalsy();
77
82
  });
78
83
  });
79
84
  });
80
- describe('addCocoaPods', () => {
81
- describe('Podfile does not exist', () => {
82
- it('should throw an error', async () => {
85
+ (0, vitest_1.describe)('addCocoaPods', () => {
86
+ (0, vitest_1.describe)('Podfile does not exist', () => {
87
+ (0, vitest_1.it)('should throw an error', async () => {
83
88
  // -- Arrange --
84
89
  const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');
85
90
  const tempDir = fs.mkdtempSync(projPath);
86
91
  // -- Act & Assert --
87
- await expect((0, cocoapod_1.addCocoaPods)(tempDir)).rejects.toThrow('ENOENT: no such file or directory, open');
92
+ await (0, vitest_1.expect)((0, cocoapod_1.addCocoaPods)(tempDir)).rejects.toThrow('ENOENT: no such file or directory, open');
88
93
  });
89
94
  });
90
- describe('Podfile exists', () => {
91
- describe('Podfile includes Sentry pod', () => {
95
+ (0, vitest_1.describe)('Podfile exists', () => {
96
+ (0, vitest_1.describe)('Podfile includes Sentry pod', () => {
92
97
  const variations = [
93
98
  {
94
99
  case: 'simple',
@@ -124,7 +129,7 @@ describe('cocoapod', () => {
124
129
  },
125
130
  ];
126
131
  for (const variation of variations) {
127
- it(`should not change the Podfile for ${variation.case}`, async () => {
132
+ (0, vitest_1.it)(`should not change the Podfile for ${variation.case}`, async () => {
128
133
  // -- Arrange --
129
134
  const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
130
135
  fs.mkdirSync(projPath, {
@@ -135,14 +140,14 @@ describe('cocoapod', () => {
135
140
  // -- Act --
136
141
  const result = await (0, cocoapod_1.addCocoaPods)(projPath);
137
142
  // -- Assert --
138
- expect(result).toBeTruthy();
139
- expect(fs.readFileSync(podfile, 'utf8')).toBe(variation.content);
143
+ (0, vitest_1.expect)(result).toBeTruthy();
144
+ (0, vitest_1.expect)(fs.readFileSync(podfile, 'utf8')).toBe(variation.content);
140
145
  });
141
146
  }
142
147
  });
143
- describe('Podfile includes no other pods', () => {
144
- describe('Podfile does not include use_frameworks!', () => {
145
- it('should not change the Podfile', async () => {
148
+ (0, vitest_1.describe)('Podfile includes no other pods', () => {
149
+ (0, vitest_1.describe)('Podfile does not include use_frameworks!', () => {
150
+ (0, vitest_1.it)('should not change the Podfile', async () => {
146
151
  // -- Arrange --
147
152
  const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
148
153
  fs.mkdirSync(projPath, {
@@ -153,12 +158,12 @@ describe('cocoapod', () => {
153
158
  // -- Act --
154
159
  const result = await (0, cocoapod_1.addCocoaPods)(projPath);
155
160
  // -- Assert --
156
- expect(result).toBeFalsy();
157
- expect(fs.readFileSync(podfile, 'utf8')).toBe('');
161
+ (0, vitest_1.expect)(result).toBeFalsy();
162
+ (0, vitest_1.expect)(fs.readFileSync(podfile, 'utf8')).toBe('');
158
163
  });
159
164
  });
160
- describe('Podfile includes use_frameworks!', () => {
161
- it('should change the Podfile', async () => {
165
+ (0, vitest_1.describe)('Podfile includes use_frameworks!', () => {
166
+ (0, vitest_1.it)('should change the Podfile', async () => {
162
167
  // -- Arrange --
163
168
  const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
164
169
  fs.mkdirSync(projPath, {
@@ -169,13 +174,13 @@ describe('cocoapod', () => {
169
174
  // -- Act --
170
175
  const result = await (0, cocoapod_1.addCocoaPods)(projPath);
171
176
  // -- Assert --
172
- expect(result).toBeTruthy();
173
- expect(fs.readFileSync(podfile, 'utf8')).toBe(`use_frameworks!\npod 'Sentry'\n`);
177
+ (0, vitest_1.expect)(result).toBeTruthy();
178
+ (0, vitest_1.expect)(fs.readFileSync(podfile, 'utf8')).toBe(`use_frameworks!\npod 'Sentry'\n`);
174
179
  });
175
180
  });
176
181
  });
177
- describe('Podfile includes other pods', () => {
178
- it('should append Sentry pod after last pod', async () => {
182
+ (0, vitest_1.describe)('Podfile includes other pods', () => {
183
+ (0, vitest_1.it)('should append Sentry pod after last pod', async () => {
179
184
  // -- Arrange --
180
185
  const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
181
186
  fs.mkdirSync(projPath, {
@@ -186,77 +191,77 @@ describe('cocoapod', () => {
186
191
  // -- Act --
187
192
  const result = await (0, cocoapod_1.addCocoaPods)(projPath);
188
193
  // -- Assert --
189
- expect(result).toBeTruthy();
190
- expect(fs.readFileSync(podfile, 'utf8')).toBe(`pod "OtherPod"\npod 'Sentry'\n`);
194
+ (0, vitest_1.expect)(result).toBeTruthy();
195
+ (0, vitest_1.expect)(fs.readFileSync(podfile, 'utf8')).toBe(`pod "OtherPod"\npod 'Sentry'\n`);
191
196
  });
192
197
  });
193
198
  });
194
199
  });
195
- describe('podInstall', () => {
200
+ (0, vitest_1.describe)('podInstall', () => {
196
201
  let workDir;
197
- beforeEach(() => {
202
+ (0, vitest_1.beforeEach)(() => {
198
203
  workDir = path.join(os.tmpdir(), 'test-project');
199
204
  });
200
- describe('any bash scripts fail', () => {
201
- beforeEach(() => {
202
- jest.spyOn(bash, 'execute').mockRejectedValue(new Error('test error'));
205
+ (0, vitest_1.describe)('any bash scripts fail', () => {
206
+ (0, vitest_1.beforeEach)(() => {
207
+ vitest_1.vi.spyOn(bash, 'execute').mockRejectedValue(new Error('test error'));
203
208
  });
204
- it('should not throw an error', async () => {
209
+ (0, vitest_1.it)('should not throw an error', async () => {
205
210
  // -- Act & Assert --
206
- await expect((0, cocoapod_1.podInstall)(workDir)).resolves.not.toThrow();
211
+ await (0, vitest_1.expect)((0, cocoapod_1.podInstall)(workDir)).resolves.not.toThrow();
207
212
  });
208
- it('should set tag', async () => {
213
+ (0, vitest_1.it)('should set tag', async () => {
209
214
  // -- Act --
210
215
  await (0, cocoapod_1.podInstall)(workDir);
211
216
  // -- Assert --
212
- expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', false);
217
+ (0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('pods-installed', false);
213
218
  });
214
- it('should capture exception', async () => {
219
+ (0, vitest_1.it)('should capture exception', async () => {
215
220
  // -- Act --
216
221
  await (0, cocoapod_1.podInstall)(workDir);
217
222
  // -- Assert --
218
- expect(Sentry.captureException).toHaveBeenCalledWith('Sentry pod install failed.');
223
+ (0, vitest_1.expect)(Sentry.captureException).toHaveBeenCalledWith('Sentry pod install failed.');
219
224
  });
220
- it('should start and stop spinner', async () => {
225
+ (0, vitest_1.it)('should start and stop spinner', async () => {
221
226
  // -- Act --
222
227
  await (0, cocoapod_1.podInstall)(workDir);
223
228
  // -- Assert --
224
- expect(clackSpinnerMock.start).toHaveBeenCalledWith("Running 'pod install'. This may take a few minutes...");
225
- expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Failed to install pods.');
229
+ (0, vitest_1.expect)(clackSpinnerMock.start).toHaveBeenCalledWith("Running 'pod install'. This may take a few minutes...");
230
+ (0, vitest_1.expect)(clackSpinnerMock.stop).toHaveBeenCalledWith('Failed to install pods.');
226
231
  });
227
232
  });
228
- describe('all bash scripts work', () => {
229
- beforeEach(() => {
230
- jest.spyOn(bash, 'execute').mockResolvedValue('');
233
+ (0, vitest_1.describe)('all bash scripts work', () => {
234
+ (0, vitest_1.beforeEach)(() => {
235
+ vitest_1.vi.spyOn(bash, 'execute').mockResolvedValue('');
231
236
  });
232
- it('should call pod update and install', async () => {
237
+ (0, vitest_1.it)('should call pod update and install', async () => {
233
238
  // -- Act --
234
239
  await (0, cocoapod_1.podInstall)(workDir);
235
240
  // -- Assert --
236
- expect(bash.execute).toHaveBeenCalledWith(`cd ${workDir} && pod repo update`);
237
- expect(bash.execute).toHaveBeenCalledWith(`cd ${workDir} && pod install --silent`);
241
+ (0, vitest_1.expect)(bash.execute).toHaveBeenCalledWith(`cd ${workDir} && pod repo update`);
242
+ (0, vitest_1.expect)(bash.execute).toHaveBeenCalledWith(`cd ${workDir} && pod install --silent`);
238
243
  });
239
- it('should set tag', async () => {
244
+ (0, vitest_1.it)('should set tag', async () => {
240
245
  // -- Act --
241
246
  await (0, cocoapod_1.podInstall)(workDir);
242
247
  // -- Assert --
243
- expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', true);
248
+ (0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('pods-installed', true);
244
249
  });
245
- it('should start and stop spinner', async () => {
250
+ (0, vitest_1.it)('should start and stop spinner', async () => {
246
251
  // -- Act --
247
252
  await (0, cocoapod_1.podInstall)(workDir);
248
253
  // -- Assert --
249
- expect(clackSpinnerMock.start).toHaveBeenCalledWith("Running 'pod install'. This may take a few minutes...");
250
- expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Pods installed.');
254
+ (0, vitest_1.expect)(clackSpinnerMock.start).toHaveBeenCalledWith("Running 'pod install'. This may take a few minutes...");
255
+ (0, vitest_1.expect)(clackSpinnerMock.stop).toHaveBeenCalledWith('Pods installed.');
251
256
  });
252
257
  });
253
- describe('dir not given', () => {
254
- it('should use current directory', async () => {
258
+ (0, vitest_1.describe)('dir not given', () => {
259
+ (0, vitest_1.it)('should use current directory', async () => {
255
260
  // -- Act --
256
261
  await (0, cocoapod_1.podInstall)();
257
262
  // -- Assert --
258
- expect(bash.execute).toHaveBeenCalledWith(`cd . && pod repo update`);
259
- expect(bash.execute).toHaveBeenCalledWith(`cd . && pod install --silent`);
263
+ (0, vitest_1.expect)(bash.execute).toHaveBeenCalledWith(`cd . && pod repo update`);
264
+ (0, vitest_1.expect)(bash.execute).toHaveBeenCalledWith(`cd . && pod install --silent`);
260
265
  });
261
266
  });
262
267
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cocoapod.test.js","sourceRoot":"","sources":["../../../test/apple/cocoapod.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,uDAIkC;AAClC,2DAA6C;AAC7C,+EAA+E;AAC/E,sDAAwC;AACxC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,CAAC;IACjC,UAAU,EAAE,IAAI;IAChB,GAAG,IAAI,CAAC,aAAa,CAAe,gBAAgB,CAAC;CACtD,CAAC,CAAC,CAAC;AAEJ,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAClC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,CAAC;AAClD,I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M,IAAA,qBAAU,EAAC,OAAO,CAAC,CAAC;gBAE1B,eAAe;gBACf,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,oBAAoB,CACjD,uDAAuD,CACxD,CAAC;gBACF,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;YACxE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;YAC7B,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;gBAC5C,YAAY;gBACZ,MAAM,IAAA,qBAAU,GAAE,CAAC;gBAEnB,eAAe;gBACf,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;gBACrE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CACvC,8BAA8B,CAC/B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport {\n addCocoaPods,\n podInstall,\n usesCocoaPod,\n} from '../../src/apple/cocoapod';\nimport * as bash from '../../src/utils/bash';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\njest.mock('@clack/prompts', () => ({\n __esModule: true,\n ...jest.requireActual<typeof clack>('@clack/prompts'),\n}));\n\njest.mock('../../src/utils/bash');\njest.spyOn(Sentry, 'setTag').mockImplementation();\njest.spyOn(Sentry, 'captureException').mockImplementation();\n\nconst clackSpinnerMock = {\n start: jest.fn(),\n stop: jest.fn(),\n message: jest.fn(),\n};\n\ndescribe('cocoapod', () => {\n beforeEach(() => {\n jest.spyOn(clack, 'spinner').mockReturnValue(clackSpinnerMock);\n jest.spyOn(clack.log, 'error').mockImplementation();\n });\n\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n describe('usesCocoaPod', () => {\n describe('Podfile exists', () => {\n it('should return true', () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-with-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n const podfile = path.join(tempDir, 'Podfile');\n fs.writeFileSync(podfile, '');\n\n // -- Act --\n const result = usesCocoaPod(tempDir);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n\n describe('Podfile does not exist', () => {\n it('should return false', () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n // -- Act --\n const result = usesCocoaPod(tempDir);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n });\n\n describe('addCocoaPods', () => {\n describe('Podfile does not exist', () => {\n it('should throw an error', async () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n // -- Act & Assert --\n await expect(addCocoaPods(tempDir)).rejects.toThrow(\n 'ENOENT: no such file or directory, open',\n );\n });\n });\n\n describe('Podfile exists', () => {\n describe('Podfile includes Sentry pod', () => {\n const variations = [\n {\n case: 'simple',\n content: 'pod \"Sentry\"',\n },\n {\n case: 'with-swiftui',\n content: 'pod \"SentrySwiftUI\"',\n },\n {\n case: 'leading-space',\n content: ' pod \"Sentry\"',\n },\n {\n case: 'leading-space-and-swiftui',\n content: ' pod \"SentrySwiftUI\"',\n },\n {\n case: 'trailing-space',\n content: 'pod \"Sentry\" ',\n },\n {\n case: 'trailing-space-and-swiftui',\n content: 'pod \"SentrySwiftUI\" ',\n },\n {\n case: 'single-quotes',\n content: \"pod 'Sentry'\",\n },\n {\n case: 'double-quotes',\n content: 'pod \"Sentry\"',\n },\n ];\n for (const variation of variations) {\n it(`should not change the Podfile for ${variation.case}`, async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, variation.content, 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(variation.content);\n });\n }\n });\n\n describe('Podfile includes no other pods', () => {\n describe('Podfile does not include use_frameworks!', () => {\n it('should not change the Podfile', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, '', 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe('');\n });\n });\n\n describe('Podfile includes use_frameworks!', () => {\n it('should change the Podfile', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, `use_frameworks!`, 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(\n `use_frameworks!\\npod 'Sentry'\\n`,\n );\n });\n });\n });\n\n describe('Podfile includes other pods', () => {\n it('should append Sentry pod after last pod', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, 'pod \"OtherPod\"', 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(\n `pod \"OtherPod\"\\npod 'Sentry'\\n`,\n );\n });\n });\n });\n });\n\n describe('podInstall', () => {\n let workDir: string;\n\n beforeEach(() => {\n workDir = path.join(os.tmpdir(), 'test-project');\n });\n\n describe('any bash scripts fail', () => {\n beforeEach(() => {\n jest.spyOn(bash, 'execute').mockRejectedValue(new Error('test error'));\n });\n\n it('should not throw an error', async () => {\n // -- Act & Assert --\n await expect(podInstall(workDir)).resolves.not.toThrow();\n });\n\n it('should set tag', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', false);\n });\n\n it('should capture exception', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.captureException).toHaveBeenCalledWith(\n 'Sentry pod install failed.',\n );\n });\n\n it('should start and stop spinner', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(clackSpinnerMock.start).toHaveBeenCalledWith(\n \"Running 'pod install'. This may take a few minutes...\",\n );\n expect(clackSpinnerMock.stop).toHaveBeenCalledWith(\n 'Failed to install pods.',\n );\n });\n });\n\n describe('all bash scripts work', () => {\n beforeEach(() => {\n jest.spyOn(bash, 'execute').mockResolvedValue('');\n });\n\n it('should call pod update and install', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(bash.execute).toHaveBeenCalledWith(\n `cd ${workDir} && pod repo update`,\n );\n expect(bash.execute).toHaveBeenCalledWith(\n `cd ${workDir} && pod install --silent`,\n );\n });\n\n it('should set tag', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', true);\n });\n\n it('should start and stop spinner', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(clackSpinnerMock.start).toHaveBeenCalledWith(\n \"Running 'pod install'. This may take a few minutes...\",\n );\n expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Pods installed.');\n });\n });\n\n describe('dir not given', () => {\n it('should use current directory', async () => {\n // -- Act --\n await podInstall();\n\n // -- Assert --\n expect(bash.execute).toHaveBeenCalledWith(`cd . && pod repo update`);\n expect(bash.execute).toHaveBeenCalledWith(\n `cd . && pod install --silent`,\n );\n });\n });\n });\n});\n"]}
1
+ {"version":3,"file":"cocoapod.test.js","sourceRoot":"","sources":["../../../test/apple/cocoapod.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,uDAIkC;AAClC,2DAA6C;AAC7C,+EAA+E;AAC/E,sDAAwC;AACxC,mCAAyE;AACzE,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE,IAAI;IAChB,GAAG,CAAC,MAAM,WAAE,CAAC,YAAY,CAAe,gBAAgB,CAAC,CAAC;CAC3D,CAAC,CAAC,CAAC;AAEJ,WAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAChC,WAAE,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;IACjD,WAAW;AACb,CAAC,CAAC,CAAC;AACH,WAAE,CAAC,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAEpE,MAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,WAAE,CAAC,EAAE,EAAE;IACd,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;IACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;CACjB,CAAC;AAEF,IAAA,iBAAQ,EAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,WAAE,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;Q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;gBAE1B,eAAe;gBACf,IAAA,eAAM,EAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,oBAAoB,CACjD,uDAAuD,CACxD,CAAC;gBACF,IAAA,eAAM,EAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;YACxE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;YAC7B,IAAA,WAAE,EAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;gBAC5C,YAAY;gBACZ,MAAM,IAAA,qBAAU,GAAE,CAAC;gBAEnB,eAAe;gBACf,IAAA,eAAM,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;gBACrE,IAAA,eAAM,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CACvC,8BAA8B,CAC/B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport {\n addCocoaPods,\n podInstall,\n usesCocoaPod,\n} from '../../src/apple/cocoapod';\nimport * as bash from '../../src/utils/bash';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\nvi.mock('@clack/prompts', async () => ({\n __esModule: true,\n ...(await vi.importActual<typeof clack>('@clack/prompts')),\n}));\n\nvi.mock('../../src/utils/bash');\nvi.spyOn(Sentry, 'setTag').mockImplementation(() => {\n /* empty */\n});\nvi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');\n\nconst clackSpinnerMock = {\n start: vi.fn(),\n stop: vi.fn(),\n message: vi.fn(),\n};\n\ndescribe('cocoapod', () => {\n beforeEach(() => {\n vi.spyOn(clack, 'spinner').mockReturnValue(clackSpinnerMock);\n vi.spyOn(clack.log, 'error').mockImplementation(() => {\n /* empty */\n });\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe('usesCocoaPod', () => {\n describe('Podfile exists', () => {\n it('should return true', () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-with-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n const podfile = path.join(tempDir, 'Podfile');\n fs.writeFileSync(podfile, '');\n\n // -- Act --\n const result = usesCocoaPod(tempDir);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n\n describe('Podfile does not exist', () => {\n it('should return false', () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n // -- Act --\n const result = usesCocoaPod(tempDir);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n });\n\n describe('addCocoaPods', () => {\n describe('Podfile does not exist', () => {\n it('should throw an error', async () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n // -- Act & Assert --\n await expect(addCocoaPods(tempDir)).rejects.toThrow(\n 'ENOENT: no such file or directory, open',\n );\n });\n });\n\n describe('Podfile exists', () => {\n describe('Podfile includes Sentry pod', () => {\n const variations = [\n {\n case: 'simple',\n content: 'pod \"Sentry\"',\n },\n {\n case: 'with-swiftui',\n content: 'pod \"SentrySwiftUI\"',\n },\n {\n case: 'leading-space',\n content: ' pod \"Sentry\"',\n },\n {\n case: 'leading-space-and-swiftui',\n content: ' pod \"SentrySwiftUI\"',\n },\n {\n case: 'trailing-space',\n content: 'pod \"Sentry\" ',\n },\n {\n case: 'trailing-space-and-swiftui',\n content: 'pod \"SentrySwiftUI\" ',\n },\n {\n case: 'single-quotes',\n content: \"pod 'Sentry'\",\n },\n {\n case: 'double-quotes',\n content: 'pod \"Sentry\"',\n },\n ];\n for (const variation of variations) {\n it(`should not change the Podfile for ${variation.case}`, async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, variation.content, 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(variation.content);\n });\n }\n });\n\n describe('Podfile includes no other pods', () => {\n describe('Podfile does not include use_frameworks!', () => {\n it('should not change the Podfile', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, '', 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe('');\n });\n });\n\n describe('Podfile includes use_frameworks!', () => {\n it('should change the Podfile', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, `use_frameworks!`, 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(\n `use_frameworks!\\npod 'Sentry'\\n`,\n );\n });\n });\n });\n\n describe('Podfile includes other pods', () => {\n it('should append Sentry pod after last pod', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, 'pod \"OtherPod\"', 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(\n `pod \"OtherPod\"\\npod 'Sentry'\\n`,\n );\n });\n });\n });\n });\n\n describe('podInstall', () => {\n let workDir: string;\n\n beforeEach(() => {\n workDir = path.join(os.tmpdir(), 'test-project');\n });\n\n describe('any bash scripts fail', () => {\n beforeEach(() => {\n vi.spyOn(bash, 'execute').mockRejectedValue(new Error('test error'));\n });\n\n it('should not throw an error', async () => {\n // -- Act & Assert --\n await expect(podInstall(workDir)).resolves.not.toThrow();\n });\n\n it('should set tag', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', false);\n });\n\n it('should capture exception', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.captureException).toHaveBeenCalledWith(\n 'Sentry pod install failed.',\n );\n });\n\n it('should start and stop spinner', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(clackSpinnerMock.start).toHaveBeenCalledWith(\n \"Running 'pod install'. This may take a few minutes...\",\n );\n expect(clackSpinnerMock.stop).toHaveBeenCalledWith(\n 'Failed to install pods.',\n );\n });\n });\n\n describe('all bash scripts work', () => {\n beforeEach(() => {\n vi.spyOn(bash, 'execute').mockResolvedValue('');\n });\n\n it('should call pod update and install', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(bash.execute).toHaveBeenCalledWith(\n `cd ${workDir} && pod repo update`,\n );\n expect(bash.execute).toHaveBeenCalledWith(\n `cd ${workDir} && pod install --silent`,\n );\n });\n\n it('should set tag', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', true);\n });\n\n it('should start and stop spinner', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(clackSpinnerMock.start).toHaveBeenCalledWith(\n \"Running 'pod install'. This may take a few minutes...\",\n );\n expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Pods installed.');\n });\n });\n\n describe('dir not given', () => {\n it('should use current directory', async () => {\n // -- Act --\n await podInstall();\n\n // -- Assert --\n expect(bash.execute).toHaveBeenCalledWith(`cd . && pod repo update`);\n expect(bash.execute).toHaveBeenCalledWith(\n `cd . && pod install --silent`,\n );\n });\n });\n });\n});\n"]}