@sentry/wizard 4.6.0 → 4.7.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 (137) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bin.js +9 -0
  3. package/dist/bin.js.map +1 -1
  4. package/dist/e2e-tests/tests/flutter.test.js +16 -16
  5. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/help-message.test.d.ts +1 -0
  7. package/dist/e2e-tests/tests/help-message.test.js +56 -0
  8. package/dist/e2e-tests/tests/help-message.test.js.map +1 -0
  9. package/dist/e2e-tests/tests/nextjs-14.test.js +15 -15
  10. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  11. package/dist/e2e-tests/tests/nextjs-15.test.js +15 -15
  12. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  13. package/dist/e2e-tests/tests/nuxt-3.test.js +13 -12
  14. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  15. package/dist/e2e-tests/tests/nuxt-4.test.js +13 -12
  16. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  17. package/dist/e2e-tests/tests/remix.test.js +20 -20
  18. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  19. package/dist/e2e-tests/tests/sveltekit.test.js +20 -20
  20. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  21. package/dist/e2e-tests/utils/index.js +15 -11
  22. package/dist/e2e-tests/utils/index.js.map +1 -1
  23. package/dist/lib/Constants.d.ts +5 -1
  24. package/dist/lib/Constants.js.map +1 -1
  25. package/dist/lib/Helper/Logging.d.ts +1 -1
  26. package/dist/lib/Helper/Logging.js.map +1 -1
  27. package/dist/lib/Helper/__tests__/File.js +9 -9
  28. package/dist/lib/Helper/__tests__/File.js.map +1 -1
  29. package/dist/lib/Helper/__tests__/MergeConfig.js +17 -17
  30. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  31. package/dist/lib/Helper/__tests__/SentryCli.js +23 -22
  32. package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
  33. package/dist/lib/Setup.d.ts +2 -1
  34. package/dist/lib/Setup.js +12 -2
  35. package/dist/lib/Setup.js.map +1 -1
  36. package/dist/lib/Steps/BaseStep.d.ts +1 -1
  37. package/dist/lib/Steps/BaseStep.js.map +1 -1
  38. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  39. package/dist/lib/Steps/Welcome.js +5 -0
  40. package/dist/lib/Steps/Welcome.js.map +1 -1
  41. package/dist/lib/__tests__/Env.js +4 -3
  42. package/dist/lib/__tests__/Env.js.map +1 -1
  43. package/dist/src/apple/apple-wizard.js +24 -64
  44. package/dist/src/apple/apple-wizard.js.map +1 -1
  45. package/dist/src/apple/configure-package-manager.d.ts +5 -0
  46. package/dist/src/apple/configure-package-manager.js +68 -0
  47. package/dist/src/apple/configure-package-manager.js.map +1 -0
  48. package/dist/src/apple/configure-sentry-cli.d.ts +4 -0
  49. package/dist/src/apple/configure-sentry-cli.js +47 -0
  50. package/dist/src/apple/configure-sentry-cli.js.map +1 -0
  51. package/dist/src/apple/configure-xcode-project.d.ts +8 -0
  52. package/dist/src/apple/configure-xcode-project.js +11 -0
  53. package/dist/src/apple/configure-xcode-project.js.map +1 -0
  54. package/dist/src/apple/inject-code-snippet.d.ts +6 -0
  55. package/dist/src/apple/inject-code-snippet.js +54 -0
  56. package/dist/src/apple/inject-code-snippet.js.map +1 -0
  57. package/dist/src/apple/templates.js +11 -7
  58. package/dist/src/apple/templates.js.map +1 -1
  59. package/dist/src/apple/xcode-manager.js +3 -6
  60. package/dist/src/apple/xcode-manager.js.map +1 -1
  61. package/dist/src/nextjs/templates.js +3 -1
  62. package/dist/src/nextjs/templates.js.map +1 -1
  63. package/dist/src/react-native/javascript.d.ts +6 -4
  64. package/dist/src/react-native/javascript.js +25 -9
  65. package/dist/src/react-native/javascript.js.map +1 -1
  66. package/dist/src/react-native/react-native-wizard.d.ts +4 -0
  67. package/dist/src/react-native/react-native-wizard.js +30 -5
  68. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  69. package/dist/src/react-native/xcode.d.ts +7 -3
  70. package/dist/src/react-native/xcode.js +64 -20
  71. package/dist/src/react-native/xcode.js.map +1 -1
  72. package/dist/src/run.js +2 -2
  73. package/dist/src/run.js.map +1 -1
  74. package/dist/src/utils/clack/index.js +3 -1
  75. package/dist/src/utils/clack/index.js.map +1 -1
  76. package/dist/src/utils/package-manager.d.ts +2 -0
  77. package/dist/src/utils/package-manager.js +55 -5
  78. package/dist/src/utils/package-manager.js.map +1 -1
  79. package/dist/src/version.d.ts +1 -1
  80. package/dist/src/version.js +1 -1
  81. package/dist/src/version.js.map +1 -1
  82. package/dist/test/android/code-tools.test.js +13 -12
  83. package/dist/test/android/code-tools.test.js.map +1 -1
  84. package/dist/test/apple/cocoapod.test.js +77 -72
  85. package/dist/test/apple/cocoapod.test.js.map +1 -1
  86. package/dist/test/apple/code-tools.test.js +173 -166
  87. package/dist/test/apple/code-tools.test.js.map +1 -1
  88. package/dist/test/apple/fastfile.test.js +86 -83
  89. package/dist/test/apple/fastfile.test.js.map +1 -1
  90. package/dist/test/apple/templates.test.js +32 -27
  91. package/dist/test/apple/templates.test.js.map +1 -1
  92. package/dist/test/apple/xcode-manager.test.js +182 -183
  93. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  94. package/dist/test/flutter/code-tools.test.js +29 -28
  95. package/dist/test/flutter/code-tools.test.js.map +1 -1
  96. package/dist/test/flutter/templates.test.js +15 -14
  97. package/dist/test/flutter/templates.test.js.map +1 -1
  98. package/dist/test/nextjs/templates.test.js +43 -36
  99. package/dist/test/nextjs/templates.test.js.map +1 -1
  100. package/dist/test/nuxt/templates.test.js +25 -24
  101. package/dist/test/nuxt/templates.test.js.map +1 -1
  102. package/dist/test/react-native/expo-metro.test.js +11 -10
  103. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  104. package/dist/test/react-native/expo.test.js +11 -10
  105. package/dist/test/react-native/expo.test.js.map +1 -1
  106. package/dist/test/react-native/gradle.test.js +27 -26
  107. package/dist/test/react-native/gradle.test.js.map +1 -1
  108. package/dist/test/react-native/javascript.test.js +108 -58
  109. package/dist/test/react-native/javascript.test.js.map +1 -1
  110. package/dist/test/react-native/metro.test.js +65 -64
  111. package/dist/test/react-native/metro.test.js.map +1 -1
  112. package/dist/test/react-native/xcode.test.js +138 -37
  113. package/dist/test/react-native/xcode.test.js.map +1 -1
  114. package/dist/test/remix/client-entry.test.js +8 -7
  115. package/dist/test/remix/client-entry.test.js.map +1 -1
  116. package/dist/test/remix/server-instrumentation.test.js +6 -5
  117. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  118. package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -20
  119. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
  120. package/dist/test/sourcemaps/tools/tsc.test.js +13 -14
  121. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
  122. package/dist/test/sourcemaps/tools/vite.test.js +13 -14
  123. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  124. package/dist/test/sourcemaps/tools/webpack.test.js +19 -20
  125. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
  126. package/dist/test/sveltekit/templates.test.js +13 -12
  127. package/dist/test/sveltekit/templates.test.js.map +1 -1
  128. package/dist/test/utils/ast-utils.test.js +45 -44
  129. package/dist/test/utils/ast-utils.test.js.map +1 -1
  130. package/dist/test/utils/clack/index.test.js +140 -144
  131. package/dist/test/utils/clack/index.test.js.map +1 -1
  132. package/dist/test/utils/package-manager.test.js +8 -7
  133. package/dist/test/utils/package-manager.test.js.map +1 -1
  134. package/package.json +10 -38
  135. package/dist/e2e-tests/jest.config.d.ts +0 -17
  136. package/dist/e2e-tests/jest.config.js +0 -23
  137. package/dist/e2e-tests/jest.config.js.map +0 -1
