@sentry/wizard 6.5.0 → 6.6.1

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 (65) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +1 -0
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +1 -0
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/expo.test.js +4 -1
  7. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/nuxt-3.test.js +6 -0
  9. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/nuxt-4.test.js +6 -0
  11. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/react-native.test.js +5 -2
  13. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/remix.test.js +2 -1
  15. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/sveltekit-hooks.test.js +13 -2
  17. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +4 -0
  19. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
  20. package/dist/src/angular/codemods/main.js +1 -0
  21. package/dist/src/angular/codemods/main.js.map +1 -1
  22. package/dist/src/apple/templates.js +0 -2
  23. package/dist/src/apple/templates.js.map +1 -1
  24. package/dist/src/nextjs/nextjs-wizard.js +1 -1
  25. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  26. package/dist/src/nextjs/templates.js +6 -4
  27. package/dist/src/nextjs/templates.js.map +1 -1
  28. package/dist/src/nuxt/templates.js +10 -2
  29. package/dist/src/nuxt/templates.js.map +1 -1
  30. package/dist/src/react-native/react-native-wizard.js +3 -3
  31. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  32. package/dist/src/react-native/xcode.d.ts +2 -2
  33. package/dist/src/react-native/xcode.js +8 -13
  34. package/dist/src/react-native/xcode.js.map +1 -1
  35. package/dist/src/remix/sdk-setup.js +1 -0
  36. package/dist/src/remix/sdk-setup.js.map +1 -1
  37. package/dist/src/sveltekit/sdk-setup/setup.d.ts +6 -0
  38. package/dist/src/sveltekit/sdk-setup/setup.js +4 -1
  39. package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
  40. package/dist/src/sveltekit/templates.js +9 -0
  41. package/dist/src/sveltekit/templates.js.map +1 -1
  42. package/dist/src/utils/clack/index.js +10 -3
  43. package/dist/src/utils/clack/index.js.map +1 -1
  44. package/dist/src/version.d.ts +1 -1
  45. package/dist/src/version.js +1 -1
  46. package/dist/src/version.js.map +1 -1
  47. package/dist/test/angular/angular-wizard.test.js +113 -17
  48. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  49. package/dist/test/apple/code-tools.test.js +0 -3
  50. package/dist/test/apple/code-tools.test.js.map +1 -1
  51. package/dist/test/apple/templates.test.js +0 -4
  52. package/dist/test/apple/templates.test.js.map +1 -1
  53. package/dist/test/nextjs/templates.test.js +33 -22
  54. package/dist/test/nextjs/templates.test.js.map +1 -1
  55. package/dist/test/nuxt/templates.test.js +50 -10
  56. package/dist/test/nuxt/templates.test.js.map +1 -1
  57. package/dist/test/react-native/xcode.test.js +14 -13
  58. package/dist/test/react-native/xcode.test.js.map +1 -1
  59. package/dist/test/remix/client-entry.test.js +10 -4
  60. package/dist/test/remix/client-entry.test.js.map +1 -1
  61. package/dist/test/sveltekit/templates.test.js +214 -0
  62. package/dist/test/sveltekit/templates.test.js.map +1 -1
  63. package/dist/test/utils/clack/index.test.js +1 -1
  64. package/dist/test/utils/clack/index.test.js.map +1 -1
  65. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"xcode.test.js","sourceRoot":"","sources":["../../../test/react-native/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E,kFAAkF;iBAChG;aACF,CAAC;YACF,MAAM,QAAQ,GAAG;gBACf,GAAG;gBACH;oBACE,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,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,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 doesBundlePhaseIncludeSentry,\n findBundlePhase,\n findDebugFilesUploadPhase,\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\nconst rnVersionWithQuotes = '0.81.0';\nconst rnVersionWithoutQuotes = '0.81.1';\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('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(\n addSentryWithBundledScriptsToBundleShellScript(\n input,\n rnVersionWithQuotes,\n ),\n ).toBe(expectedOutput);\n });\n\n it('does not add with-environment.sh parameter quotes for RN version >= 0.81.1 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 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(\n addSentryWithBundledScriptsToBundleShellScript(\n input,\n rnVersionWithoutQuotes,\n ),\n ).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 \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(\n addSentryWithBundledScriptsToBundleShellScript(\n input,\n rnVersionWithQuotes,\n ),\n ).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(\n addSentryWithBundledScriptsToBundleShellScript(\n input,\n rnVersionWithQuotes,\n ),\n ).toBe(expectedOutput);\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(\n addSentryWithBundledScriptsToBundleShellScript(\n input,\n rnVersionWithQuotes,\n ),\n ).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('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,wDAMsC;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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8B;iBAC5C;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 doesBundlePhaseIncludeSentry,\n findBundlePhase,\n findDebugFilesUploadPhase,\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('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\"\nSENTRY_XCODE=\"../node_modules/@sentry/react-native/scripts/sentry-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $SENTRY_XCODE\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('adds sentry cli to rn bundle build phase for versions of RN that use REACT_NATIVE_PATH env variable', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/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\"\nSENTRY_XCODE=\"$REACT_NATIVE_PATH/../@sentry/react-native/scripts/sentry-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $SENTRY_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('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"]}
