@sentry/wizard 6.6.1 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/LICENSE +97 -8
- package/dist/bin.js +5 -0
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +5 -1
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +79 -0
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router.test.d.ts +1 -0
- package/dist/e2e-tests/tests/react-router.test.js +255 -0
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -0
- package/dist/e2e-tests/utils/index.d.ts +8 -2
- package/dist/e2e-tests/utils/index.js +72 -21
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/src/android/android-wizard.js +8 -1
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/angular-wizard.js +8 -1
- package/dist/src/angular/angular-wizard.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +8 -1
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +8 -1
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +35 -9
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +3 -3
- package/dist/src/nextjs/templates.js +18 -7
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +8 -1
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +8 -1
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -0
- package/dist/src/react-router/codemods/client.entry.js +73 -0
- package/dist/src/react-router/codemods/client.entry.js.map +1 -0
- package/dist/src/react-router/codemods/react-router-config.d.ts +9 -0
- package/dist/src/react-router/codemods/react-router-config.js +178 -0
- package/dist/src/react-router/codemods/react-router-config.js.map +1 -0
- package/dist/src/react-router/codemods/root.d.ts +1 -0
- package/dist/src/react-router/codemods/root.js +171 -0
- package/dist/src/react-router/codemods/root.js.map +1 -0
- package/dist/src/react-router/codemods/routes-config.d.ts +1 -0
- package/dist/src/react-router/codemods/routes-config.js +106 -0
- package/dist/src/react-router/codemods/routes-config.js.map +1 -0
- package/dist/src/react-router/codemods/server-entry.d.ts +4 -0
- package/dist/src/react-router/codemods/server-entry.js +275 -0
- package/dist/src/react-router/codemods/server-entry.js.map +1 -0
- package/dist/src/react-router/codemods/utils.d.ts +2 -0
- package/dist/src/react-router/codemods/utils.js +13 -0
- package/dist/src/react-router/codemods/utils.js.map +1 -0
- package/dist/src/react-router/codemods/vite.d.ts +8 -0
- package/dist/src/react-router/codemods/vite.js +169 -0
- package/dist/src/react-router/codemods/vite.js.map +1 -0
- package/dist/src/react-router/react-router-wizard.d.ts +2 -0
- package/dist/src/react-router/react-router-wizard.js +254 -0
- package/dist/src/react-router/react-router-wizard.js.map +1 -0
- package/dist/src/react-router/sdk-example.d.ts +18 -0
- package/dist/src/react-router/sdk-example.js +306 -0
- package/dist/src/react-router/sdk-example.js.map +1 -0
- package/dist/src/react-router/sdk-setup.d.ts +17 -0
- package/dist/src/react-router/sdk-setup.js +250 -0
- package/dist/src/react-router/sdk-setup.js.map +1 -0
- package/dist/src/react-router/templates.d.ts +11 -0
- package/dist/src/react-router/templates.js +273 -0
- package/dist/src/react-router/templates.js.map +1 -0
- package/dist/src/remix/remix-wizard.js +8 -1
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/run.d.ts +2 -1
- package/dist/src/run.js +6 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +8 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +8 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/ast-utils.d.ts +30 -0
- package/dist/src/utils/ast-utils.js +71 -1
- package/dist/src/utils/ast-utils.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +5 -2
- package/dist/src/utils/clack/index.js +8 -0
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/types.d.ts +9 -0
- package/dist/src/utils/types.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 +20 -0
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/react-router/codemods/client-entry.test.d.ts +1 -0
- package/dist/test/react-router/codemods/client-entry.test.js +168 -0
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -0
- package/dist/test/react-router/codemods/react-router-config.test.d.ts +1 -0
- package/dist/test/react-router/codemods/react-router-config.test.js +168 -0
- package/dist/test/react-router/codemods/react-router-config.test.js.map +1 -0
- package/dist/test/react-router/codemods/root.test.d.ts +1 -0
- package/dist/test/react-router/codemods/root.test.js +178 -0
- package/dist/test/react-router/codemods/root.test.js.map +1 -0
- package/dist/test/react-router/codemods/server-entry.test.d.ts +1 -0
- package/dist/test/react-router/codemods/server-entry.test.js +415 -0
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -0
- package/dist/test/react-router/codemods/vite.test.d.ts +1 -0
- package/dist/test/react-router/codemods/vite.test.js +158 -0
- package/dist/test/react-router/codemods/vite.test.js.map +1 -0
- package/dist/test/react-router/routes-config.test.d.ts +1 -0
- package/dist/test/react-router/routes-config.test.js +156 -0
- package/dist/test/react-router/routes-config.test.js.map +1 -0
- package/dist/test/react-router/sdk-setup.test.d.ts +1 -0
- package/dist/test/react-router/sdk-setup.test.js +411 -0
- package/dist/test/react-router/sdk-setup.test.js.map +1 -0
- package/dist/test/react-router/templates.test.d.ts +1 -0
- package/dist/test/react-router/templates.test.js +220 -0
- package/dist/test/react-router/templates.test.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
// Mock makeCodeSnippet utility
|
|
5
|
+
vitest_1.vi.mock('../../src/utils/clack', () => {
|
|
6
|
+
return {
|
|
7
|
+
__esModule: true,
|
|
8
|
+
makeCodeSnippet: vitest_1.vi.fn((colors, callback) => {
|
|
9
|
+
// Mock implementation that just calls the callback with simple string functions
|
|
10
|
+
const unchanged = (str) => str;
|
|
11
|
+
const plus = (str) => `+ ${str}`;
|
|
12
|
+
const minus = (str) => `- ${str}`;
|
|
13
|
+
return callback(unchanged, plus, minus);
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
const templates_1 = require("../../src/react-router/templates");
|
|
18
|
+
(0, vitest_1.describe)('React Router Templates', () => {
|
|
19
|
+
(0, vitest_1.beforeEach)(() => {
|
|
20
|
+
vitest_1.vi.clearAllMocks();
|
|
21
|
+
});
|
|
22
|
+
(0, vitest_1.describe)('Template Constants', () => {
|
|
23
|
+
(0, vitest_1.it)('should have correct ERROR_BOUNDARY_TEMPLATE content', () => {
|
|
24
|
+
(0, vitest_1.expect)(templates_1.ERROR_BOUNDARY_TEMPLATE).toContain('function ErrorBoundary({ error })');
|
|
25
|
+
(0, vitest_1.expect)(templates_1.ERROR_BOUNDARY_TEMPLATE).toContain('isRouteErrorResponse(error)');
|
|
26
|
+
(0, vitest_1.expect)(templates_1.ERROR_BOUNDARY_TEMPLATE).toContain('Sentry.captureException(error)');
|
|
27
|
+
(0, vitest_1.expect)(templates_1.ERROR_BOUNDARY_TEMPLATE).toContain('error.status === 404');
|
|
28
|
+
(0, vitest_1.expect)(templates_1.ERROR_BOUNDARY_TEMPLATE).toContain('An unexpected error occurred');
|
|
29
|
+
});
|
|
30
|
+
(0, vitest_1.it)('should have correct EXAMPLE_PAGE_TEMPLATE_TSX content', () => {
|
|
31
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_TSX).toContain('import type { Route }');
|
|
32
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_TSX).toContain('export async function loader()');
|
|
33
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_TSX).toContain('throw new Error("some error thrown in a loader")');
|
|
34
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_TSX).toContain('export default function SentryExamplePage()');
|
|
35
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_TSX).toContain('Loading this page will throw an error');
|
|
36
|
+
});
|
|
37
|
+
(0, vitest_1.it)('should have correct EXAMPLE_PAGE_TEMPLATE_JSX content', () => {
|
|
38
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_JSX).not.toContain('import type { Route }');
|
|
39
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_JSX).toContain('export async function loader()');
|
|
40
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_JSX).toContain('throw new Error("some error thrown in a loader")');
|
|
41
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_JSX).toContain('export default function SentryExamplePage()');
|
|
42
|
+
(0, vitest_1.expect)(templates_1.EXAMPLE_PAGE_TEMPLATE_JSX).toContain('Loading this page will throw an error');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.describe)('getManualClientEntryContent', () => {
|
|
46
|
+
(0, vitest_1.it)('should generate manual client entry with all features enabled', () => {
|
|
47
|
+
const dsn = 'https://test.sentry.io/123';
|
|
48
|
+
const enableTracing = true;
|
|
49
|
+
const enableReplay = true;
|
|
50
|
+
const enableLogs = true;
|
|
51
|
+
const result = (0, templates_1.getManualClientEntryContent)(dsn, enableTracing, enableReplay, enableLogs);
|
|
52
|
+
(0, vitest_1.expect)(result).toContain("+ import * as Sentry from '@sentry/react-router'");
|
|
53
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
54
|
+
(0, vitest_1.expect)(result).toContain('sendDefaultPii: true');
|
|
55
|
+
(0, vitest_1.expect)(result).toContain('Sentry.reactRouterTracingIntegration()');
|
|
56
|
+
(0, vitest_1.expect)(result).toContain('Sentry.replayIntegration()');
|
|
57
|
+
(0, vitest_1.expect)(result).toContain('enableLogs: true');
|
|
58
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 1.0');
|
|
59
|
+
(0, vitest_1.expect)(result).toContain('replaysSessionSampleRate: 0.1');
|
|
60
|
+
(0, vitest_1.expect)(result).toContain('replaysOnErrorSampleRate: 1.0');
|
|
61
|
+
(0, vitest_1.expect)(result).toContain('tracePropagationTargets');
|
|
62
|
+
(0, vitest_1.expect)(result).toContain('<HydratedRouter />');
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.it)('should generate manual client entry with tracing disabled', () => {
|
|
65
|
+
const dsn = 'https://test.sentry.io/123';
|
|
66
|
+
const enableTracing = false;
|
|
67
|
+
const enableReplay = true;
|
|
68
|
+
const enableLogs = false;
|
|
69
|
+
const result = (0, templates_1.getManualClientEntryContent)(dsn, enableTracing, enableReplay, enableLogs);
|
|
70
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
71
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 0');
|
|
72
|
+
(0, vitest_1.expect)(result).not.toContain('Sentry.reactRouterTracingIntegration()');
|
|
73
|
+
(0, vitest_1.expect)(result).toContain('Sentry.replayIntegration()');
|
|
74
|
+
(0, vitest_1.expect)(result).not.toContain('enableLogs: true');
|
|
75
|
+
(0, vitest_1.expect)(result).not.toContain('tracePropagationTargets');
|
|
76
|
+
});
|
|
77
|
+
(0, vitest_1.it)('should generate manual client entry with replay disabled', () => {
|
|
78
|
+
const dsn = 'https://test.sentry.io/123';
|
|
79
|
+
const enableTracing = true;
|
|
80
|
+
const enableReplay = false;
|
|
81
|
+
const enableLogs = true;
|
|
82
|
+
const result = (0, templates_1.getManualClientEntryContent)(dsn, enableTracing, enableReplay, enableLogs);
|
|
83
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
84
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 1.0');
|
|
85
|
+
(0, vitest_1.expect)(result).toContain('Sentry.reactRouterTracingIntegration()');
|
|
86
|
+
(0, vitest_1.expect)(result).not.toContain('Sentry.replayIntegration()');
|
|
87
|
+
(0, vitest_1.expect)(result).toContain('enableLogs: true');
|
|
88
|
+
(0, vitest_1.expect)(result).not.toContain('replaysSessionSampleRate');
|
|
89
|
+
(0, vitest_1.expect)(result).not.toContain('replaysOnErrorSampleRate');
|
|
90
|
+
});
|
|
91
|
+
(0, vitest_1.it)('should generate manual client entry with no integrations', () => {
|
|
92
|
+
const dsn = 'https://test.sentry.io/123';
|
|
93
|
+
const enableTracing = false;
|
|
94
|
+
const enableReplay = false;
|
|
95
|
+
const enableLogs = false;
|
|
96
|
+
const result = (0, templates_1.getManualClientEntryContent)(dsn, enableTracing, enableReplay, enableLogs);
|
|
97
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
98
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 0');
|
|
99
|
+
(0, vitest_1.expect)(result).not.toContain('Sentry.reactRouterTracingIntegration()');
|
|
100
|
+
(0, vitest_1.expect)(result).not.toContain('Sentry.replayIntegration()');
|
|
101
|
+
(0, vitest_1.expect)(result).not.toContain('enableLogs: true');
|
|
102
|
+
(0, vitest_1.expect)(result).toContain('integrations: [');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
(0, vitest_1.describe)('getManualServerEntryContent', () => {
|
|
106
|
+
(0, vitest_1.it)('should generate manual server entry content', () => {
|
|
107
|
+
const result = (0, templates_1.getManualServerEntryContent)();
|
|
108
|
+
(0, vitest_1.expect)(result).toContain("+ import * as Sentry from '@sentry/react-router'");
|
|
109
|
+
(0, vitest_1.expect)(result).toContain('createReadableStreamFromReadable');
|
|
110
|
+
(0, vitest_1.expect)(result).toContain('renderToPipeableStream');
|
|
111
|
+
(0, vitest_1.expect)(result).toContain('ServerRouter');
|
|
112
|
+
(0, vitest_1.expect)(result).toContain('+ const handleRequest = Sentry.createSentryHandleRequest({');
|
|
113
|
+
(0, vitest_1.expect)(result).toContain('+ export const handleError = Sentry.createSentryHandleError({');
|
|
114
|
+
(0, vitest_1.expect)(result).toContain('logErrors: false');
|
|
115
|
+
(0, vitest_1.expect)(result).toContain('export default handleRequest');
|
|
116
|
+
(0, vitest_1.expect)(result).toContain('rest of your server entry');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
(0, vitest_1.describe)('getManualRootContent', () => {
|
|
120
|
+
(0, vitest_1.it)('should generate manual root content for TypeScript', () => {
|
|
121
|
+
const isTs = true;
|
|
122
|
+
const result = (0, templates_1.getManualRootContent)(isTs);
|
|
123
|
+
(0, vitest_1.expect)(result).toContain("+ import * as Sentry from '@sentry/react-router'");
|
|
124
|
+
(0, vitest_1.expect)(result).toContain('export function ErrorBoundary({ error }: Route.ErrorBoundaryProps)');
|
|
125
|
+
(0, vitest_1.expect)(result).toContain('let stack: string | undefined');
|
|
126
|
+
(0, vitest_1.expect)(result).toContain('isRouteErrorResponse(error)');
|
|
127
|
+
(0, vitest_1.expect)(result).toContain('+ Sentry.captureException(error)');
|
|
128
|
+
(0, vitest_1.expect)(result).toContain('details = error.message');
|
|
129
|
+
(0, vitest_1.expect)(result).toContain('error.status === 404');
|
|
130
|
+
});
|
|
131
|
+
(0, vitest_1.it)('should generate manual root content for JavaScript', () => {
|
|
132
|
+
const isTs = false;
|
|
133
|
+
const result = (0, templates_1.getManualRootContent)(isTs);
|
|
134
|
+
(0, vitest_1.expect)(result).toContain("+ import * as Sentry from '@sentry/react-router'");
|
|
135
|
+
(0, vitest_1.expect)(result).toContain('export function ErrorBoundary({ error })');
|
|
136
|
+
(0, vitest_1.expect)(result).not.toContain(': Route.ErrorBoundaryProps');
|
|
137
|
+
(0, vitest_1.expect)(result).toContain('let stack');
|
|
138
|
+
(0, vitest_1.expect)(result).not.toContain(': string | undefined');
|
|
139
|
+
(0, vitest_1.expect)(result).toContain('isRouteErrorResponse(error)');
|
|
140
|
+
(0, vitest_1.expect)(result).toContain('+ Sentry.captureException(error)');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
(0, vitest_1.describe)('getManualServerInstrumentContent', () => {
|
|
144
|
+
(0, vitest_1.it)('should generate server instrumentation with all features enabled', () => {
|
|
145
|
+
const dsn = 'https://test.sentry.io/123';
|
|
146
|
+
const enableTracing = true;
|
|
147
|
+
const enableProfiling = true;
|
|
148
|
+
const enableLogs = true;
|
|
149
|
+
const result = (0, templates_1.getManualServerInstrumentContent)(dsn, enableTracing, enableProfiling, enableLogs);
|
|
150
|
+
(0, vitest_1.expect)(result).toContain("+ import * as Sentry from '@sentry/react-router'");
|
|
151
|
+
(0, vitest_1.expect)(result).toContain("import { nodeProfilingIntegration } from '@sentry/profiling-node'");
|
|
152
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
153
|
+
(0, vitest_1.expect)(result).toContain('sendDefaultPii: true');
|
|
154
|
+
(0, vitest_1.expect)(result).toContain('enableLogs: true');
|
|
155
|
+
(0, vitest_1.expect)(result).toContain('integrations: [nodeProfilingIntegration()]');
|
|
156
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 1.0');
|
|
157
|
+
(0, vitest_1.expect)(result).toContain('profilesSampleRate: 1.0');
|
|
158
|
+
(0, vitest_1.expect)(result).toContain('Capture 100% of the transactions');
|
|
159
|
+
(0, vitest_1.expect)(result).toContain('profile every transaction');
|
|
160
|
+
});
|
|
161
|
+
(0, vitest_1.it)('should generate server instrumentation with tracing disabled', () => {
|
|
162
|
+
const dsn = 'https://test.sentry.io/123';
|
|
163
|
+
const enableTracing = false;
|
|
164
|
+
const enableProfiling = false;
|
|
165
|
+
const result = (0, templates_1.getManualServerInstrumentContent)(dsn, enableTracing, enableProfiling);
|
|
166
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
167
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 0');
|
|
168
|
+
(0, vitest_1.expect)(result).not.toContain('nodeProfilingIntegration');
|
|
169
|
+
(0, vitest_1.expect)(result).not.toContain('profilesSampleRate');
|
|
170
|
+
(0, vitest_1.expect)(result).not.toContain('integrations: [nodeProfilingIntegration()]');
|
|
171
|
+
// When logs are not enabled, enableLogs should not appear
|
|
172
|
+
(0, vitest_1.expect)(result).not.toContain('enableLogs: true');
|
|
173
|
+
});
|
|
174
|
+
(0, vitest_1.it)('should generate server instrumentation with profiling disabled but tracing enabled', () => {
|
|
175
|
+
const dsn = 'https://test.sentry.io/123';
|
|
176
|
+
const enableTracing = true;
|
|
177
|
+
const enableProfiling = false;
|
|
178
|
+
const enableLogs = false;
|
|
179
|
+
const result = (0, templates_1.getManualServerInstrumentContent)(dsn, enableTracing, enableProfiling, enableLogs);
|
|
180
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
181
|
+
(0, vitest_1.expect)(result).toContain('tracesSampleRate: 1.0');
|
|
182
|
+
(0, vitest_1.expect)(result).not.toContain('nodeProfilingIntegration');
|
|
183
|
+
(0, vitest_1.expect)(result).not.toContain('profilesSampleRate');
|
|
184
|
+
(0, vitest_1.expect)(result).not.toContain('integrations:');
|
|
185
|
+
});
|
|
186
|
+
(0, vitest_1.it)('should handle special characters in DSN', () => {
|
|
187
|
+
const dsn = 'https://test@example.com/sentry/123?param=value';
|
|
188
|
+
const enableTracing = true;
|
|
189
|
+
const enableProfiling = false;
|
|
190
|
+
const result = (0, templates_1.getManualServerInstrumentContent)(dsn, enableTracing, enableProfiling);
|
|
191
|
+
(0, vitest_1.expect)(result).toContain(`dsn: "${dsn}"`);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
(0, vitest_1.describe)('getManualReactRouterConfigContent', () => {
|
|
195
|
+
(0, vitest_1.it)('should generate TypeScript config snippet with type imports and satisfies', () => {
|
|
196
|
+
const result = (0, templates_1.getManualReactRouterConfigContent)(true);
|
|
197
|
+
(0, vitest_1.expect)(result).toContain('import type { Config }');
|
|
198
|
+
(0, vitest_1.expect)(result).toContain('} satisfies Config;');
|
|
199
|
+
(0, vitest_1.expect)(result).toContain('sentryOnBuildEnd');
|
|
200
|
+
(0, vitest_1.expect)(result).toContain('ssr: true');
|
|
201
|
+
});
|
|
202
|
+
(0, vitest_1.it)('should generate JavaScript config snippet without TS-only syntax', () => {
|
|
203
|
+
const result = (0, templates_1.getManualReactRouterConfigContent)(false);
|
|
204
|
+
// JS version should NOT have TypeScript-only syntax
|
|
205
|
+
(0, vitest_1.expect)(result).not.toContain('import type');
|
|
206
|
+
(0, vitest_1.expect)(result).not.toContain('satisfies Config');
|
|
207
|
+
// JS version should have the standard import and export
|
|
208
|
+
(0, vitest_1.expect)(result).toContain('import { sentryOnBuildEnd }');
|
|
209
|
+
(0, vitest_1.expect)(result).toContain('sentryOnBuildEnd');
|
|
210
|
+
(0, vitest_1.expect)(result).toContain('ssr: true');
|
|
211
|
+
(0, vitest_1.expect)(result).toContain('export default {');
|
|
212
|
+
});
|
|
213
|
+
(0, vitest_1.it)('should default to TypeScript when no parameter is passed', () => {
|
|
214
|
+
const result = (0, templates_1.getManualReactRouterConfigContent)();
|
|
215
|
+
(0, vitest_1.expect)(result).toContain('import type { Config }');
|
|
216
|
+
(0, vitest_1.expect)(result).toContain('} satisfies Config;');
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
//# sourceMappingURL=templates.test.js.map
|
|
@@ -0,0 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AAC;YACxD,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;YAC7C,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YACtC,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,MAAM,MAAM,GAAG,IAAA,6CAAiC,GAAE,CAAC;YAEnD,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;YACnD,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi, beforeEach } from 'vitest';\n\n// Mock makeCodeSnippet utility\nvi.mock('../../src/utils/clack', () => {\n return {\n __esModule: true,\n makeCodeSnippet: vi.fn(\n (\n colors: boolean,\n callback: (\n unchanged: (str: string) => string,\n plus: (str: string) => string,\n minus: (str: string) => string,\n ) => string,\n ) => {\n // Mock implementation that just calls the callback with simple string functions\n const unchanged = (str: string) => str;\n const plus = (str: string) => `+ ${str}`;\n const minus = (str: string) => `- ${str}`;\n return callback(unchanged, plus, minus);\n },\n ),\n };\n});\n\nimport {\n ERROR_BOUNDARY_TEMPLATE,\n EXAMPLE_PAGE_TEMPLATE_TSX,\n EXAMPLE_PAGE_TEMPLATE_JSX,\n getManualClientEntryContent,\n getManualServerEntryContent,\n getManualRootContent,\n getManualServerInstrumentContent,\n getManualReactRouterConfigContent,\n} from '../../src/react-router/templates';\n\ndescribe('React Router Templates', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n describe('Template Constants', () => {\n it('should have correct ERROR_BOUNDARY_TEMPLATE content', () => {\n expect(ERROR_BOUNDARY_TEMPLATE).toContain(\n 'function ErrorBoundary({ error })',\n );\n expect(ERROR_BOUNDARY_TEMPLATE).toContain('isRouteErrorResponse(error)');\n expect(ERROR_BOUNDARY_TEMPLATE).toContain(\n 'Sentry.captureException(error)',\n );\n expect(ERROR_BOUNDARY_TEMPLATE).toContain('error.status === 404');\n expect(ERROR_BOUNDARY_TEMPLATE).toContain('An unexpected error occurred');\n });\n\n it('should have correct EXAMPLE_PAGE_TEMPLATE_TSX content', () => {\n expect(EXAMPLE_PAGE_TEMPLATE_TSX).toContain('import type { Route }');\n expect(EXAMPLE_PAGE_TEMPLATE_TSX).toContain(\n 'export async function loader()',\n );\n expect(EXAMPLE_PAGE_TEMPLATE_TSX).toContain(\n 'throw new Error(\"some error thrown in a loader\")',\n );\n expect(EXAMPLE_PAGE_TEMPLATE_TSX).toContain(\n 'export default function SentryExamplePage()',\n );\n expect(EXAMPLE_PAGE_TEMPLATE_TSX).toContain(\n 'Loading this page will throw an error',\n );\n });\n\n it('should have correct EXAMPLE_PAGE_TEMPLATE_JSX content', () => {\n expect(EXAMPLE_PAGE_TEMPLATE_JSX).not.toContain('import type { Route }');\n expect(EXAMPLE_PAGE_TEMPLATE_JSX).toContain(\n 'export async function loader()',\n );\n expect(EXAMPLE_PAGE_TEMPLATE_JSX).toContain(\n 'throw new Error(\"some error thrown in a loader\")',\n );\n expect(EXAMPLE_PAGE_TEMPLATE_JSX).toContain(\n 'export default function SentryExamplePage()',\n );\n expect(EXAMPLE_PAGE_TEMPLATE_JSX).toContain(\n 'Loading this page will throw an error',\n );\n });\n });\n\n describe('getManualClientEntryContent', () => {\n it('should generate manual client entry with all features enabled', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = true;\n const enableReplay = true;\n const enableLogs = true;\n\n const result = getManualClientEntryContent(\n dsn,\n enableTracing,\n enableReplay,\n enableLogs,\n );\n\n expect(result).toContain(\n \"+ import * as Sentry from '@sentry/react-router'\",\n );\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('sendDefaultPii: true');\n expect(result).toContain('Sentry.reactRouterTracingIntegration()');\n expect(result).toContain('Sentry.replayIntegration()');\n expect(result).toContain('enableLogs: true');\n expect(result).toContain('tracesSampleRate: 1.0');\n expect(result).toContain('replaysSessionSampleRate: 0.1');\n expect(result).toContain('replaysOnErrorSampleRate: 1.0');\n expect(result).toContain('tracePropagationTargets');\n expect(result).toContain('<HydratedRouter />');\n });\n\n it('should generate manual client entry with tracing disabled', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = false;\n const enableReplay = true;\n const enableLogs = false;\n\n const result = getManualClientEntryContent(\n dsn,\n enableTracing,\n enableReplay,\n enableLogs,\n );\n\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('tracesSampleRate: 0');\n expect(result).not.toContain('Sentry.reactRouterTracingIntegration()');\n expect(result).toContain('Sentry.replayIntegration()');\n expect(result).not.toContain('enableLogs: true');\n expect(result).not.toContain('tracePropagationTargets');\n });\n\n it('should generate manual client entry with replay disabled', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = true;\n const enableReplay = false;\n const enableLogs = true;\n\n const result = getManualClientEntryContent(\n dsn,\n enableTracing,\n enableReplay,\n enableLogs,\n );\n\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('tracesSampleRate: 1.0');\n expect(result).toContain('Sentry.reactRouterTracingIntegration()');\n expect(result).not.toContain('Sentry.replayIntegration()');\n expect(result).toContain('enableLogs: true');\n expect(result).not.toContain('replaysSessionSampleRate');\n expect(result).not.toContain('replaysOnErrorSampleRate');\n });\n\n it('should generate manual client entry with no integrations', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = false;\n const enableReplay = false;\n const enableLogs = false;\n\n const result = getManualClientEntryContent(\n dsn,\n enableTracing,\n enableReplay,\n enableLogs,\n );\n\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('tracesSampleRate: 0');\n expect(result).not.toContain('Sentry.reactRouterTracingIntegration()');\n expect(result).not.toContain('Sentry.replayIntegration()');\n expect(result).not.toContain('enableLogs: true');\n expect(result).toContain('integrations: [');\n });\n });\n\n describe('getManualServerEntryContent', () => {\n it('should generate manual server entry content', () => {\n const result = getManualServerEntryContent();\n\n expect(result).toContain(\n \"+ import * as Sentry from '@sentry/react-router'\",\n );\n expect(result).toContain('createReadableStreamFromReadable');\n expect(result).toContain('renderToPipeableStream');\n expect(result).toContain('ServerRouter');\n expect(result).toContain(\n '+ const handleRequest = Sentry.createSentryHandleRequest({',\n );\n expect(result).toContain(\n '+ export const handleError = Sentry.createSentryHandleError({',\n );\n expect(result).toContain('logErrors: false');\n expect(result).toContain('export default handleRequest');\n expect(result).toContain('rest of your server entry');\n });\n });\n\n describe('getManualRootContent', () => {\n it('should generate manual root content for TypeScript', () => {\n const isTs = true;\n const result = getManualRootContent(isTs);\n\n expect(result).toContain(\n \"+ import * as Sentry from '@sentry/react-router'\",\n );\n expect(result).toContain(\n 'export function ErrorBoundary({ error }: Route.ErrorBoundaryProps)',\n );\n expect(result).toContain('let stack: string | undefined');\n expect(result).toContain('isRouteErrorResponse(error)');\n expect(result).toContain('+ Sentry.captureException(error)');\n expect(result).toContain('details = error.message');\n expect(result).toContain('error.status === 404');\n });\n\n it('should generate manual root content for JavaScript', () => {\n const isTs = false;\n const result = getManualRootContent(isTs);\n\n expect(result).toContain(\n \"+ import * as Sentry from '@sentry/react-router'\",\n );\n expect(result).toContain('export function ErrorBoundary({ error })');\n expect(result).not.toContain(': Route.ErrorBoundaryProps');\n expect(result).toContain('let stack');\n expect(result).not.toContain(': string | undefined');\n expect(result).toContain('isRouteErrorResponse(error)');\n expect(result).toContain('+ Sentry.captureException(error)');\n });\n });\n\n describe('getManualServerInstrumentContent', () => {\n it('should generate server instrumentation with all features enabled', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = true;\n const enableProfiling = true;\n const enableLogs = true;\n\n const result = getManualServerInstrumentContent(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n\n expect(result).toContain(\n \"+ import * as Sentry from '@sentry/react-router'\",\n );\n expect(result).toContain(\n \"import { nodeProfilingIntegration } from '@sentry/profiling-node'\",\n );\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('sendDefaultPii: true');\n expect(result).toContain('enableLogs: true');\n expect(result).toContain('integrations: [nodeProfilingIntegration()]');\n expect(result).toContain('tracesSampleRate: 1.0');\n expect(result).toContain('profilesSampleRate: 1.0');\n expect(result).toContain('Capture 100% of the transactions');\n expect(result).toContain('profile every transaction');\n });\n\n it('should generate server instrumentation with tracing disabled', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = false;\n const enableProfiling = false;\n\n const result = getManualServerInstrumentContent(\n dsn,\n enableTracing,\n enableProfiling,\n );\n\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('tracesSampleRate: 0');\n expect(result).not.toContain('nodeProfilingIntegration');\n expect(result).not.toContain('profilesSampleRate');\n expect(result).not.toContain(\n 'integrations: [nodeProfilingIntegration()]',\n );\n // When logs are not enabled, enableLogs should not appear\n expect(result).not.toContain('enableLogs: true');\n });\n\n it('should generate server instrumentation with profiling disabled but tracing enabled', () => {\n const dsn = 'https://test.sentry.io/123';\n const enableTracing = true;\n const enableProfiling = false;\n const enableLogs = false;\n\n const result = getManualServerInstrumentContent(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n\n expect(result).toContain(`dsn: \"${dsn}\"`);\n expect(result).toContain('tracesSampleRate: 1.0');\n expect(result).not.toContain('nodeProfilingIntegration');\n expect(result).not.toContain('profilesSampleRate');\n expect(result).not.toContain('integrations:');\n });\n\n it('should handle special characters in DSN', () => {\n const dsn = 'https://test@example.com/sentry/123?param=value';\n const enableTracing = true;\n const enableProfiling = false;\n\n const result = getManualServerInstrumentContent(\n dsn,\n enableTracing,\n enableProfiling,\n );\n\n expect(result).toContain(`dsn: \"${dsn}\"`);\n });\n });\n\n describe('getManualReactRouterConfigContent', () => {\n it('should generate TypeScript config snippet with type imports and satisfies', () => {\n const result = getManualReactRouterConfigContent(true);\n\n expect(result).toContain('import type { Config }');\n expect(result).toContain('} satisfies Config;');\n expect(result).toContain('sentryOnBuildEnd');\n expect(result).toContain('ssr: true');\n });\n\n it('should generate JavaScript config snippet without TS-only syntax', () => {\n const result = getManualReactRouterConfigContent(false);\n\n // JS version should NOT have TypeScript-only syntax\n expect(result).not.toContain('import type');\n expect(result).not.toContain('satisfies Config');\n\n // JS version should have the standard import and export\n expect(result).toContain('import { sentryOnBuildEnd }');\n expect(result).toContain('sentryOnBuildEnd');\n expect(result).toContain('ssr: true');\n expect(result).toContain('export default {');\n });\n\n it('should default to TypeScript when no parameter is passed', () => {\n const result = getManualReactRouterConfigContent();\n\n expect(result).toContain('import type { Config }');\n expect(result).toContain('} satisfies Config;');\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.7.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",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"test:watch": "vitest"
|
|
92
92
|
},
|
|
93
93
|
"author": "Sentry",
|
|
94
|
-
"license": "MIT",
|
|
94
|
+
"license": "FSL-1.1-MIT",
|
|
95
95
|
"volta": {
|
|
96
96
|
"node": "18.20.6",
|
|
97
97
|
"yarn": "1.22.19"
|