@@ -1,10 +1,53 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
29
  /* eslint-disable no-useless-escape */
30
+ const vitest_1 = require("vitest");
4
31
  const xcode_1 = require("../../src/react-native/xcode");
5
- describe('react-native xcode', () => {
6
- describe('addSentryWithCliToBundleShellScript', () => {
7
- it('adds sentry cli to rn bundle build phase', () => {
32
+ const chalk_1 = __importDefault(require("chalk"));
33
+ const clack_1 = require("../../src/utils/clack");
34
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
35
+ const clack = __importStar(require("@clack/prompts"));
36
+ vitest_1.vi.mock('@clack/prompts', async () => ({
37
+ __esModule: true,
38
+ ...(await vitest_1.vi.importActual('@clack/prompts')),
39
+ }));
40
+ (0, vitest_1.describe)('react-native xcode', () => {
41
+ (0, vitest_1.beforeEach)(() => {
42
+ vitest_1.vi.spyOn(clack.log, 'error').mockImplementation(() => {
43
+ /* empty */
44
+ });
45
+ });
46
+ (0, vitest_1.afterEach)(() => {
47
+ vitest_1.vi.clearAllMocks();
48
+ });
49
+ (0, vitest_1.describe)('addSentryWithCliToBundleShellScript', () => {
50
+ (0, vitest_1.it)('adds sentry cli to rn bundle build phase', () => {
8
51
  const input = `set -e
9
52
 
10
53
  WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
@@ -24,11 +67,28 @@ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
24
67
  /bin/sh -c "$WITH_ENVIRONMENT \\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\""
25
68
  /bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"
26
69
  `;
27
- expect((0, xcode_1.addSentryWithCliToBundleShellScript)(input)).toBe(expectedOutput);
70
+ (0, vitest_1.expect)((0, xcode_1.addSentryWithCliToBundleShellScript)(input)).toBe(expectedOutput);
71
+ });
72
+ (0, vitest_1.it)('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {
73
+ const input = `set -e
74
+
75
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
76
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
77
+
78
+ /bin/sh -c "$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE"`;
79
+ (0, vitest_1.expect)((0, xcode_1.addSentryWithCliToBundleShellScript)(input)).toEqual(new xcode_1.ErrorPatchSnippet((0, clack_1.makeCodeSnippet)(true, (unchanged, plus, _minus) => {
80
+ return unchanged(`${plus(`export SENTRY_PROPERTIES=sentry.properties
81
+ export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
82
+ `)}
83
+ /bin/sh -c "$WITH_ENVIRONMENT ${plus(`\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode`)} $REACT_NATIVE_XCODE${plus(`\\"`)}"
84
+ ${plus(`/bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh`)}"
85
+ `);
86
+ })));
87
+ (0, vitest_1.expect)(clack.log.error).toHaveBeenCalledWith(`Could not find $REACT_NATIVE_XCODE in ${chalk_1.default.cyan('Bundle React Native code and images')} build phase. Skipping patching.`);
28
88
  });
29
89
  });
30
- describe('addSentryBundledScriptsToBundleShellScript', () => {
31
- it('adds sentry cli to rn bundle build phase', () => {
90
+ (0, vitest_1.describe)('addSentryBundledScriptsToBundleShellScript', () => {
91
+ (0, vitest_1.it)('adds sentry cli to rn bundle build phase', () => {
32
92
  const input = `set -e
33
93
 
34
94
  WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
@@ -44,9 +104,25 @@ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh
44
104
  REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
45
105
 
46
106
  /bin/sh -c "$WITH_ENVIRONMENT \\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\""`;
47
- expect((0, xcode_1.addSentryWithBundledScriptsToBundleShellScript)(input)).toBe(expectedOutput);
107
+ (0, vitest_1.expect)((0, xcode_1.addSentryWithBundledScriptsToBundleShellScript)(input)).toBe(expectedOutput);
108
+ });
109
+ (0, vitest_1.it)('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {
110
+ const input = `set -e
111
+
112
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
113
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
114
+
115
+ /bin/sh -c "$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE"`;
116
+ (0, vitest_1.expect)((0, xcode_1.addSentryWithBundledScriptsToBundleShellScript)(input)).toEqual(new xcode_1.ErrorPatchSnippet((0, clack_1.makeCodeSnippet)(true, (unchanged, plus, _minus) => {
117
+ return unchanged(`WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
118
+ REACT_NATIVE_XCODE="$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
119
+
120
+ /bin/sh -c "$WITH_ENVIRONMENT ${plus(`\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh `)}$REACT_NATIVE_XCODE${plus(`\\"`)}"
121
+ `);
122
+ })));
123
+ (0, vitest_1.expect)(clack.log.error).toHaveBeenCalledWith(`Failed to patch ${chalk_1.default.cyan('Bundle React Native code and images')} build phase.`);
48
124
  });
49
- it('adds sentry cli to expo bundle build phase', () => {
125
+ (0, vitest_1.it)('adds sentry cli to expo bundle build phase', () => {
50
126
  const input = `
51
127
  if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
52
128
  source "$PODS_ROOT/../.xcode.env"
@@ -129,11 +205,36 @@ fi
129
205
 
130
206
  /bin/sh \`"$NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'"\` \`"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"\`
131
207
  `;
132
- expect((0, xcode_1.addSentryWithBundledScriptsToBundleShellScript)(input)).toBe(expectedOutput);
208
+ (0, vitest_1.expect)((0, xcode_1.addSentryWithBundledScriptsToBundleShellScript)(input)).toBe(expectedOutput);
209
+ });
210
+ (0, vitest_1.it)('if patching fails it does not add sentry cli to expo bundle build phase and shows code snippet', () => {
211
+ const input = `
212
+ if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
213
+ source "$PODS_ROOT/../.xcode.env"
214
+ fi
215
+ if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
216
+ source "$PODS_ROOT/../.xcode.env.local"
217
+ fi
218
+
219
+ # The project root by default is one level up from the ios directory
220
+ export PROJECT_ROOT="$PROJECT_DIR"/..
221
+
222
+ if [[ "$CONFIGURATION" = *Debug* ]]; then
223
+ export SKIP_BUNDLING=1
224
+ fi
225
+ if [[ -z "$ENTRY_FILE" ]]; then
226
+ # Set the entry JS file using the bundler's entry resolution.
227
+ export ENTRY_FILE="$("$NODE_BINARY" -e "require('expo/scripts/resolveAppEntry')" "$PROJECT_ROOT" ios absolute | tail -n 1)"
228
+ fi
229
+ `;
230
+ (0, vitest_1.expect)((0, xcode_1.addSentryWithBundledScriptsToBundleShellScript)(input)).toEqual(new xcode_1.ErrorPatchSnippet((0, clack_1.makeCodeSnippet)(true, (unchanged, plus, _minus) => {
231
+ return unchanged(`${plus(`/bin/sh \`"$NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'"\``)} \`"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"\``);
232
+ })));
233
+ (0, vitest_1.expect)(clack.log.error).toHaveBeenCalledWith(`Failed to patch ${chalk_1.default.cyan('Bundle React Native code and images')} build phase.`);
133
234
  });
134
235
  });
135
- describe('removeSentryFromBundleShellScript', () => {
136
- it('removes sentry cli from rn bundle build phase', () => {
236
+ (0, vitest_1.describe)('removeSentryFromBundleShellScript', () => {
237
+ (0, vitest_1.it)('removes sentry cli from rn bundle build phase', () => {
137
238
  const input = `export SENTRY_PROPERTIES=sentry.properties
138
239
  export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
139
240
  set -e
@@ -154,9 +255,9 @@ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
154
255
  /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""
155
256
 
156
257
  `;
157
- expect((0, xcode_1.removeSentryFromBundleShellScript)(input)).toBe(expectedOutput);
258
+ (0, vitest_1.expect)((0, xcode_1.removeSentryFromBundleShellScript)(input)).toBe(expectedOutput);
158
259
  });
159
- it('removes sentry bundled scripts from rn bundle build phase', () => {
260
+ (0, vitest_1.it)('removes sentry bundled scripts from rn bundle build phase', () => {
160
261
  const input = `set -e
161
262
 
162
263
  WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
@@ -169,11 +270,11 @@ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh
169
270
  REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
170
271
 
171
272
  /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""`;
172
- expect((0, xcode_1.removeSentryFromBundleShellScript)(input)).toBe(expectedOutput);
273
+ (0, vitest_1.expect)((0, xcode_1.removeSentryFromBundleShellScript)(input)).toBe(expectedOutput);
173
274
  });
174
275
  });
175
- describe('findBundlePhase', () => {
176
- it('returns build phase with react native xcode shell script', () => {
276
+ (0, vitest_1.describe)('findBundlePhase', () => {
277
+ (0, vitest_1.it)('returns build phase with react native xcode shell script', () => {
177
278
  const inputMap = {
178
279
  1: {
179
280
  shellScript: 'foo',
@@ -203,9 +304,9 @@ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
203
304
 
204
305
  `,
205
306
  };
206
- expect((0, xcode_1.findBundlePhase)(inputMap)).toEqual(expected);
307
+ (0, vitest_1.expect)((0, xcode_1.findBundlePhase)(inputMap)).toEqual(expected);
207
308
  });
208
- it('returns undefined if bundle phase not present', () => {
309
+ (0, vitest_1.it)('returns undefined if bundle phase not present', () => {
209
310
  const inputMap = {
210
311
  1: {
211
312
  shellScript: 'foo',
@@ -227,11 +328,11 @@ REACT_NATIVE_XCODE="../node_modules/react-native/unknown/react-native-xcode.sh"
227
328
  shellScript: 'qux',
228
329
  },
229
330
  };
230
- expect((0, xcode_1.findBundlePhase)(inputMap)).toBeUndefined();
331
+ (0, vitest_1.expect)((0, xcode_1.findBundlePhase)(inputMap)).toBeUndefined();
231
332
  });
232
333
  });
233
- describe('doesBundlePhaseIncludeSentry', () => {
234
- it('returns true for script containing sentry cli calling react native xcode command', () => {
334
+ (0, vitest_1.describe)('doesBundlePhaseIncludeSentry', () => {
335
+ (0, vitest_1.it)('returns true for script containing sentry cli calling react native xcode command', () => {
235
336
  const input = {
236
337
  shellScript: `set -e
237
338
  WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
@@ -241,9 +342,9 @@ SENTRY_CLI="sentry-cli react-native xcode"
241
342
  /bin/sh -c "$WITH_ENVIRONMENT \"$SENTRY_CLI $REACT_NATIVE_XCODE\""
242
343
  `,
243
344
  };
244
- expect((0, xcode_1.doesBundlePhaseIncludeSentry)(input)).toBeTruthy();
345
+ (0, vitest_1.expect)((0, xcode_1.doesBundlePhaseIncludeSentry)(input)).toBeTruthy();
245
346
  });
246
- it('returns true for script containing sentry bundled script', () => {
347
+ (0, vitest_1.it)('returns true for script containing sentry bundled script', () => {
247
348
  const input = {
248
349
  shellScript: `set -e
249
350
  WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
@@ -253,9 +354,9 @@ SENTRY_CLI="sentry-cli react-native xcode"
253
354
  /bin/sh -c "$WITH_ENVIRONMENT \\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE"\\"
254
355
  `,
255
356
  };
256
- expect((0, xcode_1.doesBundlePhaseIncludeSentry)(input)).toBeTruthy();
357
+ (0, vitest_1.expect)((0, xcode_1.doesBundlePhaseIncludeSentry)(input)).toBeTruthy();
257
358
  });
258
- it('returns false', () => {
359
+ (0, vitest_1.it)('returns false', () => {
259
360
  const input = {
260
361
  // note sentry-cli can be part of the script but doesn't call react native xcode script
261
362
  shellScript: `set -e
@@ -267,11 +368,11 @@ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
267
368
  sentry-cli --version
268
369
  `,
269
370
  };
270
- expect((0, xcode_1.doesBundlePhaseIncludeSentry)(input)).toBeFalsy();
371
+ (0, vitest_1.expect)((0, xcode_1.doesBundlePhaseIncludeSentry)(input)).toBeFalsy();
271
372
  });
272
373
  });
273
- describe('findDebugFilesUploadPhase', () => {
274
- it('returns debug files build phase using debug files command', () => {
374
+ (0, vitest_1.describe)('findDebugFilesUploadPhase', () => {
375
+ (0, vitest_1.it)('returns debug files build phase using debug files command', () => {
275
376
  const input = {
276
377
  1: {
277
378
  shellScript: 'foo',
@@ -290,9 +391,9 @@ sentry-cli debug-files upload path/to/dsym --include-sources
290
391
  `,
291
392
  },
292
393
  ];
293
- expect((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
394
+ (0, vitest_1.expect)((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
294
395
  });
295
- it('returns debug files build phase with sentry-cli absolute path', () => {
396
+ (0, vitest_1.it)('returns debug files build phase with sentry-cli absolute path', () => {
296
397
  const input = {
297
398
  1: {
298
399
  shellScript: 'foo',
@@ -311,9 +412,9 @@ sentry-cli debug-files upload path/to/dsym --include-sources
311
412
  `,
312
413
  },
313
414
  ];
314
- expect((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
415
+ (0, vitest_1.expect)((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
315
416
  });
316
- it('returns debug files build phase using dsym command', () => {
417
+ (0, vitest_1.it)('returns debug files build phase using dsym command', () => {
317
418
  const input = {
318
419
  1: {
319
420
  shellScript: 'foo',
@@ -332,9 +433,9 @@ sentry-cli upload-dsym path/to/dsym --include-sources
332
433
  `,
333
434
  },
334
435
  ];
335
- expect((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
436
+ (0, vitest_1.expect)((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
336
437
  });
337
- it('returns debug files build phase using bundled scripts', () => {
438
+ (0, vitest_1.it)('returns debug files build phase using bundled scripts', () => {
338
439
  const input = {
339
440
  1: {
340
441
  shellScript: 'foo',
@@ -349,9 +450,9 @@ sentry-cli upload-dsym path/to/dsym --include-sources
349
450
  shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,
350
451
  },
351
452
  ];
352
- expect((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
453
+ (0, vitest_1.expect)((0, xcode_1.findDebugFilesUploadPhase)(input)).toEqual(expected);
353
454
  });
354
- it('returns undefined if build phase not present', () => {
455
+ (0, vitest_1.it)('returns undefined if build phase not present', () => {
355
456
  const input = {
356
457
  1: {
357
458
  shellScript: 'foo',
@@ -361,7 +462,7 @@ sentry-cli upload-dsym path/to/dsym --include-sources
361
462
  shellScript: 'sentry-cli sourcempas upload',
362
463
  },
363
464
  };
364
- expect((0, xcode_1.findDebugFilesUploadPhase)(input)).toBeUndefined();
465
+ (0, vitest_1.expect)((0, xcode_1.findDebugFilesUploadPhase)(input)).toBeUndefined();
365
466
  });
366
467
  });
367
468
  });
@@ -1 +1 @@
1
- {"version":3,"file":"xcode.test.js","sourceRoot":"","sources":["../../../test/react-native/xcode.test.ts"],"names":[],"mappings":";;AAAA,sCAAsC;AACtC,wDAOsC;AAEtC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;QACnD,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,KAAK,GAAG;;;;;mDAK+B,CAAC;YAC9C,uCAAuC;YACvC,yDAAyD;YACzD,sDAAsD;YACtD,MAAM,cAAc,GAAG;;;;;;;;;CAS5B,CAAC;YAEI,MAAM,CAAC,IAAA,2CAAmC,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAC1D,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,KAAK,GAAG;;;;;mDAK+B,CAA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AAG;gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,WAAW,EAAE;;CAEtB;iBACQ;aACF,CAAC;YACF,MAAM,QAAQ,GAAG;gBACf,GAAG;gBACH;oBACE,WAAW,EAAE;;CAEtB;iBACQ;aACF,CAAC;YACF,MAAM,CAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAC/D,MAAM,KAAK,GAAG;gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,MAAM,QAAQ,GAAG;gBACf,GAAG;gBACH;oBACE,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,MAAM,CAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,KAAK,GAAG;gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,gDAAgD;oBAChD,WAAW,EAAE,8BAA8B;iBAC5C;aACF,CAAC;YAEF,MAAM,CAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-useless-escape */\nimport {\n addSentryWithBundledScriptsToBundleShellScript,\n addSentryWithCliToBundleShellScript,\n doesBundlePhaseIncludeSentry,\n findBundlePhase,\n findDebugFilesUploadPhase,\n removeSentryFromBundleShellScript,\n} from '../../src/react-native/xcode';\n\ndescribe('react-native xcode', () => {\n describe('addSentryWithCliToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"\"\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\n`;\n\n expect(addSentryWithCliToBundleShellScript(input)).toBe(expectedOutput);\n });\n });\n\n describe('addSentryBundledScriptsToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\\\"\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('adds sentry cli to expo bundle build phase', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n\\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n const expectedOutput = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\` \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n });\n\n describe('removeSentryFromBundleShellScript', () => {\n it('removes sentry cli from rn bundle build phase', () => {\n const input = `export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\"\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\n`;\n const expectedOutput = `export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`;\n\n expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);\n });\n\n it('removes sentry bundled scripts from rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\"\"`;\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"`;\n\n expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);\n });\n });\n\n describe('findBundlePhase', () => {\n it('returns build phase with react native xcode shell script', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n const expected = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n };\n\n expect(findBundlePhase(inputMap)).toEqual(expected);\n });\n\n it('returns undefined if bundle phase not present', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n // note different path to the script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/unknown/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n expect(findBundlePhase(inputMap)).toBeUndefined();\n });\n });\n\n describe('doesBundlePhaseIncludeSentry', () => {\n it('returns true for script containing sentry cli calling react native xcode command', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$SENTRY_CLI $REACT_NATIVE_XCODE\\\"\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns true for script containing sentry bundled script', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\"\\\\\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns false', () => {\n const input = {\n // note sentry-cli can be part of the script but doesn't call react native xcode script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\nsentry-cli --version\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeFalsy();\n });\n });\n\n describe('findDebugFilesUploadPhase', () => {\n it('returns debug files build phase using debug files command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase with sentry-cli absolute path', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using dsym command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using bundled scripts', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns undefined if build phase not present', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n // sentry-cli present but with different command\n shellScript: 'sentry-cli sourcempas upload',\n },\n };\n\n expect(findDebugFilesUploadPhase(input)).toBeUndefined();\n });\n });\n});\n"]}
1
+ {"version":3,"file":"xcode.test.js","sourceRoot":"","sources":["../../../test/react-native/xcode.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,mCAAyE;AACzE,wDAQsC;AACtC,kDAA0B;AAC1B,iDAAwD;AACxD,+EAA+E;AAC/E,sDAAwC;AAExC,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,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAA,mBAAU,EAAC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C;aACF,CAAC;YAEF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-useless-escape */\nimport { describe, expect, it, afterEach, beforeEach, vi } from 'vitest';\nimport {\n addSentryWithBundledScriptsToBundleShellScript,\n addSentryWithCliToBundleShellScript,\n doesBundlePhaseIncludeSentry,\n findBundlePhase,\n findDebugFilesUploadPhase,\n removeSentryFromBundleShellScript,\n ErrorPatchSnippet,\n} from '../../src/react-native/xcode';\nimport chalk from 'chalk';\nimport { makeCodeSnippet } from '../../src/utils/clack';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n\nvi.mock('@clack/prompts', async () => ({\n __esModule: true,\n ...(await vi.importActual<typeof clack>('@clack/prompts')),\n}));\n\ndescribe('react-native xcode', () => {\n beforeEach(() => {\n vi.spyOn(clack.log, 'error').mockImplementation(() => {\n /* empty */\n });\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe('addSentryWithCliToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"\"\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\n`;\n\n expect(addSentryWithCliToBundleShellScript(input)).toBe(expectedOutput);\n });\n\n it('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE\"`;\n\n expect(addSentryWithCliToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`${plus(`export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\n`)}\n/bin/sh -c \"$WITH_ENVIRONMENT ${plus(\n `\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode`,\n )} $REACT_NATIVE_XCODE${plus(`\\\\\"`)}\"\n${plus(\n `/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh`,\n)}\"\n`);\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Could not find $REACT_NATIVE_XCODE in ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase. Skipping patching.`,\n );\n });\n });\n\n describe('addSentryBundledScriptsToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\\\"\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {\n const input = `set -e\n \n WITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\n REACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n \n /bin/sh -c \"$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT ${plus(\n `\\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh `,\n )}$REACT_NATIVE_XCODE${plus(`\\\\\"`)}\"\n`);\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Failed to patch ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n });\n\n it('adds sentry cli to expo bundle build phase', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n\\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n const expectedOutput = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\` \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('if patching fails it does not add sentry cli to expo bundle build phase and shows code snippet', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n`;\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(\n `${plus(\n `/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\``,\n )} \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\``,\n );\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Failed to patch ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n });\n });\n\n describe('removeSentryFromBundleShellScript', () => {\n it('removes sentry cli from rn bundle build phase', () => {\n const input = `export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\"\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\n`;\n const expectedOutput = `export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`;\n\n expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);\n });\n\n it('removes sentry bundled scripts from rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\"\"`;\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"`;\n\n expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);\n });\n });\n\n describe('findBundlePhase', () => {\n it('returns build phase with react native xcode shell script', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n const expected = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n };\n\n expect(findBundlePhase(inputMap)).toEqual(expected);\n });\n\n it('returns undefined if bundle phase not present', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n // note different path to the script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/unknown/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n expect(findBundlePhase(inputMap)).toBeUndefined();\n });\n });\n\n describe('doesBundlePhaseIncludeSentry', () => {\n it('returns true for script containing sentry cli calling react native xcode command', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$SENTRY_CLI $REACT_NATIVE_XCODE\\\"\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns true for script containing sentry bundled script', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\"\\\\\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns false', () => {\n const input = {\n // note sentry-cli can be part of the script but doesn't call react native xcode script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\nsentry-cli --version\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeFalsy();\n });\n });\n\n describe('findDebugFilesUploadPhase', () => {\n it('returns debug files build phase using debug files command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase with sentry-cli absolute path', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using dsym command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using bundled scripts', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns undefined if build phase not present', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n // sentry-cli present but with different command\n shellScript: 'sentry-cli sourcempas upload',\n },\n };\n\n expect(findDebugFilesUploadPhase(input)).toBeUndefined();\n });\n });\n});\n"]}
@@ -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 {
@@ -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,7 +51,7 @@ 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
+ (0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
54
55
  "import * as Sentry from "@sentry/remix";
55
56
 
56
57
  Sentry.init({
@@ -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 {
@@ -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 * 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,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"]}