@@ -40,7 +40,8 @@ const vitest_1 = require("vitest");
40
40
  })],
41
41
 
42
42
  replaysSessionSampleRate: 0.1,
43
- replaysOnErrorSampleRate: 1
43
+ replaysOnErrorSampleRate: 1,
44
+ sendDefaultPii: true
44
45
  })"
45
46
  `);
46
47
  });
@@ -66,7 +67,8 @@ const vitest_1 = require("vitest");
66
67
  })],
67
68
 
68
69
  replaysSessionSampleRate: 0.1,
69
- replaysOnErrorSampleRate: 1
70
+ replaysOnErrorSampleRate: 1,
71
+ sendDefaultPii: true
70
72
  })"
71
73
  `);
72
74
  });
@@ -98,7 +100,9 @@ const vitest_1 = require("vitest");
98
100
  useEffect,
99
101
  useLocation,
100
102
  useMatches
101
- })]
103
+ })],
104
+
105
+ sendDefaultPii: true
102
106
  })"
103
107
  `);
104
108
  });
@@ -150,7 +154,9 @@ const vitest_1 = require("vitest");
150
154
  useEffect,
151
155
  useLocation,
152
156
  useMatches
153
- })]
157
+ })],
158
+
159
+ sendDefaultPii: true
154
160
  })"
155
161
  `);
156
162
  });
@@ -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;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,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,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 logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, replayIntegration, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when performance disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: false,\n replay: true,\n logs: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init, replayIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n\n integrations: [replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when replay disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: false,\n logs: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })]\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry with only logs 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: false,\n replay: false,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n enableLogs: true\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry with performance and logs 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: false,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [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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AAK;YACb,IAAI,EAAE,IAAI;SACX,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;;;;;;;;;;;;;;;;;;;;;;;KAuBpD,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 logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, replayIntegration, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n sendDefaultPii: true\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 logs: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init, replayIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n\n integrations: [replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n sendDefaultPii: true\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 logs: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })],\n\n sendDefaultPii: true\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry with only logs 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: false,\n replay: false,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n enableLogs: true\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry with performance and logs 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: false,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })],\n\n sendDefaultPii: true\n })\"\n `);\n });\n});\n"]}
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
4
  const templates_1 = require("../../src/sveltekit/templates");
5
+ const setup_1 = require("../../src/sveltekit/sdk-setup/setup");
6
+ // @ts-expect-error - magicast is ESM and TS complains about that. It works though
7
+ const magicast_1 = require("magicast");
5
8
  vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
6
9
  offerProjectScopedMcpConfig: vitest_1.vi.fn().mockResolvedValue(undefined),
7
10
  }));
