@sentry/wizard 6.4.0 → 6.6.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.
- package/CHANGELOG.md +18 -0
- package/dist/e2e-tests/tests/angular-17.test.js +1 -0
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +1 -0
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/expo.test.js +13 -3
- package/dist/e2e-tests/tests/expo.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +6 -0
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +6 -0
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-native.test.js +14 -4
- package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -1
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +13 -2
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +4 -0
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/src/android/android-wizard.js +9 -1
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/manifest.d.ts +1 -1
- package/dist/src/android/manifest.js +2 -2
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/android/templates.d.ts +1 -1
- package/dist/src/android/templates.js +4 -1
- package/dist/src/android/templates.js.map +1 -1
- package/dist/src/angular/codemods/main.js +1 -0
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/templates.js +0 -2
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +6 -4
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +10 -2
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-native/javascript.d.ts +6 -4
- package/dist/src/react-native/javascript.js +11 -7
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +9 -0
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/xcode.js +5 -3
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -0
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.d.ts +6 -0
- package/dist/src/sveltekit/sdk-setup/setup.js +4 -1
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/templates.js +9 -0
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.js +4 -1
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +113 -17
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +0 -3
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/templates.test.js +0 -4
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +33 -22
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +50 -10
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +225 -0
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/xcode.test.js +20 -2
- package/dist/test/react-native/xcode.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +10 -4
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +214 -0
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/package.json +3 -3
|
@@ -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,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,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
|
|
1
|
+
{"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../test/remix/client-entry.test.ts"],"names":[],"mappings":";;AAAA,kFAAkF;AAClF,uCAAuC;AACvC,yDAAiE;AACjE,mCAA8C;AAE9C,IAAA,iBAAQ,EAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,IAAA,WAAE,EAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gC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AC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,KAAK;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;;;;;;;KAOpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,4EAA4E,EAAE,GAAG,EAAE;QACpF,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,KAAK;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,iB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AG,EAAE;QACtF,MAAM,MAAM,GAAG,IAAA,4CAAgC,EAAC,uBAAuB,EAAE;YACvE,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;WAS9B,CAAC,CAAC;IACX,CAAC,CAAC,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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AAC,CAAC;QAEH,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAEhD,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;KAepC,CAAC,CAAC;IACL,CAAC,CAAC,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';\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.0",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@clack/prompts": "0.7.0",
|
|
30
30
|
"@sentry/node": "^7.119.2",
|
|
31
|
-
"axios": "1.
|
|
31
|
+
"axios": "1.12.0",
|
|
32
32
|
"chalk": "^2.4.1",
|
|
33
33
|
"glob": "9.3.5",
|
|
34
34
|
"inquirer": "^6.2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
53
53
|
"@typescript-eslint/parser": "^5.13.0",
|
|
54
54
|
"@vitest/coverage-v8": "3.0.9",
|
|
55
|
-
"clifty": "0.2
|
|
55
|
+
"clifty": "0.3.2",
|
|
56
56
|
"eslint": "^8.18.0",
|
|
57
57
|
"eslint-config-prettier": "^8.3.0",
|
|
58
58
|
"eslint-plugin-vitest": "^0.5.4",
|