@sentry/wizard 6.9.0 → 6.11.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 +56 -1
- package/dist/ci-ensure-runtime-loaded.sh +82 -0
- package/dist/e2e-tests/tests/angular-17.test.js +72 -82
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +71 -80
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/cloudflare-worker.test.d.ts +1 -0
- package/dist/e2e-tests/tests/cloudflare-worker.test.js +64 -0
- package/dist/e2e-tests/tests/cloudflare-worker.test.js.map +1 -0
- package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js +2 -5
- package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js.map +1 -1
- package/dist/e2e-tests/tests/expo.test.js +36 -61
- package/dist/e2e-tests/tests/expo.test.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +63 -70
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +2 -2
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +54 -82
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +95 -105
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-16.test.d.ts +1 -0
- package/dist/e2e-tests/tests/nextjs-16.test.js +123 -0
- package/dist/e2e-tests/tests/nextjs-16.test.js.map +1 -0
- package/dist/e2e-tests/tests/nuxt-3.test.js +45 -58
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +59 -73
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/pnpm-workspace.test.js +4 -7
- package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-native.test.js +44 -80
- package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router.test.js +163 -145
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +162 -132
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +48 -36
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +3 -6
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +21 -43
- package/dist/e2e-tests/utils/index.js +108 -183
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/get-e2e-test-matrix.mjs +11 -0
- 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 +2 -4
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/angular-wizard.js +4 -6
- package/dist/src/angular/angular-wizard.js.map +1 -1
- package/dist/src/angular/sdk-setup.js +1 -1
- package/dist/src/angular/sdk-setup.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +2 -4
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/cloudflare/cloudflare-wizard.d.ts +3 -0
- package/dist/src/cloudflare/cloudflare-wizard.js +99 -0
- package/dist/src/cloudflare/cloudflare-wizard.js.map +1 -0
- package/dist/src/cloudflare/sdk-setup.d.ts +7 -0
- package/dist/src/cloudflare/sdk-setup.js +47 -0
- package/dist/src/cloudflare/sdk-setup.js.map +1 -0
- package/dist/src/cloudflare/templates.d.ts +4 -0
- package/dist/src/cloudflare/templates.js +44 -0
- package/dist/src/cloudflare/templates.js.map +1 -0
- package/dist/src/cloudflare/wrangler/create-wrangler-config.d.ts +4 -0
- package/dist/src/cloudflare/wrangler/create-wrangler-config.js +27 -0
- package/dist/src/cloudflare/wrangler/create-wrangler-config.js.map +1 -0
- package/dist/src/cloudflare/wrangler/ensure-wrangler-config.d.ts +4 -0
- package/dist/src/cloudflare/wrangler/ensure-wrangler-config.js +25 -0
- package/dist/src/cloudflare/wrangler/ensure-wrangler-config.js.map +1 -0
- package/dist/src/cloudflare/wrangler/find-wrangler-config.d.ts +4 -0
- package/dist/src/cloudflare/wrangler/find-wrangler-config.js +23 -0
- package/dist/src/cloudflare/wrangler/find-wrangler-config.js.map +1 -0
- package/dist/src/cloudflare/wrangler/get-entry-point-from-wrangler-config.d.ts +6 -0
- package/dist/src/cloudflare/wrangler/get-entry-point-from-wrangler-config.js +52 -0
- package/dist/src/cloudflare/wrangler/get-entry-point-from-wrangler-config.js.map +1 -0
- package/dist/src/cloudflare/wrangler/update-wrangler-config.d.ts +17 -0
- package/dist/src/cloudflare/wrangler/update-wrangler-config.js +173 -0
- package/dist/src/cloudflare/wrangler/update-wrangler-config.js.map +1 -0
- package/dist/src/cloudflare/wrap-worker.d.ts +32 -0
- package/dist/src/cloudflare/wrap-worker.js +109 -0
- package/dist/src/cloudflare/wrap-worker.js.map +1 -0
- package/dist/src/flutter/flutter-wizard.js +3 -6
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +46 -10
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +6 -3
- package/dist/src/nextjs/templates.js +144 -93
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +3 -5
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +2 -4
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.js +4 -1
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +3 -5
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-example.js +5 -2
- package/dist/src/react-router/sdk-example.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +1 -1
- package/dist/src/react-router/sdk-setup.js +3 -4
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +2 -4
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/run.d.ts +1 -1
- package/dist/src/run.js +5 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/wrangler.js +1 -1
- package/dist/src/sourcemaps/tools/wrangler.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +4 -6
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/telemetry.d.ts +1 -1
- package/dist/src/telemetry.js +52 -31
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/abort-if-sportlight-not-supported.d.ts +5 -0
- package/dist/src/utils/abort-if-sportlight-not-supported.js +40 -0
- package/dist/src/utils/abort-if-sportlight-not-supported.js.map +1 -0
- package/dist/src/utils/ast-utils.d.ts +1 -1
- package/dist/src/utils/ast-utils.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +19 -2
- package/dist/src/utils/clack/index.js +174 -12
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/clack/mcp-config.js +117 -59
- package/dist/src/utils/clack/mcp-config.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +2 -4
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +7 -3
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +8 -2
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/cloudflare/create-wrangler-config.test.d.ts +1 -0
- package/dist/test/cloudflare/create-wrangler-config.test.js +48 -0
- package/dist/test/cloudflare/create-wrangler-config.test.js.map +1 -0
- package/dist/test/cloudflare/ensure-wrangler-config.test.d.ts +1 -0
- package/dist/test/cloudflare/ensure-wrangler-config.test.js +61 -0
- package/dist/test/cloudflare/ensure-wrangler-config.test.js.map +1 -0
- package/dist/test/cloudflare/find-wrangler-config.test.d.ts +1 -0
- package/dist/test/cloudflare/find-wrangler-config.test.js +77 -0
- package/dist/test/cloudflare/find-wrangler-config.test.js.map +1 -0
- package/dist/test/cloudflare/get-entry-point-from-wrangler-config.test.d.ts +1 -0
- package/dist/test/cloudflare/get-entry-point-from-wrangler-config.test.js +81 -0
- package/dist/test/cloudflare/get-entry-point-from-wrangler-config.test.js.map +1 -0
- package/dist/test/cloudflare/sdk-setup.test.d.ts +1 -0
- package/dist/test/cloudflare/sdk-setup.test.js +152 -0
- package/dist/test/cloudflare/sdk-setup.test.js.map +1 -0
- package/dist/test/cloudflare/templates.test.d.ts +1 -0
- package/dist/test/cloudflare/templates.test.js +68 -0
- package/dist/test/cloudflare/templates.test.js.map +1 -0
- package/dist/test/cloudflare/update-wrangler-config.test.d.ts +1 -0
- package/dist/test/cloudflare/update-wrangler-config.test.js +216 -0
- package/dist/test/cloudflare/update-wrangler-config.test.js.map +1 -0
- package/dist/test/cloudflare/wrap-worker.test.d.ts +1 -0
- package/dist/test/cloudflare/wrap-worker.test.js +143 -0
- package/dist/test/cloudflare/wrap-worker.test.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +156 -87
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nextjs/wizard-double-wrap-prevention.test.js +12 -7
- package/dist/test/nextjs/wizard-double-wrap-prevention.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +2 -2
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +37 -29
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/clack/mcp-config.test.js +176 -51
- package/dist/test/utils/clack/mcp-config.test.js.map +1 -1
- package/package.json +6 -5
|
@@ -27,65 +27,56 @@ const path = __importStar(require("node:path"));
|
|
|
27
27
|
const Constants_1 = require("../../lib/Constants");
|
|
28
28
|
const utils_1 = require("../utils");
|
|
29
29
|
const vitest_1 = require("vitest");
|
|
30
|
+
//@ts-expect-error - clifty is ESM only
|
|
31
|
+
const clifty_1 = require("clifty");
|
|
30
32
|
(0, vitest_1.describe)('Nuxt-3', () => {
|
|
31
|
-
|
|
33
|
+
let wizardExitCode;
|
|
34
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('nuxt-3-test-app');
|
|
32
35
|
(0, vitest_1.beforeAll)(async () => {
|
|
33
|
-
await
|
|
36
|
+
wizardExitCode = await (0, clifty_1.withEnv)({
|
|
37
|
+
cwd: projectDir,
|
|
38
|
+
})
|
|
39
|
+
.defineInteraction()
|
|
40
|
+
.expectOutput('The Sentry Nuxt Wizard will help you set up Sentry for your application')
|
|
41
|
+
.whenAsked('Please select your package manager.')
|
|
42
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
43
|
+
.whenAsked('Do you want to add an override for @vercel/nft')
|
|
44
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
45
|
+
.expectOutput('Installing @sentry/nuxt')
|
|
46
|
+
.expectOutput('Installed @sentry/nuxt', {
|
|
47
|
+
timeout: 240000,
|
|
48
|
+
})
|
|
49
|
+
.expectOutput('Created .env.sentry-build-plugin')
|
|
50
|
+
.whenAsked('Please select your deployment platform')
|
|
51
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.DOWN, clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
52
|
+
.expectOutput('Added Sentry Nuxt Module to nuxt.config.ts')
|
|
53
|
+
.whenAsked('Do you want to enable Tracing')
|
|
54
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
55
|
+
.whenAsked('Do you want to enable Session Replay')
|
|
56
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
57
|
+
.whenAsked('Do you want to enable Logs')
|
|
58
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
59
|
+
.expectOutput('Created new sentry.server.config.ts')
|
|
60
|
+
.expectOutput('Created new sentry.client.config.ts')
|
|
61
|
+
.whenAsked('Do you want to create an example page')
|
|
62
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
63
|
+
.expectOutput('Created pages/index.vue')
|
|
64
|
+
.expectOutput('After building your Nuxt app, you need to --import the Sentry server config file when running your app')
|
|
65
|
+
.whenAsked('Do you want to open the docs?')
|
|
66
|
+
.respondWith(clifty_1.KEYS.RIGHT, clifty_1.KEYS.ENTER) // no
|
|
67
|
+
.whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
|
|
68
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
69
|
+
.expectOutput('Successfully installed the Sentry Nuxt SDK!')
|
|
70
|
+
.run((0, utils_1.getWizardCommand)(Constants_1.Integration.nuxt));
|
|
34
71
|
});
|
|
35
72
|
(0, vitest_1.afterAll)(() => {
|
|
36
|
-
(
|
|
37
|
-
|
|
73
|
+
cleanup();
|
|
74
|
+
});
|
|
75
|
+
(0, vitest_1.test)('exits with exit code 0', () => {
|
|
76
|
+
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
38
77
|
});
|
|
39
|
-
testNuxtProjectSetup(projectDir);
|
|
40
|
-
testNuxtProjectConfigs(projectDir);
|
|
41
|
-
testNuxtProjectBuildsAndRuns(projectDir);
|
|
42
|
-
});
|
|
43
|
-
async function runWizardOnNuxtProject(projectDir) {
|
|
44
|
-
const integration = Constants_1.Integration.nuxt;
|
|
45
|
-
const wizardInstance = (0, utils_1.startWizardInstance)(integration, projectDir);
|
|
46
|
-
const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
|
|
47
|
-
const nftOverridePrompted = packageManagerPrompted &&
|
|
48
|
-
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
49
|
-
// Selecting `yarn` as the package manager
|
|
50
|
-
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Do you want to add an override for @vercel/nft version ^0.27.4?', {
|
|
51
|
-
timeout: 240000,
|
|
52
|
-
}));
|
|
53
|
-
const deploymentPlatformPrompted = nftOverridePrompted &&
|
|
54
|
-
(await wizardInstance.sendStdinAndWaitForOutput(utils_1.KEYS.ENTER, 'Please select your deployment platform.', {
|
|
55
|
-
timeout: 240000,
|
|
56
|
-
}));
|
|
57
|
-
const tracingOptionPrompted = deploymentPlatformPrompted &&
|
|
58
|
-
(await wizardInstance.sendStdinAndWaitForOutput(utils_1.KEYS.ENTER,
|
|
59
|
-
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
60
|
-
'Do you want to enable', {
|
|
61
|
-
timeout: 240000,
|
|
62
|
-
}));
|
|
63
|
-
const replayOptionPrompted = tracingOptionPrompted &&
|
|
64
|
-
(await wizardInstance.sendStdinAndWaitForOutput(utils_1.KEYS.ENTER,
|
|
65
|
-
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
66
|
-
'to get a video-like reproduction of errors during a user session?'));
|
|
67
|
-
const logOptionPrompted = replayOptionPrompted &&
|
|
68
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
69
|
-
// "Do you want to enable Logs", sometimes doesn't work as `Logs` can be printed in bold.
|
|
70
|
-
'to send your application logs to Sentry?'));
|
|
71
|
-
const examplePagePrompted = logOptionPrompted &&
|
|
72
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to create an example page', {
|
|
73
|
-
optional: true,
|
|
74
|
-
}));
|
|
75
|
-
// Handle the MCP prompt (default is now Yes, so press DOWN to select No)
|
|
76
|
-
const mcpPrompted = examplePagePrompted &&
|
|
77
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?', {
|
|
78
|
-
optional: true,
|
|
79
|
-
}));
|
|
80
|
-
// Now wait for the success message
|
|
81
|
-
mcpPrompted &&
|
|
82
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Successfully installed the Sentry Nuxt SDK!'));
|
|
83
|
-
wizardInstance.kill();
|
|
84
|
-
}
|
|
85
|
-
function testNuxtProjectSetup(projectDir) {
|
|
86
|
-
const integration = Constants_1.Integration.nuxt;
|
|
87
78
|
(0, vitest_1.test)('package.json is updated correctly', () => {
|
|
88
|
-
(0, utils_1.checkPackageJson)(projectDir,
|
|
79
|
+
(0, utils_1.checkPackageJson)(projectDir, '@sentry/nuxt');
|
|
89
80
|
});
|
|
90
81
|
(0, vitest_1.test)('.env-sentry-build-plugin is created and contains the auth token', () => {
|
|
91
82
|
(0, utils_1.checkEnvBuildPlugin)(projectDir);
|
|
@@ -98,8 +89,6 @@ function testNuxtProjectSetup(projectDir) {
|
|
|
98
89
|
(0, utils_1.checkFileExists)(`${projectDir}/pages/sentry-example-page.vue`);
|
|
99
90
|
(0, utils_1.checkFileExists)(`${projectDir}/server/api/sentry-example-api.ts`);
|
|
100
91
|
});
|
|
101
|
-
}
|
|
102
|
-
function testNuxtProjectConfigs(projectDir) {
|
|
103
92
|
(0, vitest_1.test)('nuxt config contains sentry module', () => {
|
|
104
93
|
(0, utils_1.checkFileContents)(path.resolve(projectDir, 'nuxt.config.ts'), [
|
|
105
94
|
"modules: ['@sentry/nuxt/module'],",
|
|
@@ -158,13 +147,11 @@ function testNuxtProjectConfigs(projectDir) {
|
|
|
158
147
|
'});',
|
|
159
148
|
]);
|
|
160
149
|
});
|
|
161
|
-
}
|
|
162
|
-
function testNuxtProjectBuildsAndRuns(projectDir) {
|
|
163
150
|
(0, vitest_1.test)('builds successfully', async () => {
|
|
164
151
|
await (0, utils_1.checkIfBuilds)(projectDir);
|
|
165
152
|
});
|
|
166
153
|
(0, vitest_1.test)('runs on prod mode correctly', async () => {
|
|
167
154
|
await (0, utils_1.checkIfRunsOnProdMode)(projectDir, 'Listening on');
|
|
168
155
|
});
|
|
169
|
-
}
|
|
156
|
+
});
|
|
170
157
|
//# sourceMappingURL=nuxt-3.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt-3.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nuxt-3.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAYkB;AAClB,mCAA6D;AAE7D,IAAA,iBAAQ,EAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,sCAAsC,CACvC,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;QACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;QAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAEjC,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAEnC,4BAA4B,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,sBAAsB,CAAC,UAAkB;IACtD,MAAM,WAAW,GAAG,uBAAW,CAAC,IAAI,CAAC;IAErC,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpE,MAAM,s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AC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\ndescribe('Nuxt-3', () => {\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nuxt-3-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnNuxtProject(projectDir);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n testNuxtProjectSetup(projectDir);\n\n testNuxtProjectConfigs(projectDir);\n\n testNuxtProjectBuildsAndRuns(projectDir);\n});\n\nasync function runWizardOnNuxtProject(projectDir: string): Promise<void> {\n const integration = Integration.nuxt;\n\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const nftOverridePrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to add an override for @vercel/nft version ^0.27.4?',\n {\n timeout: 240_000,\n },\n ));\n\n const deploymentPlatformPrompted =\n nftOverridePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n KEYS.ENTER,\n 'Please select your deployment platform.',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n deploymentPlatformPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n KEYS.ENTER,\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'Do you want to enable',\n {\n timeout: 240_000,\n },\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n KEYS.ENTER,\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n const examplePagePrompted =\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n // Handle the MCP prompt (default is now Yes, so press DOWN to select No)\n const mcpPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n {\n optional: true,\n },\n ));\n\n // Now wait for the success message\n mcpPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Nuxt SDK!',\n ));\n\n wizardInstance.kill();\n}\n\nfunction testNuxtProjectSetup(projectDir: string) {\n const integration = Integration.nuxt;\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.client.config.ts`);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/pages/sentry-example-page.vue`);\n checkFileExists(`${projectDir}/server/api/sentry-example-api.ts`);\n });\n}\n\nfunction testNuxtProjectConfigs(projectDir: string) {\n test('nuxt config contains sentry module', () => {\n checkFileContents(path.resolve(projectDir, 'nuxt.config.ts'), [\n \"modules: ['@sentry/nuxt/module'],\",\n 'sentry: {',\n ` org: '${TEST_ARGS.ORG_SLUG}',`,\n ` project: '${TEST_ARGS.PROJECT_SLUG}'`,\n '},',\n 'sourcemap: {',\n \" client: 'hidden'\",\n '}',\n ]);\n });\n\n test('sentry.client.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.client.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ' // If set up, you can use your runtime config here',\n ' // dsn: useRuntimeConfig().public.sentry.dsn,',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\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 ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ` // Enable sending of user PII (Personally Identifiable Information)`,\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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 test('sentry.server.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.server.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ' // Enable sending of user PII (Personally Identifiable Information)',\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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\nfunction testNuxtProjectBuildsAndRuns(projectDir: string) {\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Listening on');\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nuxt-3.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nuxt-3.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAUkB;AAClB,mCAAqE;AAErE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,cAAsB,CAAC;IAC3B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EAAC,iBAAiB,CAAC,CAAC;IAEzE,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,cAAc,GAAG,MAAM,IAAA,gBAAO,EAAC;YAC7B,GAAG,EAAE,UAAU;SAChB,CAAC;aACC,iBAAiB,EAAE;aACnB,YAAY,CACX,yEAAyE,CAC1E;aACA,SAAS,CAAC,qCAAqC,CAAC;aAChD,WAAW,CAAC,aAAI,CAAC,IAAI,EAAE,aAAI,CAAC,KAAK,CAAC;aAClC,SAAS,CAAC,gDAAgD,CAAC;aAC3D,WAAW,CAAC,aAAI,CAAC,KAAK,CAAC;aACvB,YAAY,CAAC,yBAAyB,CAAC;aACvC,YAAY,CAAC,wBAAwB,EAAE;YACtC,OAAO,EAAE,MAAO;SACjB,CAAC;aACD,YAAY,CAAC,kCAAkC,CAAC;aAChD,SAAS,CAAC,wCAAwC,CAAC;aACnD,WAAW,CAAC,aAAI,CAAC,I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C3E,+CAA+C;YAC/C,uCAAuC;YACvC,qBAAqB;YACrB,uEAAuE;YACvE,oGAAoG;YACpG,yBAAyB;YACzB,+GAA+G;YAC/G,iBAAiB;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kCAAkC,EAAE,GAAG,EAAE;QAC5C,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,yBAAyB,CAAC,EAAE;YACrE,yCAAyC;YACzC,eAAe;YACf,WAAW,iBAAS,CAAC,WAAW,IAAI;YACpC,8EAA8E;YAC9E,wBAAwB;YACxB,0BAA0B;YAC1B,uCAAuC;YACvC,qBAAqB;YACrB,uEAAuE;YACvE,oGAAoG;YACpG,yBAAyB;YACzB,+GAA+G;YAC/G,iBAAiB;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, test } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Nuxt-3', () => {\n let wizardExitCode: number;\n const { projectDir, cleanup } = createIsolatedTestEnv('nuxt-3-test-app');\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry Nuxt Wizard will help you set up Sentry for your application',\n )\n .whenAsked('Please select your package manager.')\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .whenAsked('Do you want to add an override for @vercel/nft')\n .respondWith(KEYS.ENTER)\n .expectOutput('Installing @sentry/nuxt')\n .expectOutput('Installed @sentry/nuxt', {\n timeout: 240_000,\n })\n .expectOutput('Created .env.sentry-build-plugin')\n .whenAsked('Please select your deployment platform')\n .respondWith(KEYS.DOWN, KEYS.DOWN, KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Added Sentry Nuxt Module to nuxt.config.ts')\n .whenAsked('Do you want to enable Tracing')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to enable Session Replay')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to enable Logs')\n .respondWith(KEYS.ENTER)\n .expectOutput('Created new sentry.server.config.ts')\n .expectOutput('Created new sentry.client.config.ts')\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .expectOutput('Created pages/index.vue')\n .expectOutput(\n 'After building your Nuxt app, you need to --import the Sentry server config file when running your app',\n )\n .whenAsked('Do you want to open the docs?')\n .respondWith(KEYS.RIGHT, KEYS.ENTER) // no\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry Nuxt SDK!')\n .run(getWizardCommand(Integration.nuxt));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n test('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, '@sentry/nuxt');\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.client.config.ts`);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/pages/sentry-example-page.vue`);\n checkFileExists(`${projectDir}/server/api/sentry-example-api.ts`);\n });\n\n test('nuxt config contains sentry module', () => {\n checkFileContents(path.resolve(projectDir, 'nuxt.config.ts'), [\n \"modules: ['@sentry/nuxt/module'],\",\n 'sentry: {',\n ` org: '${TEST_ARGS.ORG_SLUG}',`,\n ` project: '${TEST_ARGS.PROJECT_SLUG}'`,\n '},',\n 'sourcemap: {',\n \" client: 'hidden'\",\n '}',\n ]);\n });\n\n test('sentry.client.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.client.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ' // If set up, you can use your runtime config here',\n ' // dsn: useRuntimeConfig().public.sentry.dsn,',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\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 ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ` // Enable sending of user PII (Personally Identifiable Information)`,\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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 test('sentry.server.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.server.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ' // Enable sending of user PII (Personally Identifiable Information)',\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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 test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Listening on');\n });\n});\n"]}
|
|
@@ -26,87 +26,75 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const path = __importStar(require("node:path"));
|
|
27
27
|
const Constants_1 = require("../../lib/Constants");
|
|
28
28
|
const utils_1 = require("../utils");
|
|
29
|
-
const utils_2 = require("../utils");
|
|
30
29
|
const vitest_1 = require("vitest");
|
|
30
|
+
//@ts-expect-error - clifty is ESM only
|
|
31
|
+
const clifty_1 = require("clifty");
|
|
31
32
|
(0, vitest_1.describe)('Nuxt-4', () => {
|
|
32
|
-
|
|
33
|
+
let wizardExitCode;
|
|
34
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('nuxt-4-test-app');
|
|
33
35
|
(0, vitest_1.beforeAll)(async () => {
|
|
34
|
-
await
|
|
36
|
+
wizardExitCode = await (0, clifty_1.withEnv)({
|
|
37
|
+
cwd: projectDir,
|
|
38
|
+
})
|
|
39
|
+
.defineInteraction()
|
|
40
|
+
.expectOutput('The Sentry Nuxt Wizard will help you set up Sentry for your application')
|
|
41
|
+
.whenAsked('Please select your package manager.')
|
|
42
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
43
|
+
.whenAsked('Do you want to add an override for @vercel/nft')
|
|
44
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
45
|
+
.expectOutput('Installing @sentry/nuxt')
|
|
46
|
+
.expectOutput('Installed @sentry/nuxt', {
|
|
47
|
+
timeout: 240000,
|
|
48
|
+
})
|
|
49
|
+
.expectOutput('Created .env.sentry-build-plugin')
|
|
50
|
+
.whenAsked('Please select your deployment platform')
|
|
51
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.DOWN, clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
52
|
+
.expectOutput('Added Sentry Nuxt Module to nuxt.config.ts')
|
|
53
|
+
.whenAsked('Do you want to enable Tracing')
|
|
54
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
55
|
+
.whenAsked('Do you want to enable Session Replay')
|
|
56
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
57
|
+
.whenAsked('Do you want to enable Logs')
|
|
58
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
59
|
+
.expectOutput('Created new sentry.server.config.ts')
|
|
60
|
+
.expectOutput('Created new sentry.client.config.ts')
|
|
61
|
+
.whenAsked('Do you want to create an example page')
|
|
62
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
63
|
+
.expectOutput('Created app/pages/index.vue.')
|
|
64
|
+
.expectOutput('After building your Nuxt app, you need to --import the Sentry server config file when running your app')
|
|
65
|
+
.whenAsked('Do you want to open the docs?')
|
|
66
|
+
.respondWith(clifty_1.KEYS.RIGHT, clifty_1.KEYS.ENTER) // no
|
|
67
|
+
.whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
|
|
68
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
69
|
+
.expectOutput('Successfully installed the Sentry Nuxt SDK!')
|
|
70
|
+
.run((0, utils_1.getWizardCommand)(Constants_1.Integration.nuxt));
|
|
71
|
+
});
|
|
72
|
+
(0, vitest_1.test)('exits with exit code 0', () => {
|
|
73
|
+
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
35
74
|
});
|
|
36
75
|
(0, vitest_1.afterAll)(() => {
|
|
37
|
-
(
|
|
38
|
-
(0, utils_1.cleanupGit)(projectDir);
|
|
76
|
+
cleanup();
|
|
39
77
|
});
|
|
40
|
-
testNuxtProjectSetup(projectDir);
|
|
41
|
-
testNuxtProjectConfigs(projectDir);
|
|
42
|
-
testNuxtProjectBuildsAndRuns(projectDir);
|
|
43
|
-
});
|
|
44
|
-
async function runWizardOnNuxtProject(projectDir) {
|
|
45
|
-
const integration = Constants_1.Integration.nuxt;
|
|
46
|
-
const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
|
|
47
|
-
const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
|
|
48
|
-
const nftOverridePrompted = packageManagerPrompted &&
|
|
49
|
-
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
50
|
-
// Selecting `yarn` as the package manager
|
|
51
|
-
[utils_2.KEYS.DOWN, utils_2.KEYS.ENTER], 'Do you want to add an override for @vercel/nft version ^0.27.4?', {
|
|
52
|
-
timeout: 240000,
|
|
53
|
-
}));
|
|
54
|
-
const deploymentPlatformPrompted = nftOverridePrompted &&
|
|
55
|
-
(await wizardInstance.sendStdinAndWaitForOutput(utils_2.KEYS.ENTER, 'Please select your deployment platform.', {
|
|
56
|
-
timeout: 240000,
|
|
57
|
-
}));
|
|
58
|
-
const tracingOptionPrompted = deploymentPlatformPrompted &&
|
|
59
|
-
(await wizardInstance.sendStdinAndWaitForOutput(utils_2.KEYS.ENTER,
|
|
60
|
-
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
61
|
-
'Do you want to enable', {
|
|
62
|
-
timeout: 240000,
|
|
63
|
-
}));
|
|
64
|
-
const replayOptionPrompted = tracingOptionPrompted &&
|
|
65
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_2.KEYS.ENTER],
|
|
66
|
-
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
67
|
-
'to get a video-like reproduction of errors during a user session?'));
|
|
68
|
-
const logOptionPrompted = replayOptionPrompted &&
|
|
69
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_2.KEYS.ENTER],
|
|
70
|
-
// "Do you want to enable Logs", sometimes doesn't work as `Logs` can be printed in bold.
|
|
71
|
-
'to send your application logs to Sentry?'));
|
|
72
|
-
const examplePagePrompted = logOptionPrompted &&
|
|
73
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_2.KEYS.ENTER], 'Do you want to create an example page', {
|
|
74
|
-
optional: true,
|
|
75
|
-
}));
|
|
76
|
-
// Handle the MCP prompt (default is now Yes, so press DOWN to select No)
|
|
77
|
-
const mcpPrompted = examplePagePrompted &&
|
|
78
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_2.KEYS.ENTER], 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?', {
|
|
79
|
-
optional: true,
|
|
80
|
-
}));
|
|
81
|
-
// Now wait for the success message
|
|
82
|
-
mcpPrompted &&
|
|
83
|
-
(await wizardInstance.sendStdinAndWaitForOutput([utils_2.KEYS.DOWN, utils_2.KEYS.ENTER], 'Successfully installed the Sentry Nuxt SDK!'));
|
|
84
|
-
wizardInstance.kill();
|
|
85
|
-
}
|
|
86
|
-
function testNuxtProjectSetup(projectDir) {
|
|
87
|
-
const integration = Constants_1.Integration.nuxt;
|
|
88
78
|
(0, vitest_1.test)('package.json is updated correctly', () => {
|
|
89
|
-
(0,
|
|
79
|
+
(0, utils_1.checkPackageJson)(projectDir, '@sentry/nuxt');
|
|
90
80
|
});
|
|
91
81
|
(0, vitest_1.test)('.env-sentry-build-plugin is created and contains the auth token', () => {
|
|
92
|
-
(0,
|
|
82
|
+
(0, utils_1.checkEnvBuildPlugin)(projectDir);
|
|
93
83
|
});
|
|
94
84
|
(0, vitest_1.test)('config files created', () => {
|
|
95
|
-
(0,
|
|
96
|
-
(0,
|
|
85
|
+
(0, utils_1.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
|
|
86
|
+
(0, utils_1.checkFileExists)(`${projectDir}/sentry.client.config.ts`);
|
|
97
87
|
});
|
|
98
88
|
(0, vitest_1.test)('example page exists', () => {
|
|
99
|
-
(0,
|
|
100
|
-
(0,
|
|
89
|
+
(0, utils_1.checkFileExists)(`${projectDir}/app/pages/sentry-example-page.vue`);
|
|
90
|
+
(0, utils_1.checkFileExists)(`${projectDir}/server/api/sentry-example-api.ts`);
|
|
101
91
|
});
|
|
102
|
-
}
|
|
103
|
-
function testNuxtProjectConfigs(projectDir) {
|
|
104
92
|
(0, vitest_1.test)('nuxt config contains sentry module', () => {
|
|
105
|
-
(0,
|
|
93
|
+
(0, utils_1.checkFileContents)(path.resolve(projectDir, 'nuxt.config.ts'), [
|
|
106
94
|
"modules: ['@sentry/nuxt/module'],",
|
|
107
95
|
'sentry: {',
|
|
108
|
-
` org: '${
|
|
109
|
-
` project: '${
|
|
96
|
+
` org: '${utils_1.TEST_ARGS.ORG_SLUG}',`,
|
|
97
|
+
` project: '${utils_1.TEST_ARGS.PROJECT_SLUG}'`,
|
|
110
98
|
'},',
|
|
111
99
|
'sourcemap: {',
|
|
112
100
|
" client: 'hidden'",
|
|
@@ -114,12 +102,12 @@ function testNuxtProjectConfigs(projectDir) {
|
|
|
114
102
|
]);
|
|
115
103
|
});
|
|
116
104
|
(0, vitest_1.test)('sentry.client.config.ts contents', () => {
|
|
117
|
-
(0,
|
|
105
|
+
(0, utils_1.checkFileContents)(path.resolve(projectDir, 'sentry.client.config.ts'), [
|
|
118
106
|
'import * as Sentry from "@sentry/nuxt";',
|
|
119
107
|
'Sentry.init({',
|
|
120
108
|
' // If set up, you can use your runtime config here',
|
|
121
109
|
' // dsn: useRuntimeConfig().public.sentry.dsn,',
|
|
122
|
-
` dsn: "${
|
|
110
|
+
` dsn: "${utils_1.TEST_ARGS.PROJECT_DSN}",`,
|
|
123
111
|
' // We recommend adjusting this value in production, or using tracesSampler',
|
|
124
112
|
' // for finer control',
|
|
125
113
|
' tracesSampleRate: 1.0,',
|
|
@@ -142,10 +130,10 @@ function testNuxtProjectConfigs(projectDir) {
|
|
|
142
130
|
]);
|
|
143
131
|
});
|
|
144
132
|
(0, vitest_1.test)('sentry.server.config.ts contents', () => {
|
|
145
|
-
(0,
|
|
133
|
+
(0, utils_1.checkFileContents)(path.resolve(projectDir, 'sentry.server.config.ts'), [
|
|
146
134
|
'import * as Sentry from "@sentry/nuxt";',
|
|
147
135
|
'Sentry.init({',
|
|
148
|
-
` dsn: "${
|
|
136
|
+
` dsn: "${utils_1.TEST_ARGS.PROJECT_DSN}",`,
|
|
149
137
|
' // We recommend adjusting this value in production, or using tracesSampler',
|
|
150
138
|
' // for finer control',
|
|
151
139
|
' tracesSampleRate: 1.0,',
|
|
@@ -159,13 +147,11 @@ function testNuxtProjectConfigs(projectDir) {
|
|
|
159
147
|
'});',
|
|
160
148
|
]);
|
|
161
149
|
});
|
|
162
|
-
}
|
|
163
|
-
function testNuxtProjectBuildsAndRuns(projectDir) {
|
|
164
150
|
(0, vitest_1.test)('builds successfully', async () => {
|
|
165
|
-
await (0,
|
|
151
|
+
await (0, utils_1.checkIfBuilds)(projectDir);
|
|
166
152
|
});
|
|
167
153
|
(0, vitest_1.test)('runs on prod mode correctly', async () => {
|
|
168
|
-
await (0,
|
|
154
|
+
await (0, utils_1.checkIfRunsOnProdMode)(projectDir, 'Listening on');
|
|
169
155
|
});
|
|
170
|
-
}
|
|
156
|
+
});
|
|
171
157
|
//# sourceMappingURL=nuxt-4.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt-4.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nuxt-4.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAA0D;AAC1D,oCAUkB;AAClB,mCAA6D;AAE7D,IAAA,iBAAQ,EAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,UAAU,GAAG,IAAI,CA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yBAAyB;YACzB,+GAA+G;YAC/G,iBAAiB;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kCAAkC,EAAE,GAAG,EAAE;QAC5C,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,yBAAyB,CAAC,EAAE;YACrE,yCAAyC;YACzC,eAAe;YACf,WAAW,iBAAS,CAAC,WAAW,IAAI;YACpC,8EAA8E;YAC9E,wBAAwB;YACxB,0BAA0B;YAC1B,uCAAuC;YACvC,qBAAqB;YACrB,uEAAuE;YACvE,oGAAoG;YACpG,yBAAyB;YACzB,+GAA+G;YAC/G,iBAAiB;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,4BAA4B,CAAC,UAAkB;IACtD,IAAA,aAAI,EAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport { cleanupGit, revertLocalChanges } from '../utils';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnProdMode,\n checkPackageJson,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\ndescribe('Nuxt-4', () => {\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nuxt-4-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnNuxtProject(projectDir);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n testNuxtProjectSetup(projectDir);\n\n testNuxtProjectConfigs(projectDir);\n\n testNuxtProjectBuildsAndRuns(projectDir);\n});\n\nasync function runWizardOnNuxtProject(projectDir: string): Promise<void> {\n const integration = Integration.nuxt;\n\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const nftOverridePrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to add an override for @vercel/nft version ^0.27.4?',\n {\n timeout: 240_000,\n },\n ));\n\n const deploymentPlatformPrompted =\n nftOverridePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n KEYS.ENTER,\n 'Please select your deployment platform.',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n deploymentPlatformPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n KEYS.ENTER,\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'Do you want to enable',\n {\n timeout: 240_000,\n },\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n const examplePagePrompted =\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n // Handle the MCP prompt (default is now Yes, so press DOWN to select No)\n const mcpPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n {\n optional: true,\n },\n ));\n\n // Now wait for the success message\n mcpPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Nuxt SDK!',\n ));\n\n wizardInstance.kill();\n}\n\nfunction testNuxtProjectSetup(projectDir: string) {\n const integration = Integration.nuxt;\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.client.config.ts`);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/app/pages/sentry-example-page.vue`);\n checkFileExists(`${projectDir}/server/api/sentry-example-api.ts`);\n });\n}\n\nfunction testNuxtProjectConfigs(projectDir: string) {\n test('nuxt config contains sentry module', () => {\n checkFileContents(path.resolve(projectDir, 'nuxt.config.ts'), [\n \"modules: ['@sentry/nuxt/module'],\",\n 'sentry: {',\n ` org: '${TEST_ARGS.ORG_SLUG}',`,\n ` project: '${TEST_ARGS.PROJECT_SLUG}'`,\n '},',\n 'sourcemap: {',\n \" client: 'hidden'\",\n '}',\n ]);\n });\n\n test('sentry.client.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.client.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ' // If set up, you can use your runtime config here',\n ' // dsn: useRuntimeConfig().public.sentry.dsn,',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\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 ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ` // Enable sending of user PII (Personally Identifiable Information)`,\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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 test('sentry.server.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.server.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ' // Enable sending of user PII (Personally Identifiable Information)',\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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\nfunction testNuxtProjectBuildsAndRuns(projectDir: string) {\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Listening on');\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nuxt-4.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nuxt-4.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAUkB;AAClB,mCAAqE;AAErE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,QAAQ,EAAE,GAAG,EAAE;IACtB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A,aAAI,EAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, test } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Nuxt-4', () => {\n let wizardExitCode: number;\n const { projectDir, cleanup } = createIsolatedTestEnv('nuxt-4-test-app');\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry Nuxt Wizard will help you set up Sentry for your application',\n )\n .whenAsked('Please select your package manager.')\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .whenAsked('Do you want to add an override for @vercel/nft')\n .respondWith(KEYS.ENTER)\n .expectOutput('Installing @sentry/nuxt')\n .expectOutput('Installed @sentry/nuxt', {\n timeout: 240_000,\n })\n .expectOutput('Created .env.sentry-build-plugin')\n .whenAsked('Please select your deployment platform')\n .respondWith(KEYS.DOWN, KEYS.DOWN, KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Added Sentry Nuxt Module to nuxt.config.ts')\n .whenAsked('Do you want to enable Tracing')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to enable Session Replay')\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to enable Logs')\n .respondWith(KEYS.ENTER)\n .expectOutput('Created new sentry.server.config.ts')\n .expectOutput('Created new sentry.client.config.ts')\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .expectOutput('Created app/pages/index.vue.')\n .expectOutput(\n 'After building your Nuxt app, you need to --import the Sentry server config file when running your app',\n )\n .whenAsked('Do you want to open the docs?')\n .respondWith(KEYS.RIGHT, KEYS.ENTER) // no\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry Nuxt SDK!')\n .run(getWizardCommand(Integration.nuxt));\n });\n\n test('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n afterAll(() => {\n cleanup();\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, '@sentry/nuxt');\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.client.config.ts`);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/app/pages/sentry-example-page.vue`);\n checkFileExists(`${projectDir}/server/api/sentry-example-api.ts`);\n });\n\n test('nuxt config contains sentry module', () => {\n checkFileContents(path.resolve(projectDir, 'nuxt.config.ts'), [\n \"modules: ['@sentry/nuxt/module'],\",\n 'sentry: {',\n ` org: '${TEST_ARGS.ORG_SLUG}',`,\n ` project: '${TEST_ARGS.PROJECT_SLUG}'`,\n '},',\n 'sourcemap: {',\n \" client: 'hidden'\",\n '}',\n ]);\n });\n\n test('sentry.client.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.client.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ' // If set up, you can use your runtime config here',\n ' // dsn: useRuntimeConfig().public.sentry.dsn,',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\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 ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ` // Enable sending of user PII (Personally Identifiable Information)`,\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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 test('sentry.server.config.ts contents', () => {\n checkFileContents(path.resolve(projectDir, 'sentry.server.config.ts'), [\n 'import * as Sentry from \"@sentry/nuxt\";',\n 'Sentry.init({',\n ` dsn: \"${TEST_ARGS.PROJECT_DSN}\",`,\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ' // Enable logs to be sent to Sentry',\n ' enableLogs: true,',\n ' // Enable sending of user PII (Personally Identifiable Information)',\n ' // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii',\n ' sendDefaultPii: true,',\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 test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Listening on');\n });\n});\n"]}
|
|
@@ -31,13 +31,11 @@ const vitest_1 = require("vitest");
|
|
|
31
31
|
//@ts-expect-error - clifty is ESM only
|
|
32
32
|
const clifty_1 = require("clifty");
|
|
33
33
|
(0, vitest_1.describe)('pnpm workspace', () => {
|
|
34
|
-
const workspaceDir = path.resolve(__dirname, '../test-applications/pnpm-workspace-test-app');
|
|
35
|
-
const projectDir = path.resolve(workspaceDir, 'packages/sveltekit');
|
|
36
34
|
const integration = Constants_1.Integration.sveltekit;
|
|
37
35
|
let wizardExitCode;
|
|
36
|
+
const { projectDir: workspaceDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('pnpm-workspace-test-app');
|
|
37
|
+
const projectDir = path.resolve(workspaceDir, 'packages/sveltekit');
|
|
38
38
|
(0, vitest_1.beforeAll)(async () => {
|
|
39
|
-
(0, utils_1.initGit)(workspaceDir);
|
|
40
|
-
(0, utils_1.revertLocalChanges)(workspaceDir);
|
|
41
39
|
wizardExitCode = await (0, clifty_1.withEnv)({
|
|
42
40
|
cwd: projectDir,
|
|
43
41
|
})
|
|
@@ -62,14 +60,13 @@ const clifty_1 = require("clifty");
|
|
|
62
60
|
.run((0, utils_1.getWizardCommand)(integration));
|
|
63
61
|
});
|
|
64
62
|
(0, vitest_1.afterAll)(() => {
|
|
65
|
-
(
|
|
66
|
-
(0, utils_1.cleanupGit)(workspaceDir);
|
|
63
|
+
cleanup();
|
|
67
64
|
});
|
|
68
65
|
(0, vitest_1.it)('exits with exit code 0', () => {
|
|
69
66
|
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
70
67
|
});
|
|
71
68
|
(0, vitest_1.it)('adds the SDK dependency to package.json', () => {
|
|
72
|
-
(0, utils_1.checkPackageJson)(projectDir,
|
|
69
|
+
(0, utils_1.checkPackageJson)(projectDir, '@sentry/sveltekit');
|
|
73
70
|
});
|
|
74
71
|
(0, vitest_1.it)('adds the .env.sentry-build-plugin', () => {
|
|
75
72
|
(0, utils_1.checkEnvBuildPlugin)(projectDir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm-workspace.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/pnpm-workspace.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAk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,GAAG,EAAE,CAAC,YAAY,CAClC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAC7C,CAAC;QACF,IAAA,eAAM,EAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BnD,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,kDAAkD;IAClD,IAAA,WAAE,EAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACnC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC1C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkEnvBuildPlugin,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n getWizardCommand,\n initGit,\n revertLocalChanges,\n TEST_ARGS,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('pnpm workspace', () => {\n const workspaceDir = path.resolve(\n __dirname,\n '../test-applications/pnpm-workspace-test-app',\n );\n const projectDir = path.resolve(workspaceDir, 'packages/sveltekit');\n\n const integration = Integration.sveltekit;\n let wizardExitCode: number;\n\n beforeAll(async () => {\n initGit(workspaceDir);\n revertLocalChanges(workspaceDir);\n\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry SvelteKit Wizard will help you set up Sentry for your application',\n )\n .step('package installation', ({ expectOutput, whenAsked }) => {\n whenAsked('Please select your package manager.').respondWith(\n KEYS.DOWN,\n KEYS.DOWN,\n KEYS.DOWN,\n KEYS.ENTER,\n );\n expectOutput('Installing @sentry/sveltekit');\n })\n .step('SDK setup', ({ whenAsked }) => {\n whenAsked('Do you want to enable Tracing', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n whenAsked('Do you want to enable Session Replay').respondWith(\n KEYS.ENTER,\n );\n whenAsked('Do you want to enable Logs').respondWith(KEYS.ENTER);\n })\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry SvelteKit SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n revertLocalChanges(workspaceDir);\n cleanupGit(workspaceDir);\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds the SDK dependency to package.json', () => {\n checkPackageJson(projectDir, integration);\n });\n\n it('adds the .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n it('adds the example page', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n });\n\n it('adds the sentry plugin to vite.config.ts', () => {\n const viteConfig = fs.readFileSync(\n path.resolve(projectDir, 'vite.config.ts'),\n );\n expect(viteConfig.toString()).toMatchInlineSnapshot(`\n \"import { sentrySvelteKit } from \"@sentry/sveltekit\";\n import { sveltekit } from '@sveltejs/kit/vite';\n import { defineConfig } from 'vite';\n\n export default defineConfig({\n \tplugins: [sentrySvelteKit({\n org: \"${TEST_ARGS.ORG_SLUG}\",\n project: \"${TEST_ARGS.PROJECT_SLUG}\"\n }), sveltekit()]\n });\"\n `);\n });\n\n it('creates the hook files', () => {\n const clientHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n );\n const serverHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n );\n\n expect(clientHooks.toString()).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n\n expect(serverHooks.toString()).toMatchInlineSnapshot(`\n \"import {sequence} from \"@sveltejs/kit/hooks\";\n import * as Sentry from \"@sentry/sveltekit\";\n export const handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {\n const response = await resolve(event);\n return response;\n });\n export const handleError = Sentry.handleErrorWithSentry();\"\n `);\n });\n\n it('creates the insturmentation.server file', () => {\n const instrumentationServer = fs.readFileSync(\n path.resolve(projectDir, 'src/instrumentation.server.ts'),\n );\n\n expect(instrumentationServer.toString()).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"\n `);\n });\n\n it('enables tracing and instrumentation in svelte.config.js', () => {\n const svelteConfig = fs.readFileSync(\n path.resolve(projectDir, 'svelte.config.js'),\n );\n expect(svelteConfig.toString()).toMatchInlineSnapshot(`\n \"import adapter from '@sveltejs/adapter-node';\n import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n /** @type {import('@sveltejs/kit').Config} */\n const config = {\n // Consult https://svelte.dev/docs/kit/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.\n // If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n // See https://svelte.dev/docs/kit/adapters for more information about adapters.\n adapter: adapter(),\n experimental: {\n remoteFunctions: true,\n\n tracing: {\n server: true,\n },\n\n instrumentation: {\n server: true,\n },\n },\n },\n };\n\n export default config;\"\n `);\n });\n\n // checkSvelteKitProject(projectDir, integration);\n it('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'ready in');\n });\n\n it('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'to expose', 'preview');\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"pnpm-workspace.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/pnpm-workspace.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,4CAA8B;AAC9B,mDAAkD;AAClD,oCAUkB;AAClB,mCAAmE;AAEnE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,WAAW,GAAG,u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AK,IAAI,EAAE;QACnC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC1C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkEnvBuildPlugin,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n TEST_ARGS,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('pnpm workspace', () => {\n const integration = Integration.sveltekit;\n let wizardExitCode: number;\n\n const { projectDir: workspaceDir, cleanup } = createIsolatedTestEnv(\n 'pnpm-workspace-test-app',\n );\n const projectDir = path.resolve(workspaceDir, 'packages/sveltekit');\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry SvelteKit Wizard will help you set up Sentry for your application',\n )\n .step('package installation', ({ expectOutput, whenAsked }) => {\n whenAsked('Please select your package manager.').respondWith(\n KEYS.DOWN,\n KEYS.DOWN,\n KEYS.DOWN,\n KEYS.ENTER,\n );\n expectOutput('Installing @sentry/sveltekit');\n })\n .step('SDK setup', ({ whenAsked }) => {\n whenAsked('Do you want to enable Tracing', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n whenAsked('Do you want to enable Session Replay').respondWith(\n KEYS.ENTER,\n );\n whenAsked('Do you want to enable Logs').respondWith(KEYS.ENTER);\n })\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry SvelteKit SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds the SDK dependency to package.json', () => {\n checkPackageJson(projectDir, '@sentry/sveltekit');\n });\n\n it('adds the .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n it('adds the example page', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n });\n\n it('adds the sentry plugin to vite.config.ts', () => {\n const viteConfig = fs.readFileSync(\n path.resolve(projectDir, 'vite.config.ts'),\n );\n expect(viteConfig.toString()).toMatchInlineSnapshot(`\n \"import { sentrySvelteKit } from \"@sentry/sveltekit\";\n import { sveltekit } from '@sveltejs/kit/vite';\n import { defineConfig } from 'vite';\n\n export default defineConfig({\n \tplugins: [sentrySvelteKit({\n org: \"${TEST_ARGS.ORG_SLUG}\",\n project: \"${TEST_ARGS.PROJECT_SLUG}\"\n }), sveltekit()]\n });\"\n `);\n });\n\n it('creates the hook files', () => {\n const clientHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n );\n const serverHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n );\n\n expect(clientHooks.toString()).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n\n expect(serverHooks.toString()).toMatchInlineSnapshot(`\n \"import {sequence} from \"@sveltejs/kit/hooks\";\n import * as Sentry from \"@sentry/sveltekit\";\n export const handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {\n const response = await resolve(event);\n return response;\n });\n export const handleError = Sentry.handleErrorWithSentry();\"\n `);\n });\n\n it('creates the insturmentation.server file', () => {\n const instrumentationServer = fs.readFileSync(\n path.resolve(projectDir, 'src/instrumentation.server.ts'),\n );\n\n expect(instrumentationServer.toString()).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"\n `);\n });\n\n it('enables tracing and instrumentation in svelte.config.js', () => {\n const svelteConfig = fs.readFileSync(\n path.resolve(projectDir, 'svelte.config.js'),\n );\n expect(svelteConfig.toString()).toMatchInlineSnapshot(`\n \"import adapter from '@sveltejs/adapter-node';\n import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n /** @type {import('@sveltejs/kit').Config} */\n const config = {\n // Consult https://svelte.dev/docs/kit/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.\n // If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n // See https://svelte.dev/docs/kit/adapters for more information about adapters.\n adapter: adapter(),\n experimental: {\n remoteFunctions: true,\n\n tracing: {\n server: true,\n },\n\n instrumentation: {\n server: true,\n },\n },\n },\n };\n\n export default config;\"\n `);\n });\n\n // checkSvelteKitProject(projectDir, integration);\n it('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'ready in');\n });\n\n it('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'to expose', 'preview');\n });\n});\n"]}
|