@@ -34,6 +37,10 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
34
37
 
35
38
  // If you don't want to use Session Replay, just remove the line below:
36
39
  integrations: [replayIntegration()],
40
+
41
+ // Enable sending user PII (Personally Identifiable Information)
42
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
43
+ sendDefaultPii: true,
37
44
  });
38
45
 
39
46
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -65,6 +72,10 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
65
72
 
66
73
  // If you don't want to use Session Replay, just remove the line below:
67
74
  integrations: [replayIntegration()],
75
+
76
+ // Enable sending user PII (Personally Identifiable Information)
77
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
78
+ sendDefaultPii: true,
68
79
  });
69
80
 
70
81
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -89,6 +100,10 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
89
100
 
90
101
 
91
102
 
103
+
104
+ // Enable sending user PII (Personally Identifiable Information)
105
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
106
+ sendDefaultPii: true,
92
107
  });
93
108
 
94
109
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -113,6 +128,10 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
113
128
  enableLogs: true,
114
129
 
115
130
 
131
+
132
+ // Enable sending user PII (Personally Identifiable Information)
133
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
134
+ sendDefaultPii: true,
116
135
  });
117
136
 
118
137
  // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
@@ -141,6 +160,11 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
141
160
  // Enable logs to be sent to Sentry
142
161
  enableLogs: true,
143
162
 
163
+
164
+ // Enable sending user PII (Personally Identifiable Information)
165
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
166
+ sendDefaultPii: true,
167
+
144
168
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
145
169
  // spotlight: import.meta.env.DEV,
146
170
  });
@@ -168,6 +192,11 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
168
192
  dsn: 'https://sentry.io/123',
169
193
 
170
194
 
195
+
196
+ // Enable sending user PII (Personally Identifiable Information)
197
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
198
+ sendDefaultPii: true,
199
+
171
200
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
172
201
  // spotlight: import.meta.env.DEV,
173
202
  });
@@ -197,6 +226,11 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
197
226
  // Enable logs to be sent to Sentry
198
227
  enableLogs: true,
199
228
 
229
+
230
+ // Enable sending user PII (Personally Identifiable Information)
231
+ // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
232
+ sendDefaultPii: true,
233
+
200
234
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
201
235
  // spotlight: import.meta.env.DEV,
202
236
  });
@@ -303,4 +337,184 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
303
337
  });"`);
304
338
  });
305
339
  });
