@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
@@ -27,57 +27,57 @@ const fs = __importStar(require("fs"));
27
27
  const sentry_cli_1 = require("../../../src/sourcemaps/tools/sentry-cli");
28
28
  const packageManagerHelpers = __importStar(require("../../../src/utils/package-manager"));
29
29
  const clack_1 = require("../../../src/utils/clack");
30
- const writeFileSpy = jest
30
+ const vitest_1 = require("vitest");
31
+ const writeFileSpy = vitest_1.vi
31
32
  .spyOn(fs.promises, 'writeFile')
32
33
  .mockImplementation(() => Promise.resolve());
33
- jest.mock('@clack/prompts', () => {
34
+ vitest_1.vi.mock('@clack/prompts', () => {
34
35
  return {
35
36
  log: {
36
- info: jest.fn(),
37
- success: jest.fn(),
37
+ info: vitest_1.vi.fn(),
38
+ success: vitest_1.vi.fn(),
38
39
  },
39
- confirm: jest.fn().mockResolvedValue(true),
40
- isCancel: jest.fn().mockReturnValue(false),
40
+ confirm: vitest_1.vi.fn().mockResolvedValue(true),
41
+ isCancel: vitest_1.vi.fn().mockReturnValue(false),
41
42
  };
42
43
  });
43
44
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
44
- jest.mock('../../../src/utils/clack', () => ({
45
- ...jest.requireActual('../../../src/utils/clack'),
46
- getPackageDotJson: jest.fn().mockResolvedValue({
45
+ vitest_1.vi.mock('../../../src/utils/clack', async () => ({
46
+ ...(await vitest_1.vi.importActual('../../../src/utils/clack')),
47
+ getPackageDotJson: vitest_1.vi.fn().mockResolvedValue({
47
48
  scripts: {
48
49
  build: 'tsc',
49
50
  },
50
51
  version: '1.0.0',
51
52
  }),
52
53
  }));
53
- describe('addSentryCommandToBuildCommand', () => {
54
- afterEach(() => {
55
- jest.clearAllMocks();
54
+ (0, vitest_1.describe)('addSentryCommandToBuildCommand', () => {
55
+ (0, vitest_1.afterEach)(() => {
56
+ vitest_1.vi.clearAllMocks();
56
57
  });
57
- it.each([
58
+ vitest_1.it.each([
58
59
  [
59
60
  packageManagerHelpers.NPM,
60
61
  packageManagerHelpers.PNPM,
61
62
  packageManagerHelpers.YARN_V1,
62
63
  packageManagerHelpers.YARN_V2,
63
64
  packageManagerHelpers.BUN,
65
+ packageManagerHelpers.DENO,
64
66
  ],
65
67
  ])('adds the cli command to the script command (%s)', async (_, pacMan) => {
66
- jest
67
- .spyOn(packageManagerHelpers, '_detectPackageManger')
68
- .mockReturnValue(pacMan);
68
+ vitest_1.vi.spyOn(packageManagerHelpers, '_detectPackageManger').mockReturnValue(pacMan);
69
69
  await (0, sentry_cli_1.addSentryCommandToBuildCommand)();
70
- expect(writeFileSpy).toHaveBeenCalledWith(expect.stringContaining('package.json'), expect.stringContaining(`tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`));
70
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledWith(vitest_1.expect.stringContaining('package.json'), vitest_1.expect.stringContaining(`tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`));
71
71
  });
72
- it('does not add the cli command to the script command if it is already in there', async () => {
73
- jest.mocked(clack_1.getPackageDotJson).mockResolvedValue({
72
+ (0, vitest_1.it)('does not add the cli command to the script command if it is already in there', async () => {
73
+ vitest_1.vi.mocked(clack_1.getPackageDotJson).mockResolvedValue({
74
74
  scripts: {
75
75
  build: 'tsc && sentry:sourcemaps',
76
76
  },
77
77
  version: '1.0.0',
78
78
  });
79
79
  await (0, sentry_cli_1.addSentryCommandToBuildCommand)();
80
- expect(writeFileSpy).not.toHaveBeenCalled();
80
+ (0, vitest_1.expect)(writeFileSpy).not.toHaveBeenCalled();
81
81
  });
82
82
  });
83
83
  //# sourceMappingURL=sentry-cli.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-cli.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/sentry-cli.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,yEAA0F;AAE1F,0FAA4E;AAC5E,oDAA6D;AAC7D,MAAM,YAAY,GAAG,IAAI;KACtB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CA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YAAY,CAAC,CAAC,oBAAoB,CACvC,MAAM,CAAC,gBAAgB,CAAC,cAAc,CAAC,EACvC,MAAM,CAAC,gBAAgB,CACrB,UAAU,MAAM,CAAC,gBAAgB,oBAAoB,CACtD,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;QAC5F,IAAI,CAAC,MAAM,CAAC,yBAAiB,CAAC,CAAC,iBAAiB,CAAC;YAC/C,OAAO,EAAE;gBACP,KAAK,EAAE,0BAA0B;aAClC;YACD,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAEH,MAAM,IAAA,2CAA8B,GAAE,CAAC;QAEvC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { addSentryCommandToBuildCommand } from '../../../src/sourcemaps/tools/sentry-cli';\n\nimport * as packageManagerHelpers from '../../../src/utils/package-manager';\nimport { getPackageDotJson } from '../../../src/utils/clack';\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve());\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n confirm: jest.fn().mockResolvedValue(true),\n isCancel: jest.fn().mockReturnValue(false),\n };\n});\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-return\njest.mock('../../../src/utils/clack', () => ({\n ...jest.requireActual('../../../src/utils/clack'),\n getPackageDotJson: jest.fn().mockResolvedValue({\n scripts: {\n build: 'tsc',\n },\n version: '1.0.0',\n }),\n}));\n\ndescribe('addSentryCommandToBuildCommand', () => {\n afterEach(() => {\n jest.clearAllMocks();\n });\n it.each([\n [\n packageManagerHelpers.NPM,\n packageManagerHelpers.PNPM,\n packageManagerHelpers.YARN_V1,\n packageManagerHelpers.YARN_V2,\n packageManagerHelpers.BUN,\n ],\n ])('adds the cli command to the script command (%s)', async (_, pacMan) => {\n jest\n .spyOn(packageManagerHelpers, '_detectPackageManger')\n .mockReturnValue(pacMan);\n await addSentryCommandToBuildCommand();\n expect(writeFileSpy).toHaveBeenCalledWith(\n expect.stringContaining('package.json'),\n expect.stringContaining(\n `tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`,\n ),\n );\n });\n\n it('does not add the cli command to the script command if it is already in there', async () => {\n jest.mocked(getPackageDotJson).mockResolvedValue({\n scripts: {\n build: 'tsc && sentry:sourcemaps',\n },\n version: '1.0.0',\n });\n\n await addSentryCommandToBuildCommand();\n\n expect(writeFileSpy).not.toHaveBeenCalled();\n });\n});\n"]}
1
+ {"version":3,"file":"sentry-cli.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/sentry-cli.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,yEAA0F;AAE1F,0FAA4E;AAC5E,oDAA6D;AAE7D,mCAA6D;AAE7D,MAAM,YAAY,GAAG,WAAE;KACpB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAE/C,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;QACD,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACxC,QAAQ,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;KACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,+DAA+D;AAC/D,WAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,IAAI,E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;QAEH,MAAM,IAAA,2CAA8B,GAAE,CAAC;QAEvC,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { addSentryCommandToBuildCommand } from '../../../src/sourcemaps/tools/sentry-cli';\n\nimport * as packageManagerHelpers from '../../../src/utils/package-manager';\nimport { getPackageDotJson } from '../../../src/utils/clack';\n\nimport { vi, it, describe, expect, afterEach } from 'vitest';\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve());\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n confirm: vi.fn().mockResolvedValue(true),\n isCancel: vi.fn().mockReturnValue(false),\n };\n});\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-return\nvi.mock('../../../src/utils/clack', async () => ({\n ...(await vi.importActual('../../../src/utils/clack')),\n getPackageDotJson: vi.fn().mockResolvedValue({\n scripts: {\n build: 'tsc',\n },\n version: '1.0.0',\n }),\n}));\n\ndescribe('addSentryCommandToBuildCommand', () => {\n afterEach(() => {\n vi.clearAllMocks();\n });\n it.each([\n [\n packageManagerHelpers.NPM,\n packageManagerHelpers.PNPM,\n packageManagerHelpers.YARN_V1,\n packageManagerHelpers.YARN_V2,\n packageManagerHelpers.BUN,\n packageManagerHelpers.DENO,\n ],\n ])('adds the cli command to the script command (%s)', async (_, pacMan) => {\n vi.spyOn(packageManagerHelpers, '_detectPackageManger').mockReturnValue(\n pacMan,\n );\n await addSentryCommandToBuildCommand();\n expect(writeFileSpy).toHaveBeenCalledWith(\n expect.stringContaining('package.json'),\n expect.stringContaining(\n `tsc && ${pacMan.runScriptCommand} sentry:sourcemaps`,\n ),\n );\n });\n\n it('does not add the cli command to the script command if it is already in there', async () => {\n vi.mocked(getPackageDotJson).mockResolvedValue({\n scripts: {\n build: 'tsc && sentry:sourcemaps',\n },\n version: '1.0.0',\n });\n\n await addSentryCommandToBuildCommand();\n\n expect(writeFileSpy).not.toHaveBeenCalled();\n });\n});\n"]}
@@ -25,30 +25,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs"));
27
27
  const tsc_1 = require("../../../src/sourcemaps/tools/tsc");
28
+ const vitest_1 = require("vitest");
28
29
  function updateFileContent(content) {
29
30
  fileContent = content;
30
31
  }
31
32
  let fileContent = '';
32
- jest.mock('@clack/prompts', () => {
33
+ vitest_1.vi.mock('@clack/prompts', () => {
33
34
  return {
34
35
  log: {
35
- info: jest.fn(),
36
- success: jest.fn(),
36
+ info: vitest_1.vi.fn(),
37
+ success: vitest_1.vi.fn(),
37
38
  },
38
39
  };
39
40
  });
40
- jest
41
- .spyOn(fs.promises, 'readFile')
42
- .mockImplementation(() => Promise.resolve(fileContent));
43
- const writeFileSpy = jest
41
+ vitest_1.vi.spyOn(fs.promises, 'readFile').mockImplementation(() => Promise.resolve(fileContent));
42
+ const writeFileSpy = vitest_1.vi
44
43
  .spyOn(fs.promises, 'writeFile')
45
44
  .mockImplementation(() => Promise.resolve(void 0));
46
- describe('enableSourcemaps', () => {
47
- afterEach(() => {
45
+ (0, vitest_1.describe)('enableSourcemaps', () => {
46
+ (0, vitest_1.afterEach)(() => {
48
47
  fileContent = '';
49
- jest.clearAllMocks();
48
+ vitest_1.vi.clearAllMocks();
50
49
  });
51
- it.each([
50
+ vitest_1.it.each([
52
51
  [
53
52
  'no sourcemaps options',
54
53
  `
@@ -186,10 +185,10 @@ describe('enableSourcemaps', () => {
186
185
  ])('adds the plugin and enables source maps generation (%s)', async (_, originalCode, expectedCode) => {
187
186
  updateFileContent(originalCode);
188
187
  const addedCode = await (0, tsc_1.enableSourcemaps)('');
189
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
188
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
190
189
  const [[, fileContent]] = writeFileSpy.mock.calls;
191
- expect(fileContent).toBe(expectedCode);
192
- expect(addedCode).toBe(true);
190
+ (0, vitest_1.expect)(fileContent).toBe(expectedCode);
191
+ (0, vitest_1.expect)(addedCode).toBe(true);
193
192
  });
194
193
  });
195
194
  //# sourceMappingURL=tsc.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsc.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/tsc.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2DAAqE;AAErE,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;SACnB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI;KACD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;KAC9B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAE1D,MAAM,YAAY,GAAG,IAAI;KACtB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC;QACN;YACE,uBAAuB;YACvB;;;;;;;;;;;;;;;;;;CAkBL;YACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BL;SACI;QACD;YACE,0BAA0B;YAC1B;;;;;;;;;;;;;;;;;;;;CAoBL;YACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BL;SACI;QACD;YACE,qBAAqB;YACrB;;;;;;;CAOL;YACK;;;;;;;;;;;;;;;;;CAiBL;SACI;KACF,CAAC,CACA,yDAAyD,EACzD,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;QACtC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAEhC,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;QAE7C,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { enableSourcemaps } from '../../../src/sourcemaps/tools/tsc';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n };\n});\n\njest\n .spyOn(fs.promises, 'readFile')\n .mockImplementation(() => Promise.resolve(fileContent));\n\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('enableSourcemaps', () => {\n afterEach(() => {\n fileContent = '';\n jest.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\" // another inline comment\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'a few sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\", // another inline comment\n \"sourceMap\": false,\n \"sourceRoot\": \"/src\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\",\n\n \"inlineSources\": true\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'no compiler options',\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ],\n\n \"compilerOptions\": {\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n }\n}\n`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await enableSourcemaps('');\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
1
+ {"version":3,"file":"tsc.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/tsc.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2DAAqE;AAErE,mCAA6D;AAE7D,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CACxD,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAC7B,CAAC;AAEF,MAAM,YAAY,GAAG,WAAE;KACpB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,IAAA,iBAAQ,EAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,WAAW,GAAG,EAAE,CAAC;QACjB,WAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,WAAE,CAAC,IAAI,CAAC;QACN;YACE,uBAAuB;YACvB;;;;;;;;;;;;;;;;;;CAkBL;YACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BL;SACI;QACD;YACE,0BAA0B;YAC1B;;;;;;;;;;;;;;;;;;;;CAoBL;YACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BL;SACI;QACD;YACE,qBAAqB;YACrB;;;;;;;CAOL;YACK;;;;;;;;;;;;;;;;;CAiBL;SACI;KACF,CAAC,CACA,yDAAyD,EACzD,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;QACtC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAEhC,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;QAE7C,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { enableSourcemaps } from '../../../src/sourcemaps/tools/tsc';\n\nimport { vi, it, describe, expect, afterEach } from 'vitest';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n});\n\nvi.spyOn(fs.promises, 'readFile').mockImplementation(() =>\n Promise.resolve(fileContent),\n);\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('enableSourcemaps', () => {\n afterEach(() => {\n fileContent = '';\n vi.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\" // another inline comment\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'a few sourcemaps options',\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n \"outDir\": \"dist\", // another inline comment\n \"sourceMap\": false,\n \"sourceRoot\": \"/src\"\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n/**\n * My TS config with comments\n */\n{\n \"extends\": \"./tsconfig.build.json\",\n\n \"compilerOptions\": {\n // line comment which should stay\n \"moduleResolution\": \"node16\",\n\n // another inline comment\n \"outDir\": \"dist\",\n\n \"sourceMap\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\",\n\n \"inlineSources\": true\n },\n\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n ],\n [\n 'no compiler options',\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ]\n}\n`,\n `\n{\n \"include\": [\n \"src/**/*\",\n \"test/**/*\"\n ],\n\n \"compilerOptions\": {\n \"sourceMap\": true,\n \"inlineSources\": true,\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix\n // from generated source code references.\n // This improves issue grouping in Sentry.\n \"sourceRoot\": \"/\"\n }\n}\n`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await enableSourcemaps('');\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
@@ -25,30 +25,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs"));
27
27
  const vite_1 = require("../../../src/sourcemaps/tools/vite");
28
+ const vitest_1 = require("vitest");
28
29
  function updateFileContent(content) {
29
30
  fileContent = content;
30
31
  }
31
32
  let fileContent = '';
32
- jest.mock('@clack/prompts', () => {
33
+ vitest_1.vi.mock('@clack/prompts', () => {
33
34
  return {
34
35
  log: {
35
- info: jest.fn(),
36
- success: jest.fn(),
36
+ info: vitest_1.vi.fn(),
37
+ success: vitest_1.vi.fn(),
37
38
  },
38
39
  };
39
40
  });
40
- jest
41
- .spyOn(fs.promises, 'readFile')
42
- .mockImplementation(() => Promise.resolve(fileContent));
43
- const writeFileSpy = jest
41
+ vitest_1.vi.spyOn(fs.promises, 'readFile').mockImplementation(() => Promise.resolve(fileContent));
42
+ const writeFileSpy = vitest_1.vi
44
43
  .spyOn(fs.promises, 'writeFile')
45
44
  .mockImplementation(() => Promise.resolve(void 0));
46
- describe('addVitePluginToConfig', () => {
47
- afterEach(() => {
45
+ (0, vitest_1.describe)('addVitePluginToConfig', () => {
46
+ (0, vitest_1.afterEach)(() => {
48
47
  fileContent = '';
49
- jest.clearAllMocks();
48
+ vitest_1.vi.clearAllMocks();
50
49
  });
51
- it.each([
50
+ vitest_1.it.each([
52
51
  [
53
52
  'no build options',
54
53
  `
@@ -154,10 +153,10 @@ export default cfg;`,
154
153
  selfHosted: false,
155
154
  url: 'https://sentry.io/',
156
155
  });
157
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
156
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
158
157
  const [[, fileContent]] = writeFileSpy.mock.calls;
159
- expect(fileContent).toBe(expectedCode);
160
- expect(addedCode).toBe(true);
158
+ (0, vitest_1.expect)(fileContent).toBe(expectedCode);
159
+ (0, vitest_1.expect)(addedCode).toBe(true);
161
160
  });
162
161
  });
163
162
  //# sourceMappingURL=vite.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/vite.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,6DAA2E;AAE3E,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;SACnB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI;KACD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;KAC9B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAE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,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { addVitePluginToConfig } from '../../../src/sourcemaps/tools/vite';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n };\n});\n\njest\n .spyOn(fs.promises, 'readFile')\n .mockImplementation(() => Promise.resolve(fileContent));\n\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('addVitePluginToConfig', () => {\n afterEach(() => {\n fileContent = '';\n jest.clearAllMocks();\n });\n\n it.each([\n [\n 'no build options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n})\n`,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true\n }\n})`,\n ],\n [\n 'no build.sourcemap options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n build: {\n test: 1, \n }\n})\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n test: 1,\n sourcemap: true\n }\n})`,\n ],\n [\n 'keep sourcemap: \"hidden\"',\n `\nexport default {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: \"hidden\",\n }\n}\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n sourcemap: \"hidden\",\n }\n}`,\n ],\n [\n 'rewrite sourcemap: false to true',\n `\nconst cfg = {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: false,\n }\n}\n\nexport default cfg;\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nconst cfg = {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true,\n }\n}\n\nexport default cfg;`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await addVitePluginToConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
1
+ {"version":3,"file":"vite.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/vite.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,6DAA2E;AAE3E,mCAA6D;AAE7D,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CACxD,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAC7B,CAAC;AAEF,MAAM,YAAY,GAAG,WAAE;KACpB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,C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as fs from 'fs';\nimport { addVitePluginToConfig } from '../../../src/sourcemaps/tools/vite';\n\nimport { vi, it, describe, expect, afterEach } from 'vitest';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n});\n\nvi.spyOn(fs.promises, 'readFile').mockImplementation(() =>\n Promise.resolve(fileContent),\n);\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\ndescribe('addVitePluginToConfig', () => {\n afterEach(() => {\n fileContent = '';\n vi.clearAllMocks();\n });\n\n it.each([\n [\n 'no build options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n})\n`,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true\n }\n})`,\n ],\n [\n 'no build.sourcemap options',\n `\nexport default defineConfig({\n plugins: [\n vue(),\n ],\n build: {\n test: 1, \n }\n})\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default defineConfig({\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n test: 1,\n sourcemap: true\n }\n})`,\n ],\n [\n 'keep sourcemap: \"hidden\"',\n `\nexport default {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: \"hidden\",\n }\n}\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nexport default {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n build: {\n sourcemap: \"hidden\",\n }\n}`,\n ],\n [\n 'rewrite sourcemap: false to true',\n `\nconst cfg = {\n plugins: [\n vue(),\n ],\n build: {\n sourcemap: false,\n }\n}\n\nexport default cfg;\n `,\n `import { sentryVitePlugin } from \"@sentry/vite-plugin\";\nconst cfg = {\n plugins: [vue(), sentryVitePlugin({\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n build: {\n sourcemap: true,\n }\n}\n\nexport default cfg;`,\n ],\n ])(\n 'adds the plugin and enables source maps generation (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n const addedCode = await addVitePluginToConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n});\n"]}
@@ -25,24 +25,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs"));
27
27
  const webpack_1 = require("../../../src/sourcemaps/tools/webpack");
28
+ const vitest_1 = require("vitest");
28
29
  function updateFileContent(content) {
29
30
  fileContent = content;
30
31
  }
31
32
  let fileContent = '';
32
- jest.mock('@clack/prompts', () => {
33
+ vitest_1.vi.mock('@clack/prompts', () => {
33
34
  return {
34
35
  log: {
35
- info: jest.fn(),
36
- success: jest.fn(),
36
+ info: vitest_1.vi.fn(),
37
+ success: vitest_1.vi.fn(),
37
38
  },
38
- select: jest.fn().mockImplementation(() => Promise.resolve(true)),
39
- isCancel: jest.fn().mockReturnValue(false),
39
+ select: vitest_1.vi.fn().mockImplementation(() => Promise.resolve(true)),
40
+ isCancel: vitest_1.vi.fn().mockReturnValue(false),
40
41
  };
41
42
  });
42
- jest
43
- .spyOn(fs.promises, 'readFile')
44
- .mockImplementation(() => Promise.resolve(fileContent));
45
- const writeFileSpy = jest
43
+ vitest_1.vi.spyOn(fs.promises, 'readFile').mockImplementation(() => Promise.resolve(fileContent));
44
+ const writeFileSpy = vitest_1.vi
46
45
  .spyOn(fs.promises, 'writeFile')
47
46
  .mockImplementation(() => Promise.resolve(void 0));
48
47
  const noSourcemapNoPluginsPojo = `module.exports = {
@@ -234,12 +233,12 @@ module.exports = {
234
233
 
235
234
  devtool: "source-map"
236
235
  };`;
237
- describe('modifyWebpackConfig', () => {
238
- afterEach(() => {
236
+ (0, vitest_1.describe)('modifyWebpackConfig', () => {
237
+ (0, vitest_1.afterEach)(() => {
239
238
  fileContent = '';
240
- jest.clearAllMocks();
239
+ vitest_1.vi.clearAllMocks();
241
240
  });
242
- it.each([
241
+ vitest_1.it.each([
243
242
  [
244
243
  'no sourcemap option, no plugins, object',
245
244
  noSourcemapNoPluginsPojo,
@@ -280,12 +279,12 @@ describe('modifyWebpackConfig', () => {
280
279
  selfHosted: false,
281
280
  url: 'https://sentry.io/',
282
281
  });
283
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
282
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
284
283
  const [[, fileContent]] = writeFileSpy.mock.calls;
285
- expect(fileContent).toBe(expectedCode);
286
- expect(addedCode).toBe(true);
284
+ (0, vitest_1.expect)(fileContent).toBe(expectedCode);
285
+ (0, vitest_1.expect)(addedCode).toBe(true);
287
286
  });
288
- it('adds the url parameter to the webpack plugin options if self-hosted', async () => {
287
+ (0, vitest_1.it)('adds the url parameter to the webpack plugin options if self-hosted', async () => {
289
288
  updateFileContent(noSourcemapNoPluginsPojo);
290
289
  const addedCode = await (0, webpack_1.modifyWebpackConfig)('', {
291
290
  authToken: '',
@@ -294,10 +293,10 @@ describe('modifyWebpackConfig', () => {
294
293
  selfHosted: true,
295
294
  url: 'https://santry.io/',
296
295
  });
297
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
296
+ (0, vitest_1.expect)(writeFileSpy).toHaveBeenCalledTimes(1);
298
297
  const [[, fileContent]] = writeFileSpy.mock.calls;
299
- expect(fileContent).toContain('url: "https://santry.io/"');
300
- expect(addedCode).toBe(true);
298
+ (0, vitest_1.expect)(fileContent).toContain('url: "https://santry.io/"');
299
+ (0, vitest_1.expect)(addedCode).toBe(true);
301
300
  });
302
301
  });
303
302
  //# sourceMappingURL=webpack.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/webpack.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,mEAA4E;AAE5E,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;SACnB;QACD,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;KAC3C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI;KACD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;KAC9B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAE1D,MAAM,YAAY,GAAG,IAAI;KACtB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,wBAAwB,GAAG;;;;;;GAM9B,CAAC;AAEJ,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;GAmBpC,CAAC;AAEJ,MAAM,uBAAuB,GAAG;;;;;;;;;yB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IAAA,6BAAmB,EAAC,EAAE,EAAE;YAC9C,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,KAAK;YACjB,GAAG,EAAE,oBAAoB;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;IAEF,EAAE,CAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;QACnF,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;QAE5C,MAAM,SAAS,GAAG,MAAM,IAAA,6BAAmB,EAAC,EAAE,EAAE;YAC9C,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,oBAAoB;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAClD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { modifyWebpackConfig } from '../../../src/sourcemaps/tools/webpack';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\njest.mock('@clack/prompts', () => {\n return {\n log: {\n info: jest.fn(),\n success: jest.fn(),\n },\n select: jest.fn().mockImplementation(() => Promise.resolve(true)),\n isCancel: jest.fn().mockReturnValue(false),\n };\n});\n\njest\n .spyOn(fs.promises, 'readFile')\n .mockImplementation(() => Promise.resolve(fileContent));\n\nconst writeFileSpy = jest\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\nconst noSourcemapNoPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapNoPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};`;\n\nconst noSourcemapsNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapsNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst hiddenSourcemapNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-cheap-source-map\",\n};\n\nmodule.exports = config;\n `;\nconst hiddenSourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst arbitrarySourcemapNoPluginsId = `\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: getSourcemapSetting(),\n};\n\nmodule.exports = config;\n `;\nconst arbitrarySourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapUndefinedPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: undefined,\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapUndefinedPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\nconst noSourcemapPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: [\n new HtmlWebpackPlugin(),\n new MiniCssExtractPlugin(),\n ],\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [new HtmlWebpackPlugin(), new MiniCssExtractPlugin(), sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\ndescribe('modifyWebpackConfig', () => {\n afterEach(() => {\n fileContent = '';\n jest.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemap option, no plugins, object',\n noSourcemapNoPluginsPojo,\n noSourcemapNoPluginsPojoResult,\n ],\n [\n 'no sourcemap option, no plugins, identifier',\n noSourcemapsNoPluginsId,\n noSourcemapsNoPluginsIdResult,\n ],\n [\n 'hidden sourcemap option, no plugins, identifier',\n hiddenSourcemapNoPluginsId,\n hiddenSourcemapNoPluginsIdResult,\n ],\n [\n 'arbitrary sourcemap option, no plugins, identifier',\n arbitrarySourcemapNoPluginsId,\n arbitrarySourcemapNoPluginsIdResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapUndefinedPluginsPojo,\n noSourcemapUndefinedPluginsPojoResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapPluginsPojo,\n noSourcemapPluginsPojoResult,\n ],\n ])(\n 'adds plugin and source maps emission to the webpack config (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n // updateFileContent(originalCode);\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n\n it('adds the url parameter to the webpack plugin options if self-hosted', async () => {\n updateFileContent(noSourcemapNoPluginsPojo);\n\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n url: 'https://santry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toContain('url: \"https://santry.io/\"');\n expect(addedCode).toBe(true);\n });\n});\n"]}
1
+ {"version":3,"file":"webpack.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/webpack.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,mEAA4E;AAE5E,mCAA6D;AAE7D,SAAS,iBAAiB,CAAC,OAAe;IACxC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;QACD,MAAM,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/D,QAAQ,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;KACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CACxD,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAC7B,CAAC;AAEF,MAAM,YAAY,GAAG,WAAE;KACpB,KAAK,CAAC,EAAE,CAAC,QAAQ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C,IAAI,CAAC,KAAK,CAAC;QAClD,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC3D,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'fs';\n\nimport { modifyWebpackConfig } from '../../../src/sourcemaps/tools/webpack';\n\nimport { vi, it, expect, describe, afterEach } from 'vitest';\n\nfunction updateFileContent(content: string): void {\n fileContent = content;\n}\n\nlet fileContent = '';\n\nvi.mock('@clack/prompts', () => {\n return {\n log: {\n info: vi.fn(),\n success: vi.fn(),\n },\n select: vi.fn().mockImplementation(() => Promise.resolve(true)),\n isCancel: vi.fn().mockReturnValue(false),\n };\n});\n\nvi.spyOn(fs.promises, 'readFile').mockImplementation(() =>\n Promise.resolve(fileContent),\n);\n\nconst writeFileSpy = vi\n .spyOn(fs.promises, 'writeFile')\n .mockImplementation(() => Promise.resolve(void 0));\n\nconst noSourcemapNoPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapNoPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};`;\n\nconst noSourcemapsNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapsNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst hiddenSourcemapNoPluginsId = `const config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-cheap-source-map\",\n};\n\nmodule.exports = config;\n `;\nconst hiddenSourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"hidden-source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst arbitrarySourcemapNoPluginsId = `\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: getSourcemapSetting(),\n};\n\nmodule.exports = config;\n `;\nconst arbitrarySourcemapNoPluginsIdResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nconst config = {\n entry: \"./src/index.js\",\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })]\n};\n\nmodule.exports = config;`;\n\nconst noSourcemapUndefinedPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: undefined,\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapUndefinedPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\nconst noSourcemapPluginsPojo = `module.exports = {\n entry: \"./src/index.js\",\n plugins: [\n new HtmlWebpackPlugin(),\n new MiniCssExtractPlugin(),\n ],\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n};`;\n\nconst noSourcemapPluginsPojoResult = `const {\n sentryWebpackPlugin\n} = require(\"@sentry/webpack-plugin\");\n\nmodule.exports = {\n entry: \"./src/index.js\",\n\n plugins: [new HtmlWebpackPlugin(), new MiniCssExtractPlugin(), sentryWebpackPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"my-org\",\n project: \"my-project\"\n })],\n\n output: {\n filename: \"main.js\",\n path: path.resolve(__dirname, \"build\"),\n },\n\n devtool: \"source-map\"\n};`;\n\ndescribe('modifyWebpackConfig', () => {\n afterEach(() => {\n fileContent = '';\n vi.clearAllMocks();\n });\n\n it.each([\n [\n 'no sourcemap option, no plugins, object',\n noSourcemapNoPluginsPojo,\n noSourcemapNoPluginsPojoResult,\n ],\n [\n 'no sourcemap option, no plugins, identifier',\n noSourcemapsNoPluginsId,\n noSourcemapsNoPluginsIdResult,\n ],\n [\n 'hidden sourcemap option, no plugins, identifier',\n hiddenSourcemapNoPluginsId,\n hiddenSourcemapNoPluginsIdResult,\n ],\n [\n 'arbitrary sourcemap option, no plugins, identifier',\n arbitrarySourcemapNoPluginsId,\n arbitrarySourcemapNoPluginsIdResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapUndefinedPluginsPojo,\n noSourcemapUndefinedPluginsPojoResult,\n ],\n [\n 'no sourcemap option, plugins, object',\n noSourcemapPluginsPojo,\n noSourcemapPluginsPojoResult,\n ],\n ])(\n 'adds plugin and source maps emission to the webpack config (%s)',\n async (_, originalCode, expectedCode) => {\n updateFileContent(originalCode);\n\n // updateFileContent(originalCode);\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n url: 'https://sentry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toBe(expectedCode);\n expect(addedCode).toBe(true);\n },\n );\n\n it('adds the url parameter to the webpack plugin options if self-hosted', async () => {\n updateFileContent(noSourcemapNoPluginsPojo);\n\n const addedCode = await modifyWebpackConfig('', {\n authToken: '',\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n url: 'https://santry.io/',\n });\n\n expect(writeFileSpy).toHaveBeenCalledTimes(1);\n const [[, fileContent]] = writeFileSpy.mock.calls;\n expect(fileContent).toContain('url: \"https://santry.io/\"');\n expect(addedCode).toBe(true);\n });\n});\n"]}
@@ -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 templates_1 = require("../../src/sveltekit/templates");
4
- describe('getClientHooksTemplate', () => {
5
- it('should generate client hooks template with all features enabled', () => {
5
+ (0, vitest_1.describe)('getClientHooksTemplate', () => {
6
+ (0, vitest_1.it)('should generate client hooks template with all features enabled', () => {
6
7
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
7
8
  performance: true,
8
9
  replay: true,
9
10
  });
10
- expect(result).toMatchInlineSnapshot(`
11
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
11
12
  "import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
12
13
  import * as Sentry from '@sentry/sveltekit';
13
14
 
@@ -33,12 +34,12 @@ describe('getClientHooksTemplate', () => {
33
34
  "
34
35
  `);
35
36
  });
36
- it('should generate client hooks template when performance disabled', () => {
37
+ (0, vitest_1.it)('should generate client hooks template when performance disabled', () => {
37
38
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
38
39
  performance: false,
39
40
  replay: true,
40
41
  });
41
- expect(result).toMatchInlineSnapshot(`
42
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
42
43
  "import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
43
44
  import * as Sentry from '@sentry/sveltekit';
44
45
 
@@ -62,12 +63,12 @@ describe('getClientHooksTemplate', () => {
62
63
  "
63
64
  `);
64
65
  });
65
- it('should generate client hooks template when replay disabled', () => {
66
+ (0, vitest_1.it)('should generate client hooks template when replay disabled', () => {
66
67
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
67
68
  performance: true,
68
69
  replay: false,
69
70
  });
70
- expect(result).toMatchInlineSnapshot(`
71
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
71
72
  "import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
72
73
  import * as Sentry from '@sentry/sveltekit';
73
74
 
@@ -85,13 +86,13 @@ describe('getClientHooksTemplate', () => {
85
86
  `);
86
87
  });
87
88
  });
88
- describe('getServerHooksTemplate', () => {
89
- it('should generate server hooks template with all features enabled', () => {
89
+ (0, vitest_1.describe)('getServerHooksTemplate', () => {
90
+ (0, vitest_1.it)('should generate server hooks template with all features enabled', () => {
90
91
  const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
91
92
  performance: true,
92
93
  replay: true,
93
94
  });
94
- expect(result).toMatchInlineSnapshot(`
95
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
95
96
  "import { sequence } from "@sveltejs/kit/hooks";
96
97
  import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
97
98
  import * as Sentry from '@sentry/sveltekit';
@@ -113,12 +114,12 @@ describe('getServerHooksTemplate', () => {
113
114
  "
114
115
  `);
115
116
  });
116
- it('should generate server hooks template when performance disabled', () => {
117
+ (0, vitest_1.it)('should generate server hooks template when performance disabled', () => {
117
118
  const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
118
119
  performance: false,
119
120
  replay: true,
120
121
  });
121
- expect(result).toMatchInlineSnapshot(`
122
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
122
123
  "import { sequence } from "@sveltejs/kit/hooks";
123
124
  import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
124
125
  import * as Sentry from '@sentry/sveltekit';
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,6DAGuC;AAEvC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;KAwBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;KAsBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;KAepC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;KAoBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;KAkBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n getClientHooksTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\n\ndescribe('getClientHooksTemplate', () => {\n it('should generate client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: 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 // 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('should generate client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: 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 // 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('should generate client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: 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 // 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('should generate server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: 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 // 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('should generate server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: 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 // 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"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,6DAGuC;AAEvC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;KAwBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH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;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getClientHooksTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\n\ndescribe('getClientHooksTemplate', () => {\n it('should generate client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: 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 // 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('should generate client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: 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 // 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('should generate client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: 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 // 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('should generate server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: 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 // 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('should generate server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: 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 // 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"]}