@sentry/wizard 6.10.0 → 6.12.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 +69 -0
- 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 +69 -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 +48 -76
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +89 -99
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-16.test.js +48 -45
- package/dist/e2e-tests/tests/nextjs-16.test.js.map +1 -1
- 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 +6 -8
- 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-instrumentation-api.test.d.ts +1 -0
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +96 -0
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -0
- package/dist/e2e-tests/tests/react-router.test.js +165 -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 +5 -7
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +15 -43
- package/dist/e2e-tests/utils/index.js +95 -185
- 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/apple/code-tools.js +17 -3
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/configure-package-manager.js +18 -5
- package/dist/src/apple/configure-package-manager.js.map +1 -1
- package/dist/src/cloudflare/cloudflare-wizard.d.ts +3 -0
- package/dist/src/cloudflare/cloudflare-wizard.js +104 -0
- package/dist/src/cloudflare/cloudflare-wizard.js.map +1 -0
- package/dist/src/cloudflare/sdk-setup.d.ts +8 -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 +5 -0
- package/dist/src/cloudflare/templates.js +50 -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 +33 -0
- package/dist/src/cloudflare/wrap-worker.js +116 -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 +0 -2
- package/dist/src/nextjs/nextjs-wizard.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/expo.d.ts +6 -0
- package/dist/src/react-native/expo.js +27 -1
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/git.d.ts +5 -0
- package/dist/src/react-native/git.js +32 -1
- package/dist/src/react-native/git.js.map +1 -1
- package/dist/src/react-native/javascript.js +3 -1
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +14 -10
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
- package/dist/src/react-router/codemods/client.entry.js +69 -12
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/codemods/react-router-config.js +1 -1
- package/dist/src/react-router/codemods/react-router-config.js.map +1 -1
- package/dist/src/react-router/codemods/root.js +1 -2
- package/dist/src/react-router/codemods/root.js.map +1 -1
- package/dist/src/react-router/codemods/server-entry.d.ts +1 -1
- package/dist/src/react-router/codemods/server-entry.js +39 -4
- package/dist/src/react-router/codemods/server-entry.js.map +1 -1
- package/dist/src/react-router/codemods/vite.js +46 -1
- package/dist/src/react-router/codemods/vite.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +55 -10
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +5 -3
- package/dist/src/react-router/sdk-setup.js +35 -9
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/react-router/templates.d.ts +2 -2
- package/dist/src/react-router/templates.js +72 -2
- package/dist/src/react-router/templates.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/vite.js +1 -1
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/vite.js +1 -1
- package/dist/src/sveltekit/sdk-setup/vite.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +2 -4
- package/dist/src/sveltekit/sveltekit-wizard.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 +11 -1
- package/dist/src/utils/ast-utils.js +19 -1
- package/dist/src/utils/ast-utils.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +2 -2
- 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/code-tools.test.js +78 -0
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/configure-package-manager.test.d.ts +1 -0
- package/dist/test/apple/configure-package-manager.test.js +161 -0
- package/dist/test/apple/configure-package-manager.test.js.map +1 -0
- 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 +170 -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 +122 -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 +206 -0
- package/dist/test/cloudflare/wrap-worker.test.js.map +1 -0
- package/dist/test/react-native/expo.test.js +140 -0
- package/dist/test/react-native/expo.test.js.map +1 -1
- package/dist/test/react-native/git.test.d.ts +1 -0
- package/dist/test/react-native/git.test.js +160 -0
- package/dist/test/react-native/git.test.js.map +1 -0
- package/dist/test/react-router/codemods/client-entry.test.js +29 -0
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/root.test.js +4 -0
- package/dist/test/react-router/codemods/root.test.js.map +1 -1
- package/dist/test/react-router/codemods/server-entry.test.js +70 -0
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/vite.test.js +89 -0
- package/dist/test/react-router/codemods/vite.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +64 -8
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/react-router/templates.test.js +50 -0
- package/dist/test/react-router/templates.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/vite.test.js +12 -8
- package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
- package/dist/test/utils/ast-utils.test.js +22 -0
- package/dist/test/utils/ast-utils.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
|
@@ -28,26 +28,30 @@ const utils_1 = require("../utils");
|
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
29
|
const utils_2 = require("../utils");
|
|
30
30
|
const vitest_1 = require("vitest");
|
|
31
|
+
//@ts-expect-error - clifty is ESM only
|
|
32
|
+
const clifty_1 = require("clifty");
|
|
31
33
|
vitest_1.describe.sequential('Angular-19', () => {
|
|
32
34
|
(0, vitest_1.describe)('with empty project', () => {
|
|
33
35
|
const integration = Constants_1.Integration.angular;
|
|
34
|
-
|
|
36
|
+
let wizardExitCode;
|
|
37
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('angular-19-test-app');
|
|
35
38
|
(0, vitest_1.beforeAll)(async () => {
|
|
36
|
-
(
|
|
37
|
-
await runWizardOnAngularProject(projectDir, integration);
|
|
39
|
+
wizardExitCode = await runWizardOnAngularProject(projectDir, integration);
|
|
38
40
|
});
|
|
39
41
|
(0, vitest_1.afterAll)(() => {
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
+
cleanup();
|
|
43
|
+
});
|
|
44
|
+
(0, vitest_1.it)('exits with exit code 0', () => {
|
|
45
|
+
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
42
46
|
});
|
|
43
47
|
checkAngularProject(projectDir, integration);
|
|
44
48
|
});
|
|
45
49
|
(0, vitest_1.describe)('with pre-defined ErrorHandler', () => {
|
|
46
50
|
const integration = Constants_1.Integration.angular;
|
|
47
|
-
|
|
51
|
+
let wizardExitCode;
|
|
52
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('angular-19-test-app');
|
|
48
53
|
(0, vitest_1.beforeAll)(async () => {
|
|
49
|
-
(
|
|
50
|
-
await runWizardOnAngularProject(projectDir, integration, (projectDir) => {
|
|
54
|
+
wizardExitCode = await runWizardOnAngularProject(projectDir, integration, (projectDir) => {
|
|
51
55
|
(0, utils_1.modifyFile)(`${projectDir}/src/app/app.config.ts`, {
|
|
52
56
|
'providers: [': `providers: [{
|
|
53
57
|
provide: ErrorHandler,
|
|
@@ -58,8 +62,10 @@ vitest_1.describe.sequential('Angular-19', () => {
|
|
|
58
62
|
});
|
|
59
63
|
});
|
|
60
64
|
(0, vitest_1.afterAll)(() => {
|
|
61
|
-
(
|
|
62
|
-
|
|
65
|
+
cleanup();
|
|
66
|
+
});
|
|
67
|
+
(0, vitest_1.it)('exits with exit code 0', () => {
|
|
68
|
+
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
63
69
|
});
|
|
64
70
|
checkAngularProject(projectDir, integration, {
|
|
65
71
|
preExistingErrorHandler: true,
|
|
@@ -67,91 +73,76 @@ vitest_1.describe.sequential('Angular-19', () => {
|
|
|
67
73
|
});
|
|
68
74
|
});
|
|
69
75
|
async function runWizardOnAngularProject(projectDir, integration, fileModificationFn) {
|
|
70
|
-
const
|
|
76
|
+
const wizardInteraction = (0, clifty_1.withEnv)({
|
|
77
|
+
cwd: projectDir,
|
|
78
|
+
}).defineInteraction();
|
|
71
79
|
if (fileModificationFn) {
|
|
72
80
|
fileModificationFn(projectDir);
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
wizardInteraction
|
|
82
|
+
.whenAsked('Do you want to continue anyway?')
|
|
83
|
+
.respondWith(clifty_1.KEYS.ENTER);
|
|
75
84
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
83
|
-
'to track the performance of your application?', {
|
|
85
|
+
return (wizardInteraction
|
|
86
|
+
.whenAsked('Please select your package manager.')
|
|
87
|
+
.respondWith(clifty_1.KEYS.ENTER) // npm is the default for Angular
|
|
88
|
+
.expectOutput('Installing @sentry/angular')
|
|
89
|
+
// Installing the sdk can take a while in CI
|
|
90
|
+
.expectOutput('Installed @sentry/angular with NPM.', {
|
|
84
91
|
timeout: 240000,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, yarn build is the production build command
|
|
125
|
-
'Are you using a CI/CD tool to build and deploy your application?');
|
|
126
|
-
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], // no CI/CD tool
|
|
127
|
-
'Do you want to create an example component to test your Sentry setup?');
|
|
128
|
-
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, create example component
|
|
129
|
-
'Did you apply the snippet above?');
|
|
130
|
-
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, applied the snippet
|
|
131
|
-
'Looks like you have Prettier in your project. Do you want to run it on your files?');
|
|
132
|
-
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, run prettier
|
|
133
|
-
'Optionally add a project-scoped MCP server configuration for the Sentry MCP?', {
|
|
134
|
-
optional: true,
|
|
135
|
-
});
|
|
136
|
-
// Handle the MCP prompt (default is now Yes, so press DOWN to select No)
|
|
137
|
-
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], // decline MCP config
|
|
138
|
-
'Successfully installed the Sentry Angular SDK!');
|
|
139
|
-
wizardInstance.kill();
|
|
92
|
+
})
|
|
93
|
+
.whenAsked('Do you want to enable Tracing')
|
|
94
|
+
.respondWith(clifty_1.KEYS.ENTER) // yes
|
|
95
|
+
.whenAsked('Do you want to enable Session Replay')
|
|
96
|
+
.respondWith(clifty_1.KEYS.ENTER) // yes
|
|
97
|
+
.whenAsked('Do you want to enable Logs')
|
|
98
|
+
.respondWith(clifty_1.KEYS.ENTER) // yes
|
|
99
|
+
.expectOutput('initialized Sentry in main.ts', {
|
|
100
|
+
timeout: 10000,
|
|
101
|
+
})
|
|
102
|
+
.expectOutput('updated your app config app.config.ts')
|
|
103
|
+
.expectOutput('Installing @sentry/cli')
|
|
104
|
+
.expectOutput('Installed @sentry/cli@', {
|
|
105
|
+
timeout: 240000, // installing Sentry CLI can take a while in CI
|
|
106
|
+
})
|
|
107
|
+
.whenAsked('Where are your build artifacts located?')
|
|
108
|
+
.respondWith(clifty_1.KEYS.ENTER) // ./dist is the default value
|
|
109
|
+
.whenAsked('We couldn\'t find build artifacts at "./dist". What would you like to do?')
|
|
110
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // Proceed anyway (this is expected)
|
|
111
|
+
.whenAsked('Do you want to automatically run the sentry:sourcemaps script after each production build?')
|
|
112
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER) // no - we can't upload in CI when testing building
|
|
113
|
+
.whenAsked('Are you using a CI/CD tool to build and deploy your application?')
|
|
114
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
115
|
+
.whenAsked('Add a step to your CI pipeline that runs the sentry:sourcemaps script right after building your application')
|
|
116
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
117
|
+
.expectOutput('Add the Sentry authentication token as an environment variable to your CI setup:')
|
|
118
|
+
.expectOutput('SENTRY_AUTH_TOKEN=')
|
|
119
|
+
.whenAsked('Did you configure CI as shown above?')
|
|
120
|
+
.respondWith(clifty_1.KEYS.ENTER) // yes
|
|
121
|
+
.whenAsked('Do you want to create an example component to test your Sentry setup?')
|
|
122
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
123
|
+
.whenAsked('Did you apply the snippet above?')
|
|
124
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
125
|
+
.whenAsked('Looks like you have Prettier in your project. Do you want to run it on your files?')
|
|
126
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
127
|
+
.whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
|
|
128
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
129
|
+
.expectOutput('Successfully installed the Sentry Angular SDK!')
|
|
130
|
+
.run((0, utils_1.getWizardCommand)(integration)));
|
|
140
131
|
}
|
|
141
132
|
function checkAngularProject(projectDir, integration, options) {
|
|
142
133
|
(0, vitest_1.test)('package.json is updated correctly', () => {
|
|
143
|
-
(0, utils_1.checkPackageJson)(projectDir,
|
|
134
|
+
(0, utils_1.checkPackageJson)(projectDir, '@sentry/angular');
|
|
144
135
|
const packageJsonFile = path.resolve(projectDir, 'package.json');
|
|
145
136
|
(0, utils_1.checkFileContents)(packageJsonFile, [
|
|
146
137
|
`"sentry:sourcemaps": "sentry-cli sourcemaps inject --org ${utils_2.TEST_ARGS.ORG_SLUG} --project ${utils_2.TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${utils_2.TEST_ARGS.ORG_SLUG} --project ${utils_2.TEST_ARGS.PROJECT_SLUG} ./dist"`,
|
|
147
|
-
`"build": "ng build
|
|
138
|
+
`"build": "ng build"`,
|
|
148
139
|
]);
|
|
149
140
|
});
|
|
150
141
|
(0, vitest_1.test)('Sentry is correctly injected into Angular app config', () => {
|
|
151
142
|
const appConfigFile = path.resolve(projectDir, 'src/main.ts');
|
|
152
143
|
(0, utils_1.checkFileExists)(appConfigFile);
|
|
153
144
|
(0, utils_1.checkFileContents)(appConfigFile, [
|
|
154
|
-
`import * as Sentry from
|
|
145
|
+
`import * as Sentry from "@sentry/angular";`,
|
|
155
146
|
'Sentry.init({',
|
|
156
147
|
utils_2.TEST_ARGS.PROJECT_DSN,
|
|
157
148
|
'Sentry.browserTracingIntegration()',
|
|
@@ -172,7 +163,7 @@ function checkAngularProject(projectDir, integration, options) {
|
|
|
172
163
|
(0, utils_1.checkFileDoesNotContain)(appModuleFile, 'Sentry.createErrorHandler()');
|
|
173
164
|
}
|
|
174
165
|
(0, utils_1.checkFileContents)(appModuleFile, [
|
|
175
|
-
`import * as Sentry from
|
|
166
|
+
`import * as Sentry from "@sentry/angular";`,
|
|
176
167
|
options?.preExistingErrorHandler
|
|
177
168
|
? `provide: ErrorHandler,
|
|
178
169
|
useValue: null`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-19.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/angular-19.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAkD;AAClD,oCAakB;AAClB,2CAA6B;AAC7B,oCAAqC;AACrC,mCAAqE;AAErE,iBAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,GAAG,EAAE;IACrC,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,0CAA0C,CAC3C,CAAC;QAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,MAAM,yBAAyB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAA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,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACjE,IAAA,uBAAe,EAAC,eAAe,CAAC,CAAC;QAEjC,8DAA8D;QAC9D,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,CAAwB,CAAC;QAE3E,8DAA8D;QAC9D,KAAK,MAAM,CAAC,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO;QACtC,8DAA8D;QAC9D,WAAW,CAAC,QAA+B,CAC5C,EAAE;YACD,IAAA,eAAM;YACJ,sEAAsE;YACtE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,CACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACd;IACH,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,EACzB,UAAU,EACV,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EACxB,UAAU,EACV,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Integration } from '../../lib/Constants';\nimport {\n checkFileContents,\n checkFileDoesNotContain,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n KEYS,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport * as path from 'path';\nimport { TEST_ARGS } from '../utils';\nimport { test, expect, describe, beforeAll, afterAll } from 'vitest';\n\ndescribe.sequential('Angular-19', () => {\n describe('with empty project', () => {\n const integration = Integration.angular;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/angular-19-test-app',\n );\n\n beforeAll(async () => {\n revertLocalChanges(projectDir);\n await runWizardOnAngularProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkAngularProject(projectDir, integration);\n });\n describe('with pre-defined ErrorHandler', () => {\n const integration = Integration.angular;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/angular-19-test-app',\n );\n\n beforeAll(async () => {\n revertLocalChanges(projectDir);\n await runWizardOnAngularProject(projectDir, integration, (projectDir) => {\n modifyFile(`${projectDir}/src/app/app.config.ts`, {\n 'providers: [': `providers: [{\n provide: ErrorHandler,\n useValue: null\n },\n `,\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkAngularProject(projectDir, integration, {\n preExistingErrorHandler: true,\n });\n });\n});\n\nasync function runWizardOnAngularProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (projectDir: string) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir, true);\n\n if (fileModificationFn) {\n fileModificationFn(projectDir);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n await wizardInstance.waitForOutput('Please select your package manager.');\n }\n\n await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000,\n optional: true,\n },\n );\n\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 await wizardInstance.sendStdinAndWaitForOutput(\n // select \"Yes\" for replay\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 await wizardInstance.sendStdinAndWaitForOutput(\n // select \"Yes\" for logs\n [KEYS.ENTER],\n 'Where are your build artifacts located?',\n {\n optional: true,\n timeout: 5000,\n },\n );\n\n const sourcemapsConfiguredPromise = wizardInstance.waitForOutput(\n 'Added a sentry:sourcemaps script to your package.json',\n );\n\n const buildScriptPromptedPromise = wizardInstance.waitForOutput(\n 'Do you want to automatically run the sentry:sourcemaps script after each production build?',\n );\n\n const optionalArtifactsNotFoundPromise = wizardInstance.waitForOutput(\n \"We couldn't find build artifacts at\",\n {\n optional: true,\n timeout: 5000,\n },\n );\n\n // ./dist is the default value, no need to change it\n wizardInstance.sendStdin(KEYS.ENTER);\n\n const optionalArtifactsNotFoundPrompted =\n await optionalArtifactsNotFoundPromise;\n\n if (optionalArtifactsNotFoundPrompted) {\n // The wizard now presents options when artifacts aren't found:\n // - \"Let the wizard run the build command\"\n // - \"Enter a different path manually\"\n // - \"Proceed anyway — I believe the path is correct\"\n // We want to select \"Proceed anyway\" (third option)\n wizardInstance.sendStdin(KEYS.DOWN);\n wizardInstance.sendStdin(KEYS.DOWN);\n wizardInstance.sendStdin(KEYS.ENTER);\n }\n\n await sourcemapsConfiguredPromise;\n await buildScriptPromptedPromise;\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, automatically add sentry:sourcemaps script\n 'Is yarn build your production build command?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, yarn build is the production build command\n 'Are you using a CI/CD tool to build and deploy your application?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER], // no CI/CD tool\n 'Do you want to create an example component to test your Sentry setup?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, create example component\n 'Did you apply the snippet above?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, applied the snippet\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, run prettier\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n {\n optional: true,\n },\n );\n\n // Handle the MCP prompt (default is now Yes, so press DOWN to select No)\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER], // decline MCP config\n 'Successfully installed the Sentry Angular SDK!',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkAngularProject(\n projectDir: string,\n integration: Integration,\n options?: {\n preExistingErrorHandler?: boolean;\n },\n) {\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n\n const packageJsonFile = path.resolve(projectDir, 'package.json');\n checkFileContents(packageJsonFile, [\n `\"sentry:sourcemaps\": \"sentry-cli sourcemaps inject --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist\"`,\n `\"build\": \"ng build && yarn sentry:sourcemaps\"`,\n ]);\n });\n\n test('Sentry is correctly injected into Angular app config', () => {\n const appConfigFile = path.resolve(projectDir, 'src/main.ts');\n checkFileExists(appConfigFile);\n\n checkFileContents(appConfigFile, [\n `import * as Sentry from '@sentry/angular'`,\n 'Sentry.init({',\n TEST_ARGS.PROJECT_DSN,\n 'Sentry.browserTracingIntegration()',\n 'Sentry.replayIntegration()',\n 'tracesSampleRate: 1',\n 'replaysSessionSampleRate: 0.1',\n 'replaysOnErrorSampleRate: 1',\n 'enableLogs: true',\n 'sendDefaultPii: true',\n ]);\n });\n\n test('Sentry is correctly injected into Angular app module', () => {\n const appModuleFile = path.resolve(projectDir, 'src/app/app.config.ts');\n checkFileExists(appModuleFile);\n\n // Checking if the ErrorHandler is already present in the providers array,\n // and if it is, we skip adding it\n if (options?.preExistingErrorHandler) {\n checkFileDoesNotContain(appModuleFile, 'Sentry.createErrorHandler()');\n }\n\n checkFileContents(appModuleFile, [\n `import * as Sentry from '@sentry/angular'`,\n options?.preExistingErrorHandler\n ? `provide: ErrorHandler,\n useValue: null`\n : `provide: ErrorHandler,\n useValue: Sentry.createErrorHandler()`,\n `provide: Sentry.TraceService,\n deps: [Router]`,\n `provideAppInitializer(() => {\n inject(Sentry.TraceService);\n })`,\n ]);\n });\n\n test('angular.json is updated correctly', async () => {\n const angularJsonFile = path.resolve(projectDir, 'angular.json');\n checkFileExists(angularJsonFile);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const angularJson = (await import(angularJsonFile)) as Record<string, any>;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const [, project] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n angularJson.projects as Record<string, any>,\n )) {\n expect(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n project?.architect?.build?.configurations?.production?.sourceMap,\n ).toBe(true);\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(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"angular-19.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/angular-19.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAkD;AAClD,oCAWkB;AAClB,2CAA6B;AAC7B,oCAAqC;AACrC,mC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ants';\nimport {\n checkFileContents,\n checkFileDoesNotContain,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n modifyFile,\n} from '../utils';\nimport * as path from 'path';\nimport { TEST_ARGS } from '../utils';\nimport { test, expect, describe, beforeAll, afterAll, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe.sequential('Angular-19', () => {\n describe('with empty project', () => {\n const integration = Integration.angular;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'angular-19-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await runWizardOnAngularProject(projectDir, integration);\n });\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n checkAngularProject(projectDir, integration);\n });\n\n describe('with pre-defined ErrorHandler', () => {\n const integration = Integration.angular;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'angular-19-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await runWizardOnAngularProject(\n projectDir,\n integration,\n (projectDir) => {\n modifyFile(`${projectDir}/src/app/app.config.ts`, {\n 'providers: [': `providers: [{\n provide: ErrorHandler,\n useValue: null\n },\n `,\n });\n },\n );\n });\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n checkAngularProject(projectDir, integration, {\n preExistingErrorHandler: true,\n });\n });\n});\n\nasync function runWizardOnAngularProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (projectDir: string) => unknown,\n): Promise<number> {\n const wizardInteraction = withEnv({\n cwd: projectDir,\n }).defineInteraction();\n\n if (fileModificationFn) {\n fileModificationFn(projectDir);\n\n wizardInteraction\n .whenAsked('Do you want to continue anyway?')\n .respondWith(KEYS.ENTER);\n }\n return (\n wizardInteraction\n .whenAsked('Please select your package manager.')\n .respondWith(KEYS.ENTER) // npm is the default for Angular\n .expectOutput('Installing @sentry/angular')\n // Installing the sdk can take a while in CI\n .expectOutput('Installed @sentry/angular with NPM.', {\n timeout: 240_000,\n })\n .whenAsked('Do you want to enable Tracing')\n .respondWith(KEYS.ENTER) // yes\n .whenAsked('Do you want to enable Session Replay')\n .respondWith(KEYS.ENTER) // yes\n .whenAsked('Do you want to enable Logs')\n .respondWith(KEYS.ENTER) // yes\n .expectOutput('initialized Sentry in main.ts', {\n timeout: 10_000,\n })\n .expectOutput('updated your app config app.config.ts')\n .expectOutput('Installing @sentry/cli')\n .expectOutput('Installed @sentry/cli@', {\n timeout: 240_000, // installing Sentry CLI can take a while in CI\n })\n .whenAsked('Where are your build artifacts located?')\n .respondWith(KEYS.ENTER) // ./dist is the default value\n .whenAsked(\n 'We couldn\\'t find build artifacts at \"./dist\". What would you like to do?',\n )\n .respondWith(KEYS.DOWN, KEYS.DOWN, KEYS.ENTER) // Proceed anyway (this is expected)\n .whenAsked(\n 'Do you want to automatically run the sentry:sourcemaps script after each production build?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER) // no - we can't upload in CI when testing building\n .whenAsked(\n 'Are you using a CI/CD tool to build and deploy your application?',\n )\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Add a step to your CI pipeline that runs the sentry:sourcemaps script right after building your application',\n )\n .respondWith(KEYS.ENTER)\n .expectOutput(\n 'Add the Sentry authentication token as an environment variable to your CI setup:',\n )\n .expectOutput('SENTRY_AUTH_TOKEN=')\n .whenAsked('Did you configure CI as shown above?')\n .respondWith(KEYS.ENTER) // yes\n .whenAsked(\n 'Do you want to create an example component to test your Sentry setup?',\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('Did you apply the snippet above?')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n )\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 Angular SDK!')\n .run(getWizardCommand(integration))\n );\n}\n\nfunction checkAngularProject(\n projectDir: string,\n integration: Integration,\n options?: {\n preExistingErrorHandler?: boolean;\n },\n) {\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, '@sentry/angular');\n\n const packageJsonFile = path.resolve(projectDir, 'package.json');\n checkFileContents(packageJsonFile, [\n `\"sentry:sourcemaps\": \"sentry-cli sourcemaps inject --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist\"`,\n `\"build\": \"ng build\"`,\n ]);\n });\n\n test('Sentry is correctly injected into Angular app config', () => {\n const appConfigFile = path.resolve(projectDir, 'src/main.ts');\n checkFileExists(appConfigFile);\n\n checkFileContents(appConfigFile, [\n `import * as Sentry from \"@sentry/angular\";`,\n 'Sentry.init({',\n TEST_ARGS.PROJECT_DSN,\n 'Sentry.browserTracingIntegration()',\n 'Sentry.replayIntegration()',\n 'tracesSampleRate: 1',\n 'replaysSessionSampleRate: 0.1',\n 'replaysOnErrorSampleRate: 1',\n 'enableLogs: true',\n 'sendDefaultPii: true',\n ]);\n });\n\n test('Sentry is correctly injected into Angular app module', () => {\n const appModuleFile = path.resolve(projectDir, 'src/app/app.config.ts');\n checkFileExists(appModuleFile);\n\n // Checking if the ErrorHandler is already present in the providers array,\n // and if it is, we skip adding it\n if (options?.preExistingErrorHandler) {\n checkFileDoesNotContain(appModuleFile, 'Sentry.createErrorHandler()');\n }\n\n checkFileContents(appModuleFile, [\n `import * as Sentry from \"@sentry/angular\";`,\n options?.preExistingErrorHandler\n ? `provide: ErrorHandler,\n useValue: null`\n : `provide: ErrorHandler,\n useValue: Sentry.createErrorHandler()`,\n `provide: Sentry.TraceService,\n deps: [Router]`,\n `provideAppInitializer(() => {\n inject(Sentry.TraceService);\n })`,\n ]);\n });\n\n test('angular.json is updated correctly', async () => {\n const angularJsonFile = path.resolve(projectDir, 'angular.json');\n checkFileExists(angularJsonFile);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const angularJson = (await import(angularJsonFile)) as Record<string, any>;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const [, project] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n angularJson.projects as Record<string, any>,\n )) {\n expect(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n project?.architect?.build?.configurations?.production?.sourceMap,\n ).toBe(true);\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(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const Constants_1 = require("../../lib/Constants");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
//@ts-expect-error - clifty is ESM only
|
|
7
|
+
const clifty_1 = require("clifty");
|
|
8
|
+
(0, vitest_1.describe)('cloudflare-worker', () => {
|
|
9
|
+
const integration = Constants_1.Integration.cloudflare;
|
|
10
|
+
let wizardExitCode;
|
|
11
|
+
let expectedCompatibilityDate;
|
|
12
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('cloudflare-test-app');
|
|
13
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
14
|
+
// Capture the date before running the wizard (wizard runs in subprocess)
|
|
15
|
+
expectedCompatibilityDate = new Date().toISOString().slice(0, 10);
|
|
16
|
+
wizardExitCode = await (0, clifty_1.withEnv)({
|
|
17
|
+
cwd: projectDir,
|
|
18
|
+
})
|
|
19
|
+
.defineInteraction()
|
|
20
|
+
.expectOutput('The Sentry Cloudflare Wizard will help you set up Sentry for your application')
|
|
21
|
+
.step('package installation', ({ expectOutput, whenAsked }) => {
|
|
22
|
+
whenAsked('Please select your package manager.').respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER);
|
|
23
|
+
expectOutput('Installing @sentry/cloudflare');
|
|
24
|
+
})
|
|
25
|
+
.step('SDK setup', ({ whenAsked }) => {
|
|
26
|
+
whenAsked('Do you want to enable Tracing', {
|
|
27
|
+
timeout: 90000, // package installation can take a while in CI
|
|
28
|
+
}).respondWith(clifty_1.KEYS.ENTER);
|
|
29
|
+
whenAsked('Do you want to enable Logs', {
|
|
30
|
+
timeout: 90000, // package installation can take a while in CI
|
|
31
|
+
}).respondWith(clifty_1.KEYS.ENTER);
|
|
32
|
+
})
|
|
33
|
+
.whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
|
|
34
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
35
|
+
.expectOutput('Sentry has been successfully configured for your Cloudflare project.')
|
|
36
|
+
.run((0, utils_1.getWizardCommand)(integration));
|
|
37
|
+
});
|
|
38
|
+
(0, vitest_1.afterAll)(() => {
|
|
39
|
+
cleanup();
|
|
40
|
+
});
|
|
41
|
+
(0, vitest_1.it)('exits with exit code 0', () => {
|
|
42
|
+
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
43
|
+
});
|
|
44
|
+
(0, vitest_1.it)('adds the SDK dependency to package.json', () => {
|
|
45
|
+
(0, utils_1.checkPackageJson)(projectDir, '@sentry/cloudflare');
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.it)('builds correctly', async () => {
|
|
48
|
+
await (0, utils_1.checkIfBuilds)(projectDir);
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.it)('wrangler.jsonc file contains Sentry configuration', () => {
|
|
51
|
+
(0, utils_1.checkFileContents)(`${projectDir}/wrangler.jsonc`, [
|
|
52
|
+
`"compatibility_date": "${expectedCompatibilityDate}"`,
|
|
53
|
+
'"global_fetch_strictly_public"',
|
|
54
|
+
'"nodejs_als"',
|
|
55
|
+
'"version_metadata": {',
|
|
56
|
+
'"binding": "CF_VERSION_METADATA"',
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
(0, vitest_1.it)('modifies the worker file to include Sentry initialization', () => {
|
|
60
|
+
(0, utils_1.checkFileContents)(`${projectDir}/src/index.ts`, [
|
|
61
|
+
'import * as Sentry from "@sentry/cloudflare";',
|
|
62
|
+
'export default Sentry.withSentry(env => ({',
|
|
63
|
+
'dsn: "https://public@dsn.ingest.sentry.io/1337",',
|
|
64
|
+
'tracesSampleRate: 1',
|
|
65
|
+
'enableLogs: true',
|
|
66
|
+
]);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=cloudflare-worker.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare-worker.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/cloudflare-worker.test.ts"],"names":[],"mappings":";;AAAA,mCAAmE;AACnE,mDAAkD;AAClD,oCAMkB;AAElB,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,uBAAW,CAAC,UAAU,CAAC;IAC3C,IAAI,cAAsB,CAAC;IAC3B,IAAI,yBAAiC,CAAC;IAEtC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EAAC,qBAAqB,CAAC,CAAC;IAE7E,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,yEAAyE;QACzE,yBAAyB,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,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,WAAE,EAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,IAAA,wBAAgB,EAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAChC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,IAAA,yBAAiB,EAAC,GAAG,UAAU,iBAAiB,EAAE;YAChD,0BAA0B,yBAAyB,GAAG;YACtD,gCAAgC;YAChC,cAAc;YACd,uBAAuB;YACvB,kCAAkC;SACnC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,IAAA,yBAAiB,EAAC,GAAG,UAAU,eAAe,EAAE;YAC9C,+CAA+C;YAC/C,4CAA4C;YAC5C,kDAAkD;YAClD,qBAAqB;YACrB,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { afterAll, beforeAll, describe, expect, it } from 'vitest';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkFileContents,\n checkIfBuilds,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n} from '../utils';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('cloudflare-worker', () => {\n const integration = Integration.cloudflare;\n let wizardExitCode: number;\n let expectedCompatibilityDate: string;\n\n const { projectDir, cleanup } = createIsolatedTestEnv('cloudflare-test-app');\n\n beforeAll(async () => {\n // Capture the date before running the wizard (wizard runs in subprocess)\n expectedCompatibilityDate = new Date().toISOString().slice(0, 10);\n\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry Cloudflare 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.ENTER,\n );\n expectOutput('Installing @sentry/cloudflare');\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 Logs', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n })\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput(\n 'Sentry has been successfully configured for your Cloudflare project.',\n )\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/cloudflare');\n });\n\n it('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('wrangler.jsonc file contains Sentry configuration', () => {\n checkFileContents(`${projectDir}/wrangler.jsonc`, [\n `\"compatibility_date\": \"${expectedCompatibilityDate}\"`,\n '\"global_fetch_strictly_public\"',\n '\"nodejs_als\"',\n '\"version_metadata\": {',\n '\"binding\": \"CF_VERSION_METADATA\"',\n ]);\n });\n\n it('modifies the worker file to include Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/index.ts`, [\n 'import * as Sentry from \"@sentry/cloudflare\";',\n 'export default Sentry.withSentry(env => ({',\n 'dsn: \"https://public@dsn.ingest.sentry.io/1337\",',\n 'tracesSampleRate: 1',\n 'enableLogs: true',\n ]);\n });\n});\n"]}
|
|
@@ -34,11 +34,9 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
34
34
|
//@ts-expect-error - clifty is ESM only
|
|
35
35
|
const clifty_1 = require("clifty");
|
|
36
36
|
(0, vitest_1.describe)('Cloudflare-Wrangler-Sourcemaps-Wizard', () => {
|
|
37
|
-
const projectDir = path.resolve(__dirname, '../test-applications/cloudflare-wrangler-sourcemaps-test-app');
|
|
38
37
|
let wizardExitCode;
|
|
38
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('cloudflare-wrangler-sourcemaps-test-app');
|
|
39
39
|
(0, vitest_1.beforeAll)(async () => {
|
|
40
|
-
(0, utils_1.initGit)(projectDir);
|
|
41
|
-
(0, utils_1.revertLocalChanges)(projectDir);
|
|
42
40
|
wizardExitCode = await (0, clifty_1.withEnv)({ cwd: projectDir })
|
|
43
41
|
.defineInteraction()
|
|
44
42
|
.step('intro', ({ expectOutput }) => {
|
|
@@ -68,8 +66,7 @@ const clifty_1 = require("clifty");
|
|
|
68
66
|
.run((0, utils_1.getWizardCommand)(Constants_1.Integration.sourcemaps));
|
|
69
67
|
}, 60000);
|
|
70
68
|
(0, vitest_1.afterAll)(() => {
|
|
71
|
-
(
|
|
72
|
-
(0, utils_1.cleanupGit)(projectDir);
|
|
69
|
+
cleanup();
|
|
73
70
|
});
|
|
74
71
|
(0, vitest_1.it)('exits with exit code 0', () => {
|
|
75
72
|
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare-wrangler-sourcemaps.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"cloudflare-wrangler-sourcemaps.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAmE;AACnE,oCAKkB;AAClB,mDAAkD;AAClD,2CAA6B;AAC7B,4CAAoB;AACpB,uCAAuC;AACvC,mCAAuC;AAGvC,IAAA,iBAAQ,EAAC,uC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AA,WAAE,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC7C,CAAC;QAEpB,IAAA,eAAM,EAAC,OAAO,EAAE,eAAe,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,IAAA,wBAAgB,EAAC,UAAU,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { afterAll, beforeAll, describe, expect, it } from 'vitest';\nimport {\n checkSentryCliRc,\n createIsolatedTestEnv,\n getWizardCommand,\n TEST_ARGS,\n} from '../utils';\nimport { Integration } from '../../lib/Constants';\nimport * as path from 'path';\nimport fs from 'fs';\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\nimport { PackageDotJson } from '../../src/utils/package-json';\n\ndescribe('Cloudflare-Wrangler-Sourcemaps-Wizard', () => {\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'cloudflare-wrangler-sourcemaps-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({ cwd: projectDir })\n .defineInteraction()\n .step('intro', ({ expectOutput }) => {\n expectOutput('This wizard will help you upload source maps to Sentry');\n })\n .step('select wrangler', ({ expectOutput, whenAsked }) => {\n whenAsked(\n 'Which framework, bundler or build tool are you using?',\n ).respondWith(KEYS.ENTER);\n\n expectOutput('Before we get started');\n expectOutput('We recommend using Vite to build your worker instead');\n whenAsked('want to proceed with the Wrangler setup').respondWith(\n KEYS.ENTER,\n );\n })\n .step('configure source maps upload', ({ expectOutput, whenAsked }) => {\n expectOutput('Installing @sentry/cli');\n whenAsked('Is yarn deploy your build and deploy command?', {\n timeout: 60_000, // give CI some time to install @sentry/cli\n }).respondWith(KEYS.ENTER);\n expectOutput('Added a sentry:sourcemaps script to your package.json');\n expectOutput('Added a postdeploy script to your package.json');\n expectOutput(\n 'Modified your deploy script to enable uploading source maps',\n );\n expectOutput(\n 'Added auth token to .sentryclirc for you to test uploading source maps locally',\n );\n expectOutput('Created .sentryclirc');\n })\n .step('add auth token to CI/CD (skipped)', ({ whenAsked }) => {\n whenAsked(\n 'Are you using a CI/CD tool to build and deploy your application?',\n ).respondWith(KEYS.DOWN, KEYS.ENTER); // no\n })\n .expectOutput(\"That's it\")\n .run(getWizardCommand(Integration.sourcemaps));\n }, 60_000);\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds and adjusts the respective package.json scripts', () => {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(projectDir, 'package.json'), 'utf8'),\n ) as PackageDotJson;\n\n expect(pkgJson?.scripts?.['sentry:sourcemaps']).toEqual(\n `_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=${TEST_ARGS.ORG_SLUG} --project=${TEST_ARGS.PROJECT_SLUG} && sentry-cli sourcemaps upload --org=${TEST_ARGS.ORG_SLUG} --project=${TEST_ARGS.PROJECT_SLUG} --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist`,\n );\n expect(pkgJson?.scripts?.['postdeploy']).toEqual('yarn sentry:sourcemaps');\n expect(pkgJson?.scripts?.['deploy']).toEqual(\n 'wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it('adds sentry-cli as a devDependency', () => {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(projectDir, 'package.json'), 'utf8'),\n ) as PackageDotJson;\n\n expect(pkgJson?.devDependencies?.['@sentry/cli']).toBeDefined();\n });\n\n it('adds a .sentryclirc file', () => {\n checkSentryCliRc(projectDir);\n });\n});\n"]}
|
|
@@ -1,73 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const path = __importStar(require("node:path"));
|
|
27
3
|
const Constants_1 = require("../../lib/Constants");
|
|
28
4
|
const utils_1 = require("../utils");
|
|
29
5
|
const vitest_1 = require("vitest");
|
|
6
|
+
//@ts-expect-error - clifty is ESM only
|
|
7
|
+
const clifty_1 = require("clifty");
|
|
30
8
|
(0, vitest_1.describe)('Expo', () => {
|
|
31
|
-
|
|
32
|
-
const projectDir =
|
|
9
|
+
let wizardExitCode;
|
|
10
|
+
const { projectDir, cleanup } = (0, utils_1.createIsolatedTestEnv)('react-native-expo-test-app');
|
|
33
11
|
(0, vitest_1.beforeAll)(async () => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
testEventPrompted &&
|
|
63
|
-
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
64
|
-
// Respond that test event was sent
|
|
65
|
-
[utils_1.KEYS.ENTER], 'Everything is set up!'));
|
|
66
|
-
wizardInstance.kill();
|
|
12
|
+
wizardExitCode = await (0, clifty_1.withEnv)({
|
|
13
|
+
cwd: projectDir,
|
|
14
|
+
})
|
|
15
|
+
.defineInteraction()
|
|
16
|
+
.whenAsked('Please select your package manager.')
|
|
17
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
18
|
+
.expectOutput('Installing @sentry/react-native')
|
|
19
|
+
.expectOutput('Installed @sentry/react-native', {
|
|
20
|
+
timeout: 240000,
|
|
21
|
+
})
|
|
22
|
+
.whenAsked('Do you want to enable Session Replay')
|
|
23
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
24
|
+
.whenAsked('Do you want to enable the Feedback Widget to collect feedback from your users?')
|
|
25
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
26
|
+
.whenAsked('Do you want to enable Logs')
|
|
27
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
28
|
+
.expectOutput('Added Sentry.init to app/_layout.tsx')
|
|
29
|
+
.expectOutput('Added Sentry Expo plugin to app.config.json')
|
|
30
|
+
.expectOutput('Added .env.local to .gitignore')
|
|
31
|
+
.expectOutput('Written .env.local')
|
|
32
|
+
.expectOutput('Created metro.config.js with Sentry configuration')
|
|
33
|
+
.whenAsked('Optionally add a project-scoped MCP server configuration for the Sentry MCP?')
|
|
34
|
+
.respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER)
|
|
35
|
+
.expectOutput('To make sure everything is set up correctly, put the following code snippet into your application.')
|
|
36
|
+
.whenAsked('Have you successfully sent a test event?')
|
|
37
|
+
.respondWith(clifty_1.KEYS.ENTER)
|
|
38
|
+
.expectOutput('Everything is set up!')
|
|
39
|
+
.run((0, utils_1.getWizardCommand)(Constants_1.Integration.reactNative));
|
|
67
40
|
});
|
|
68
41
|
(0, vitest_1.afterAll)(() => {
|
|
69
|
-
(
|
|
70
|
-
|
|
42
|
+
cleanup();
|
|
43
|
+
});
|
|
44
|
+
(0, vitest_1.test)('exits with exit code 0', () => {
|
|
45
|
+
(0, vitest_1.expect)(wizardExitCode).toBe(0);
|
|
71
46
|
});
|
|
72
47
|
(0, vitest_1.test)('package.json is updated correctly', () => {
|
|
73
48
|
(0, utils_1.checkFileContents)(`${projectDir}/package.json`, `@sentry/react-native`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expo.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/expo.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expo.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/expo.test.ts"],"names":[],"mappings":";;AAAA,mDAAkD;AAClD,oCAOkB;AAClB,mCAAqE;AAErE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE;IACpB,IAAI,cAAsB,CAAC;IAC3B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EACnD,4BAA4B,CAC7B,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAA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kC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAkB,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAkB,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { Integration } from '../../lib/Constants';\nimport {\n TEST_ARGS,\n checkFileContents,\n checkFileExists,\n checkIfExpoBundles,\n createIsolatedTestEnv,\n getWizardCommand,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test, expect } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Expo', () => {\n let wizardExitCode: number;\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'react-native-expo-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n\n .whenAsked('Please select your package manager.')\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Installing @sentry/react-native')\n .expectOutput('Installed @sentry/react-native', {\n timeout: 240_000,\n })\n\n .whenAsked('Do you want to enable Session Replay')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Do you want to enable the Feedback Widget to collect feedback from your users?',\n )\n .respondWith(KEYS.ENTER)\n .whenAsked('Do you want to enable Logs')\n .respondWith(KEYS.ENTER)\n .expectOutput('Added Sentry.init to app/_layout.tsx')\n .expectOutput('Added Sentry Expo plugin to app.config.json')\n .expectOutput('Added .env.local to .gitignore')\n .expectOutput('Written .env.local')\n .expectOutput('Created metro.config.js with Sentry configuration')\n\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n\n .expectOutput(\n 'To make sure everything is set up correctly, put the following code snippet into your application.',\n )\n .whenAsked('Have you successfully sent a test event?')\n .respondWith(KEYS.ENTER)\n .expectOutput('Everything is set up!')\n\n .run(getWizardCommand(Integration.reactNative));\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 checkFileContents(`${projectDir}/package.json`, `@sentry/react-native`);\n });\n\n test('_layout.tsx is updated correctly', () => {\n checkFileContents(\n `${projectDir}/app/_layout.tsx`,\n `import * as Sentry from '@sentry/react-native';\n\nSentry.init({\n dsn: 'https://public@dsn.ingest.sentry.io/1337',\n\n // Adds more context data to events (IP address, cookies, user, etc.)\n // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/\n sendDefaultPii: true,\n\n // Enable Logs\n enableLogs: true,\n\n // Configure Session Replay\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: __DEV__,\n});`,\n );\n checkFileContents(\n `${projectDir}/app/_layout.tsx`,\n `export default Sentry.wrap(function RootLayout() {`,\n );\n });\n\n test('app.json is updated correctly', () => {\n checkFileContents(\n `${projectDir}/app.json`,\n `\"@sentry/react-native/expo\",\n {\n \"url\": \"https://sentry.io/\",\n \"project\": \"${TEST_ARGS.PROJECT_SLUG}\",\n \"organization\": \"${TEST_ARGS.ORG_SLUG}\"\n }`,\n );\n });\n\n test('metro.config.js is added', () => {\n checkFileExists(`${projectDir}/metro.config.js`);\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `const { getSentryExpoConfig } = require(\"@sentry/react-native/metro\");\n\nconst config = getSentryExpoConfig(__dirname);\n\nmodule.exports = config;`,\n );\n });\n\n test('.gitignore is updated correctly', () => {\n checkFileContents(`${projectDir}/.gitignore`, `.env.local`);\n });\n\n test('android project is bundled correctly', async () => {\n const bundled = await checkIfExpoBundles(projectDir, 'android');\n expect(bundled).toBe(true);\n });\n\n test('ios project is bundled correctly', async () => {\n const bundled = await checkIfExpoBundles(projectDir, 'ios');\n expect(bundled).toBe(true);\n });\n\n test('web project is bundled correctly', async () => {\n const bundled = await checkIfExpoBundles(projectDir, 'web');\n expect(bundled).toBe(true);\n });\n});\n"]}
|