340
+ (0, vitest_1.describe)('insertClientInitCall', () => {
341
+ (0, vitest_1.it)('should insert client init call with all features enabled', () => {
342
+ const originalHooksMod = (0, magicast_1.parseModule)(`
343
+ import { handleErrorWithSentry } from "@sentry/sveltekit";
344
+ import * as Sentry from "@sentry/sveltekit";
345
+
346
+ export const handleError = handleErrorWithSentry();
347
+ `);
348
+ (0, setup_1.insertClientInitCall)('https://sentry.io/123', originalHooksMod, {
349
+ performance: true,
350
+ replay: true,
351
+ logs: true,
352
+ });
353
+ const result = originalHooksMod.generate().code;
354
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
355
+ "import { handleErrorWithSentry } from "@sentry/sveltekit";
356
+ import * as Sentry from "@sentry/sveltekit";
357
+
358
+ // If you don't want to use Session Replay, remove the \`Replay\` integration,
359
+ // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
360
+ Sentry.init({
361
+ dsn: "https://sentry.io/123",
362
+ tracesSampleRate: 1,
363
+ replaysSessionSampleRate: 0.1,
364
+ replaysOnErrorSampleRate: 1,
365
+ integrations: [Sentry.replayIntegration()],
366
+ enableLogs: true,
367
+ sendDefaultPii: true
368
+ })
369
+
370
+ export const handleError = handleErrorWithSentry();"
371
+ `);
372
+ });
373
+ (0, vitest_1.it)('should insert client init call with performance disabled', () => {
374
+ const originalHooksMod = (0, magicast_1.parseModule)(`
375
+ import { handleErrorWithSentry } from "@sentry/sveltekit";
376
+ import * as Sentry from "@sentry/sveltekit";
377
+
378
+ export const handleError = handleErrorWithSentry();
379
+ `);
380
+ (0, setup_1.insertClientInitCall)('https://sentry.io/456', originalHooksMod, {
381
+ performance: false,
382
+ replay: true,
383
+ logs: false,
384
+ });
385
+ const result = originalHooksMod.generate().code;
386
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
387
+ "import { handleErrorWithSentry } from "@sentry/sveltekit";
388
+ import * as Sentry from "@sentry/sveltekit";
389
+
390
+ // If you don't want to use Session Replay, remove the \`Replay\` integration,
391
+ // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
392
+ Sentry.init({
393
+ dsn: "https://sentry.io/456",
394
+ replaysSessionSampleRate: 0.1,
395
+ replaysOnErrorSampleRate: 1,
396
+ integrations: [Sentry.replayIntegration()],
397
+ sendDefaultPii: true
398
+ })
399
+
400
+ export const handleError = handleErrorWithSentry();"
401
+ `);
402
+ });
403
+ (0, vitest_1.it)('should insert client init call with replay disabled', () => {
404
+ const originalHooksMod = (0, magicast_1.parseModule)(`
405
+ import { handleErrorWithSentry } from "@sentry/sveltekit";
406
+ import * as Sentry from "@sentry/sveltekit";
407
+
408
+ export const handleError = handleErrorWithSentry();
409
+ `);
410
+ (0, setup_1.insertClientInitCall)('https://sentry.io/789', originalHooksMod, {
411
+ performance: true,
412
+ replay: false,
413
+ logs: true,
414
+ });
415
+ const result = originalHooksMod.generate().code;
416
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
417
+ "import { handleErrorWithSentry } from "@sentry/sveltekit";
418
+ import * as Sentry from "@sentry/sveltekit";
419
+
420
+ // If you don't want to use Session Replay, remove the \`Replay\` integration,
421
+ // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
422
+ Sentry.init({
423
+ dsn: "https://sentry.io/789",
424
+ tracesSampleRate: 1,
425
+ enableLogs: true,
426
+ sendDefaultPii: true
427
+ })
428
+
429
+ export const handleError = handleErrorWithSentry();"
430
+ `);
431
+ });
432
+ (0, vitest_1.it)('should insert client init call with only logs enabled', () => {
433
+ const originalHooksMod = (0, magicast_1.parseModule)(`
434
+ import { handleErrorWithSentry } from "@sentry/sveltekit";
435
+ import * as Sentry from "@sentry/sveltekit";
436
+
437
+ export const handleError = handleErrorWithSentry();
438
+ `);
439
+ (0, setup_1.insertClientInitCall)('https://sentry.io/xyz', originalHooksMod, {
440
+ performance: false,
441
+ replay: false,
442
+ logs: true,
443
+ });
444
+ const result = originalHooksMod.generate().code;
445
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
446
+ "import { handleErrorWithSentry } from "@sentry/sveltekit";
447
+ import * as Sentry from "@sentry/sveltekit";
448
+
449
+ // If you don't want to use Session Replay, remove the \`Replay\` integration,
450
+ // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
451
+ Sentry.init({
452
+ dsn: "https://sentry.io/xyz",
453
+ enableLogs: true,
454
+ sendDefaultPii: true
455
+ })
456
+
457
+ export const handleError = handleErrorWithSentry();"
458
+ `);
459
+ });
460
+ (0, vitest_1.it)('should insert client init call with all features disabled', () => {
461
+ const originalHooksMod = (0, magicast_1.parseModule)(`
462
+ import { handleErrorWithSentry } from "@sentry/sveltekit";
463
+ import * as Sentry from "@sentry/sveltekit";
464
+
465
+ export const handleError = handleErrorWithSentry();
466
+ `);
467
+ (0, setup_1.insertClientInitCall)('https://sentry.io/minimal', originalHooksMod, {
468
+ performance: false,
469
+ replay: false,
470
+ logs: false,
471
+ });
472
+ const result = originalHooksMod.generate().code;
473
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
474
+ "import { handleErrorWithSentry } from "@sentry/sveltekit";
475
+ import * as Sentry from "@sentry/sveltekit";
476
+
477
+ // If you don't want to use Session Replay, remove the \`Replay\` integration,
478
+ // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
479
+ Sentry.init({
480
+ dsn: "https://sentry.io/minimal",
481
+ sendDefaultPii: true
482
+ })
483
+
484
+ export const handleError = handleErrorWithSentry();"
485
+ `);
486
+ });
487
+ (0, vitest_1.it)('should insert init call after imports', () => {
488
+ const originalHooksMod = (0, magicast_1.parseModule)(`
489
+ import { handleErrorWithSentry } from "@sentry/sveltekit";
490
+ import { somethingElse } from "some-package";
491
+ import * as Sentry from "@sentry/sveltekit";
492
+
493
+ export const handleError = handleErrorWithSentry();
494
+ export const someOtherExport = somethingElse();
495
+ `);
496
+ (0, setup_1.insertClientInitCall)('https://sentry.io/order-test', originalHooksMod, {
497
+ performance: true,
498
+ replay: false,
499
+ logs: false,
500
+ });
501
+ const result = originalHooksMod.generate().code;
502
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
503
+ "import { handleErrorWithSentry } from "@sentry/sveltekit";
504
+ import { somethingElse } from "some-package";
505
+ import * as Sentry from "@sentry/sveltekit";
506
+
507
+ // If you don't want to use Session Replay, remove the \`Replay\` integration,
508
+ // \`replaysSessionSampleRate\` and \`replaysOnErrorSampleRate\` options.
509
+ Sentry.init({
510
+ dsn: "https://sentry.io/order-test",
511
+ tracesSampleRate: 1,
512
+ sendDefaultPii: true
513
+ })
514
+
515
+ export const handleError = handleErrorWithSentry();
516
+ export const someOtherExport = somethingElse();"
517
+ `);
518
+ });
519
+ });
306
520
  //# sourceMappingURL=templates.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAIuC;AAEvC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,C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AC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAIuC;AACvC,+DAA2E;AAC3E,kFAAkF;AAClF,uCAAuC;AAEvC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;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vi } from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\nimport { insertClientInitCall } from '../../src/sveltekit/sdk-setup/setup';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n\ndescribe('insertClientInitCall', () => {\n it('should insert client init call with all features enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/123', originalHooksMod, {\n performance: true,\n replay: true,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with performance disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/456', originalHooksMod, {\n performance: false,\n replay: true,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/456\",\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with replay disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/789', originalHooksMod, {\n performance: true,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/789\",\n tracesSampleRate: 1,\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with only logs enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/xyz', originalHooksMod, {\n performance: false,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/xyz\",\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with all features disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/minimal', originalHooksMod, {\n performance: false,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/minimal\",\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert init call after imports', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\n `);\n\n insertClientInitCall('https://sentry.io/order-test', originalHooksMod, {\n performance: true,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/order-test\",\n tracesSampleRate: 1,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\"\n `);\n });\n});\n"]}
@@ -277,7 +277,7 @@ function mockUserResponse(fn, response) {
277
277
  }),
278
278
  captureSession: vitest_1.vi.fn(),
279
279
  });
280
- const flushSpy = vitest_1.vi.fn();
280
+ const flushSpy = vitest_1.vi.fn(() => Promise.resolve(true));
281
281
  vitest_1.vi.spyOn(Sentry, 'flush').mockImplementation(flushSpy);
282
282
  (0, vitest_1.it)('ends the process with an error exit code by default', async () => {
283
283
  // @ts-expect-error - vitest doesn't like the empty function