@sentry/wizard 5.4.0 → 6.1.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 +14 -0
- package/dist/e2e-tests/tests/angular-17.test.js +6 -0
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +7 -1
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +5 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +5 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +9 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +9 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +8 -2
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +15 -3
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/src/angular/angular-wizard.js +5 -0
- package/dist/src/angular/angular-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +4 -1
- package/dist/src/angular/codemods/main.js +3 -0
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/angular/sdk-setup.d.ts +1 -0
- package/dist/src/angular/sdk-setup.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +5 -0
- package/dist/src/apple/xcode-manager.js +44 -40
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +5 -0
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +3 -0
- package/dist/src/nextjs/templates.js +15 -2
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.js +5 -0
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.d.ts +1 -0
- package/dist/src/nuxt/templates.js +3 -2
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +3 -6
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/codemods/{root-common.d.ts → root.d.ts} +1 -0
- package/dist/src/remix/codemods/{root-v2.js → root.js} +47 -12
- package/dist/src/remix/codemods/root.js.map +1 -0
- package/dist/src/remix/remix-wizard.js +12 -5
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-setup.d.ts +8 -11
- package/dist/src/remix/sdk-setup.js +13 -18
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/remix/templates.d.ts +2 -2
- package/dist/src/remix/templates.js +3 -3
- package/dist/src/remix/templates.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +11 -0
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/templates.d.ts +2 -0
- package/dist/src/sveltekit/templates.js +10 -0
- package/dist/src/sveltekit/templates.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/nextjs/templates.test.js +119 -0
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +119 -0
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +56 -0
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/remix/root.test.d.ts +1 -0
- package/dist/test/remix/root.test.js +31 -0
- package/dist/test/remix/root.test.js.map +1 -0
- package/dist/test/remix/server-instrumentation.test.js +37 -1
- package/dist/test/remix/server-instrumentation.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +67 -0
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/src/remix/codemods/root-common.js +0 -70
- package/dist/src/remix/codemods/root-common.js.map +0 -1
- package/dist/src/remix/codemods/root-v1.d.ts +0 -1
- package/dist/src/remix/codemods/root-v1.js +0 -52
- package/dist/src/remix/codemods/root-v1.js.map +0 -1
- package/dist/src/remix/codemods/root-v2.d.ts +0 -1
- package/dist/src/remix/codemods/root-v2.js.map +0 -1
|
@@ -8,6 +8,7 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
8
8
|
const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
|
|
9
9
|
performance: true,
|
|
10
10
|
replay: true,
|
|
11
|
+
logs: true,
|
|
11
12
|
});
|
|
12
13
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
13
14
|
"// This file configures the initialization of Sentry on the client.
|
|
@@ -26,6 +27,8 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
26
27
|
|
|
27
28
|
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
28
29
|
tracesSampleRate: 1,
|
|
30
|
+
// Enable logs to be sent to Sentry
|
|
31
|
+
enableLogs: true,
|
|
29
32
|
|
|
30
33
|
// Define how likely Replay events are sampled.
|
|
31
34
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
@@ -46,6 +49,7 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
46
49
|
const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
|
|
47
50
|
performance: false,
|
|
48
51
|
replay: true,
|
|
52
|
+
logs: true,
|
|
49
53
|
});
|
|
50
54
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
51
55
|
"// This file configures the initialization of Sentry on the client.
|
|
@@ -61,6 +65,8 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
61
65
|
integrations: [
|
|
62
66
|
Sentry.replayIntegration(),
|
|
63
67
|
],
|
|
68
|
+
// Enable logs to be sent to Sentry
|
|
69
|
+
enableLogs: true,
|
|
64
70
|
|
|
65
71
|
// Define how likely Replay events are sampled.
|
|
66
72
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
@@ -81,6 +87,7 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
81
87
|
const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
|
|
82
88
|
performance: true,
|
|
83
89
|
replay: false,
|
|
90
|
+
logs: true,
|
|
84
91
|
});
|
|
85
92
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
86
93
|
"// This file configures the initialization of Sentry on the client.
|
|
@@ -94,6 +101,47 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
94
101
|
|
|
95
102
|
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
96
103
|
tracesSampleRate: 1,
|
|
104
|
+
// Enable logs to be sent to Sentry
|
|
105
|
+
enableLogs: true,
|
|
106
|
+
|
|
107
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
108
|
+
debug: false,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;"
|
|
112
|
+
`);
|
|
113
|
+
});
|
|
114
|
+
(0, vitest_1.it)('generates client-side Sentry config with logs disabled', () => {
|
|
115
|
+
const template = (0, templates_1.getInstrumentationClientFileContents)('my-dsn', {
|
|
116
|
+
performance: true,
|
|
117
|
+
replay: true,
|
|
118
|
+
logs: false,
|
|
119
|
+
});
|
|
120
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
121
|
+
"// This file configures the initialization of Sentry on the client.
|
|
122
|
+
// The added config here will be used whenever a users loads a page in their browser.
|
|
123
|
+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
|
124
|
+
|
|
125
|
+
import * as Sentry from "@sentry/nextjs";
|
|
126
|
+
|
|
127
|
+
Sentry.init({
|
|
128
|
+
dsn: "my-dsn",
|
|
129
|
+
|
|
130
|
+
// Add optional integrations for additional features
|
|
131
|
+
integrations: [
|
|
132
|
+
Sentry.replayIntegration(),
|
|
133
|
+
],
|
|
134
|
+
|
|
135
|
+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
136
|
+
tracesSampleRate: 1,
|
|
137
|
+
|
|
138
|
+
// Define how likely Replay events are sampled.
|
|
139
|
+
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
140
|
+
// in development and sample at a lower rate in production
|
|
141
|
+
replaysSessionSampleRate: 0.1,
|
|
142
|
+
|
|
143
|
+
// Define how likely Replay events are sampled when an error occurs.
|
|
144
|
+
replaysOnErrorSampleRate: 1.0,
|
|
97
145
|
|
|
98
146
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
99
147
|
debug: false,
|
|
@@ -109,6 +157,7 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
109
157
|
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
|
|
110
158
|
performance: true,
|
|
111
159
|
replay: true,
|
|
160
|
+
logs: true,
|
|
112
161
|
});
|
|
113
162
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
114
163
|
"// This file configures the initialization of Sentry on the server.
|
|
@@ -123,6 +172,9 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
123
172
|
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
124
173
|
tracesSampleRate: 1,
|
|
125
174
|
|
|
175
|
+
// Enable logs to be sent to Sentry
|
|
176
|
+
enableLogs: true,
|
|
177
|
+
|
|
126
178
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
127
179
|
debug: false,
|
|
128
180
|
});
|
|
@@ -133,6 +185,7 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
133
185
|
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
|
|
134
186
|
performance: false,
|
|
135
187
|
replay: true,
|
|
188
|
+
logs: true,
|
|
136
189
|
});
|
|
137
190
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
138
191
|
"// This file configures the initialization of Sentry on the server.
|
|
@@ -144,6 +197,9 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
144
197
|
Sentry.init({
|
|
145
198
|
dsn: "my-dsn",
|
|
146
199
|
|
|
200
|
+
// Enable logs to be sent to Sentry
|
|
201
|
+
enableLogs: true,
|
|
202
|
+
|
|
147
203
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
148
204
|
debug: false,
|
|
149
205
|
});
|
|
@@ -154,6 +210,35 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
154
210
|
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
|
|
155
211
|
performance: true,
|
|
156
212
|
replay: true,
|
|
213
|
+
logs: true,
|
|
214
|
+
});
|
|
215
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
216
|
+
"// This file configures the initialization of Sentry on the server.
|
|
217
|
+
// The config you add here will be used whenever the server handles a request.
|
|
218
|
+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
|
219
|
+
|
|
220
|
+
import * as Sentry from "@sentry/nextjs";
|
|
221
|
+
|
|
222
|
+
Sentry.init({
|
|
223
|
+
dsn: "my-dsn",
|
|
224
|
+
|
|
225
|
+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
226
|
+
tracesSampleRate: 1,
|
|
227
|
+
|
|
228
|
+
// Enable logs to be sent to Sentry
|
|
229
|
+
enableLogs: true,
|
|
230
|
+
|
|
231
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
232
|
+
debug: false,
|
|
233
|
+
});
|
|
234
|
+
"
|
|
235
|
+
`);
|
|
236
|
+
});
|
|
237
|
+
(0, vitest_1.it)('generates server-side Sentry config with logs disabled', () => {
|
|
238
|
+
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'server', {
|
|
239
|
+
performance: true,
|
|
240
|
+
replay: true,
|
|
241
|
+
logs: false,
|
|
157
242
|
});
|
|
158
243
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
159
244
|
"// This file configures the initialization of Sentry on the server.
|
|
@@ -180,6 +265,7 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
180
265
|
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'edge', {
|
|
181
266
|
performance: true,
|
|
182
267
|
replay: true,
|
|
268
|
+
logs: true,
|
|
183
269
|
});
|
|
184
270
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
185
271
|
"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
|
|
@@ -195,6 +281,9 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
195
281
|
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
196
282
|
tracesSampleRate: 1,
|
|
197
283
|
|
|
284
|
+
// Enable logs to be sent to Sentry
|
|
285
|
+
enableLogs: true,
|
|
286
|
+
|
|
198
287
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
199
288
|
debug: false,
|
|
200
289
|
});
|
|
@@ -205,6 +294,33 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
205
294
|
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'edge', {
|
|
206
295
|
performance: false,
|
|
207
296
|
replay: true,
|
|
297
|
+
logs: true,
|
|
298
|
+
});
|
|
299
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
300
|
+
"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
|
|
301
|
+
// The config you add here will be used whenever one of the edge features is loaded.
|
|
302
|
+
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
|
|
303
|
+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
|
304
|
+
|
|
305
|
+
import * as Sentry from "@sentry/nextjs";
|
|
306
|
+
|
|
307
|
+
Sentry.init({
|
|
308
|
+
dsn: "my-dsn",
|
|
309
|
+
|
|
310
|
+
// Enable logs to be sent to Sentry
|
|
311
|
+
enableLogs: true,
|
|
312
|
+
|
|
313
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
314
|
+
debug: false,
|
|
315
|
+
});
|
|
316
|
+
"
|
|
317
|
+
`);
|
|
318
|
+
});
|
|
319
|
+
(0, vitest_1.it)('generates edge Sentry config with logs disabled', () => {
|
|
320
|
+
const template = (0, templates_1.getSentryServersideConfigContents)('my-dsn', 'edge', {
|
|
321
|
+
performance: true,
|
|
322
|
+
replay: true,
|
|
323
|
+
logs: false,
|
|
208
324
|
});
|
|
209
325
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
210
326
|
"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
|
|
@@ -217,6 +333,9 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
217
333
|
Sentry.init({
|
|
218
334
|
dsn: "my-dsn",
|
|
219
335
|
|
|
336
|
+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
337
|
+
tracesSampleRate: 1,
|
|
338
|
+
|
|
220
339
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
221
340
|
debug: false,
|
|
222
341
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0DAUoC;AAEpC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,IAAA,WAAE,EAAC,+DAA+D,EAAE,GAAG,EAAE;YACvE,MAAM,QAAQ,GAAG,IAAA,gDAAoC,EAAC,QAAQ,EAAE;gBAC9D,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;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D,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n getGenerateMetadataSnippet,\n getRootLayoutWithGenerateMetadata,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getGenerateMetadataSnippet', () => {\n it('generates metadata snippet with TypeScript types', () => {\n const template = getGenerateMetadataSnippet(true);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata(): Metadata {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n`);\n });\n\n it('generates metadata snippet without TypeScript types', () => {\n const template = getGenerateMetadataSnippet(false);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n \n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata() {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n `);\n });\n });\n\n describe('getRootLayoutWithGenerateMetadata', () => {\n it('generates root layout with TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(true);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n export function generateMetadata(): Metadata {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n\n it('generates root layout without TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(false);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n\n \n export function generateMetadata() {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getSentryExamplePageContents', () => {\n it('generates example page with TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: true,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: false,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without useClient directive', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: false,\n isTypeScript: true,\n });\n\n expect(template).not.toContain('\"use client\";');\n expect(template).toContain(\n 'https://my-org.sentry.io/issues/?project=123',\n );\n });\n });\n\n describe('getSentryExamplePagesDirApiRoute', () => {\n it('generates Pages Router API route with TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n\n it('generates Pages Router API route without TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n });\n\n describe('getSentryExampleAppDirApiRoute', () => {\n it('generates App Router API route with TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n\n it('generates App Router API route without TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0DAUoC;AAEpC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,sCAAsC,EAAE,GAAG,EAAE;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C,YAAY,EAAE,KAAK;aACpB,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;YACnD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC;YACxE,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;YACpD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n getGenerateMetadataSnippet,\n getRootLayoutWithGenerateMetadata,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with logs disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with logs disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with logs disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getGenerateMetadataSnippet', () => {\n it('generates metadata snippet with TypeScript types', () => {\n const template = getGenerateMetadataSnippet(true);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata(): Metadata {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n`);\n });\n\n it('generates metadata snippet without TypeScript types', () => {\n const template = getGenerateMetadataSnippet(false);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n \n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata() {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n `);\n });\n });\n\n describe('getRootLayoutWithGenerateMetadata', () => {\n it('generates root layout with TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(true);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n export function generateMetadata(): Metadata {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n\n it('generates root layout without TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(false);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n\n \n export function generateMetadata() {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getSentryExamplePageContents', () => {\n it('generates example page with TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: true,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: false,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without useClient directive', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: false,\n isTypeScript: true,\n });\n\n expect(template).not.toContain('\"use client\";');\n expect(template).toContain(\n 'https://my-org.sentry.io/issues/?project=123',\n );\n });\n });\n\n describe('getSentryExamplePagesDirApiRoute', () => {\n it('generates Pages Router API route with TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n\n it('generates Pages Router API route without TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n });\n\n describe('getSentryExampleAppDirApiRoute', () => {\n it('generates App Router API route with TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n\n it('generates App Router API route without TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n });\n});\n"]}
|
|
@@ -21,6 +21,7 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
21
21
|
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
|
|
22
22
|
performance: true,
|
|
23
23
|
replay: true,
|
|
24
|
+
logs: true,
|
|
24
25
|
});
|
|
25
26
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
26
27
|
"import * as Sentry from "@sentry/nuxt";
|
|
@@ -44,6 +45,9 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
44
45
|
|
|
45
46
|
// If you don't want to use Session Replay, just remove the line below:
|
|
46
47
|
integrations: [Sentry.replayIntegration()],
|
|
48
|
+
|
|
49
|
+
// Enable logs to be sent to Sentry
|
|
50
|
+
enableLogs: true,
|
|
47
51
|
|
|
48
52
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
49
53
|
debug: false,
|
|
@@ -55,6 +59,7 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
55
59
|
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
|
|
56
60
|
performance: false,
|
|
57
61
|
replay: true,
|
|
62
|
+
logs: true,
|
|
58
63
|
});
|
|
59
64
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
60
65
|
"import * as Sentry from "@sentry/nuxt";
|
|
@@ -74,6 +79,9 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
74
79
|
|
|
75
80
|
// If you don't want to use Session Replay, just remove the line below:
|
|
76
81
|
integrations: [Sentry.replayIntegration()],
|
|
82
|
+
|
|
83
|
+
// Enable logs to be sent to Sentry
|
|
84
|
+
enableLogs: true,
|
|
77
85
|
|
|
78
86
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
79
87
|
debug: false,
|
|
@@ -85,6 +93,7 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
85
93
|
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
|
|
86
94
|
performance: true,
|
|
87
95
|
replay: false,
|
|
96
|
+
logs: true,
|
|
88
97
|
});
|
|
89
98
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
90
99
|
"import * as Sentry from "@sentry/nuxt";
|
|
@@ -97,6 +106,44 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
97
106
|
// We recommend adjusting this value in production, or using tracesSampler
|
|
98
107
|
// for finer control
|
|
99
108
|
tracesSampleRate: 1.0,
|
|
109
|
+
|
|
110
|
+
// Enable logs to be sent to Sentry
|
|
111
|
+
enableLogs: true,
|
|
112
|
+
|
|
113
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
114
|
+
debug: false,
|
|
115
|
+
});
|
|
116
|
+
"
|
|
117
|
+
`);
|
|
118
|
+
});
|
|
119
|
+
(0, vitest_1.it)('generates Sentry config with logs disabled', () => {
|
|
120
|
+
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
|
|
121
|
+
performance: true,
|
|
122
|
+
replay: true,
|
|
123
|
+
logs: false,
|
|
124
|
+
});
|
|
125
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
126
|
+
"import * as Sentry from "@sentry/nuxt";
|
|
127
|
+
|
|
128
|
+
Sentry.init({
|
|
129
|
+
// If set up, you can use your runtime config here
|
|
130
|
+
// dsn: useRuntimeConfig().public.sentry.dsn,
|
|
131
|
+
dsn: "https://sentry.io/123",
|
|
132
|
+
|
|
133
|
+
// We recommend adjusting this value in production, or using tracesSampler
|
|
134
|
+
// for finer control
|
|
135
|
+
tracesSampleRate: 1.0,
|
|
136
|
+
|
|
137
|
+
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
138
|
+
// in development and sample at a lower rate in production
|
|
139
|
+
replaysSessionSampleRate: 0.1,
|
|
140
|
+
|
|
141
|
+
// If the entire session is not sampled, use the below sample rate to sample
|
|
142
|
+
// sessions when an error occurs.
|
|
143
|
+
replaysOnErrorSampleRate: 1.0,
|
|
144
|
+
|
|
145
|
+
// If you don't want to use Session Replay, just remove the line below:
|
|
146
|
+
integrations: [Sentry.replayIntegration()],
|
|
100
147
|
|
|
101
148
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
102
149
|
debug: false,
|
|
@@ -108,6 +155,30 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
108
155
|
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
|
|
109
156
|
performance: false,
|
|
110
157
|
replay: false,
|
|
158
|
+
logs: true,
|
|
159
|
+
});
|
|
160
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
161
|
+
"import * as Sentry from "@sentry/nuxt";
|
|
162
|
+
|
|
163
|
+
Sentry.init({
|
|
164
|
+
// If set up, you can use your runtime config here
|
|
165
|
+
// dsn: useRuntimeConfig().public.sentry.dsn,
|
|
166
|
+
dsn: "https://sentry.io/123",
|
|
167
|
+
|
|
168
|
+
// Enable logs to be sent to Sentry
|
|
169
|
+
enableLogs: true,
|
|
170
|
+
|
|
171
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
172
|
+
debug: false,
|
|
173
|
+
});
|
|
174
|
+
"
|
|
175
|
+
`);
|
|
176
|
+
});
|
|
177
|
+
(0, vitest_1.it)('generates Sentry config with all features disabled', () => {
|
|
178
|
+
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
|
|
179
|
+
performance: false,
|
|
180
|
+
replay: false,
|
|
181
|
+
logs: false,
|
|
111
182
|
});
|
|
112
183
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
113
184
|
"import * as Sentry from "@sentry/nuxt";
|
|
@@ -129,6 +200,7 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
129
200
|
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
|
|
130
201
|
performance: true,
|
|
131
202
|
replay: true,
|
|
203
|
+
logs: true,
|
|
132
204
|
});
|
|
133
205
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
134
206
|
"import * as Sentry from "@sentry/nuxt";
|
|
@@ -139,6 +211,9 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
139
211
|
// We recommend adjusting this value in production, or using tracesSampler
|
|
140
212
|
// for finer control
|
|
141
213
|
tracesSampleRate: 1.0,
|
|
214
|
+
|
|
215
|
+
// Enable logs to be sent to Sentry
|
|
216
|
+
enableLogs: true,
|
|
142
217
|
|
|
143
218
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
144
219
|
debug: false,
|
|
@@ -150,6 +225,50 @@ const templates_1 = require("../../src/nuxt/templates");
|
|
|
150
225
|
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
|
|
151
226
|
performance: false,
|
|
152
227
|
replay: true,
|
|
228
|
+
logs: true,
|
|
229
|
+
});
|
|
230
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
231
|
+
"import * as Sentry from "@sentry/nuxt";
|
|
232
|
+
|
|
233
|
+
Sentry.init({
|
|
234
|
+
dsn: "https://sentry.io/123",
|
|
235
|
+
|
|
236
|
+
// Enable logs to be sent to Sentry
|
|
237
|
+
enableLogs: true,
|
|
238
|
+
|
|
239
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
240
|
+
debug: false,
|
|
241
|
+
});
|
|
242
|
+
"
|
|
243
|
+
`);
|
|
244
|
+
});
|
|
245
|
+
(0, vitest_1.it)('generates Sentry config with logs disabled', () => {
|
|
246
|
+
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
|
|
247
|
+
performance: true,
|
|
248
|
+
replay: true,
|
|
249
|
+
logs: false,
|
|
250
|
+
});
|
|
251
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
252
|
+
"import * as Sentry from "@sentry/nuxt";
|
|
253
|
+
|
|
254
|
+
Sentry.init({
|
|
255
|
+
dsn: "https://sentry.io/123",
|
|
256
|
+
|
|
257
|
+
// We recommend adjusting this value in production, or using tracesSampler
|
|
258
|
+
// for finer control
|
|
259
|
+
tracesSampleRate: 1.0,
|
|
260
|
+
|
|
261
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
262
|
+
debug: false,
|
|
263
|
+
});
|
|
264
|
+
"
|
|
265
|
+
`);
|
|
266
|
+
});
|
|
267
|
+
(0, vitest_1.it)('generates Sentry config with all features disabled', () => {
|
|
268
|
+
const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
|
|
269
|
+
performance: false,
|
|
270
|
+
replay: false,
|
|
271
|
+
logs: false,
|
|
153
272
|
});
|
|
154
273
|
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
155
274
|
"import * as Sentry from "@sentry/nuxt";
|