@sentry/wizard 3.34.1 → 3.34.3
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 +9 -0
- package/dist/e2e-tests/jest.config.d.ts +1 -0
- package/dist/e2e-tests/jest.config.js +5 -0
- package/dist/e2e-tests/jest.config.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs.test.d.ts +1 -0
- package/dist/e2e-tests/tests/nextjs.test.js +221 -0
- package/dist/e2e-tests/tests/nextjs.test.js.map +1 -0
- package/dist/e2e-tests/tests/remix.test.js +47 -43
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.d.ts +1 -0
- package/dist/e2e-tests/tests/sveltekit.test.js +186 -0
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -0
- package/dist/e2e-tests/utils/index.d.ts +13 -2
- package/dist/e2e-tests/utils/index.js +45 -13
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/package.json +3 -5
- package/dist/src/apple/templates.d.ts +1 -1
- package/dist/src/apple/templates.js +6 -2
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.js +2 -1
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +101 -73
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +1 -0
- package/dist/src/nextjs/templates.js +5 -1
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +3 -1
- package/dist/src/utils/clack-utils.js +2 -2
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/e2e-tests/.env.example +11 -0
- package/e2e-tests/jest.config.ts +8 -1
- package/e2e-tests/package.json +14 -0
- package/e2e-tests/run.sh +15 -0
- package/e2e-tests/test-applications/nextjs-test-app/next.config.mjs +4 -0
- package/e2e-tests/test-applications/nextjs-test-app/package.json +22 -0
- package/e2e-tests/test-applications/nextjs-test-app/src/app/layout.tsx +20 -0
- package/e2e-tests/test-applications/nextjs-test-app/src/app/page.tsx +90 -0
- package/e2e-tests/test-applications/sveltekit-test-app/package.json +21 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.d.ts +13 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.html +11 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/lib/index.ts +1 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/routes/+page.svelte +2 -0
- package/e2e-tests/test-applications/sveltekit-test-app/svelte.config.js +18 -0
- package/e2e-tests/test-applications/sveltekit-test-app/vite.config.ts +6 -0
- package/e2e-tests/tests/nextjs.test.ts +161 -0
- package/e2e-tests/tests/remix.test.ts +35 -44
- package/e2e-tests/tests/sveltekit.test.ts +154 -0
- package/e2e-tests/utils/index.ts +54 -11
- package/package.json +3 -5
- package/src/apple/templates.ts +5 -1
- package/src/apple/xcode-manager.ts +2 -0
- package/src/nextjs/nextjs-wizard.ts +39 -12
- package/src/nextjs/templates.ts +15 -0
- package/src/utils/clack-utils.ts +4 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import adapter from '@sveltejs/adapter-auto';
|
|
2
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
3
|
+
|
|
4
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
5
|
+
const config = {
|
|
6
|
+
// Consult https://svelte.dev/docs/kit/integrations#preprocessors
|
|
7
|
+
// for more information about preprocessors
|
|
8
|
+
preprocess: vitePreprocess(),
|
|
9
|
+
|
|
10
|
+
kit: {
|
|
11
|
+
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
|
12
|
+
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
|
13
|
+
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
|
14
|
+
adapter: adapter()
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* eslint-disable jest/expect-expect */
|
|
2
|
+
import { Integration } from '../../lib/Constants';
|
|
3
|
+
import {
|
|
4
|
+
checkEnvBuildPlugin,
|
|
5
|
+
cleanupGit,
|
|
6
|
+
KEYS,
|
|
7
|
+
revertLocalChanges,
|
|
8
|
+
} from '../utils';
|
|
9
|
+
import { startWizardInstance } from '../utils';
|
|
10
|
+
import {
|
|
11
|
+
checkFileContents,
|
|
12
|
+
checkFileExists,
|
|
13
|
+
checkIfBuilds,
|
|
14
|
+
checkIfRunsOnDevMode,
|
|
15
|
+
checkIfRunsOnProdMode,
|
|
16
|
+
checkPackageJson,
|
|
17
|
+
} from '../utils';
|
|
18
|
+
import * as path from 'path';
|
|
19
|
+
|
|
20
|
+
describe('NextJS', () => {
|
|
21
|
+
const integration = Integration.nextjs;
|
|
22
|
+
const projectDir = path.resolve(
|
|
23
|
+
__dirname,
|
|
24
|
+
'../test-applications/nextjs-test-app',
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
beforeAll(async () => {
|
|
28
|
+
const wizardInstance = startWizardInstance(integration, projectDir);
|
|
29
|
+
const packageManagerPrompted = await wizardInstance.waitForOutput(
|
|
30
|
+
'Please select your package manager.',
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const routeThroughNextJsPrompted =
|
|
34
|
+
packageManagerPrompted &&
|
|
35
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
36
|
+
// Selecting `yarn` as the package manager
|
|
37
|
+
[KEYS.DOWN, KEYS.ENTER],
|
|
38
|
+
'Do you want to route Sentry requests in the browser through your Next.js server',
|
|
39
|
+
{
|
|
40
|
+
timeout: 240_000,
|
|
41
|
+
},
|
|
42
|
+
));
|
|
43
|
+
|
|
44
|
+
const reactComponentAnnotationsPrompted =
|
|
45
|
+
routeThroughNextJsPrompted &&
|
|
46
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
47
|
+
[KEYS.ENTER],
|
|
48
|
+
'Do you want to enable React component annotations',
|
|
49
|
+
));
|
|
50
|
+
|
|
51
|
+
const tracingOptionPrompted =
|
|
52
|
+
reactComponentAnnotationsPrompted &&
|
|
53
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
54
|
+
[KEYS.ENTER],
|
|
55
|
+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
56
|
+
'to track the performance of your application?',
|
|
57
|
+
));
|
|
58
|
+
|
|
59
|
+
const replayOptionPrompted =
|
|
60
|
+
tracingOptionPrompted &&
|
|
61
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
62
|
+
[KEYS.ENTER],
|
|
63
|
+
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
64
|
+
'to get a video-like reproduction of errors during a user session?',
|
|
65
|
+
));
|
|
66
|
+
|
|
67
|
+
const examplePagePrompted =
|
|
68
|
+
replayOptionPrompted &&
|
|
69
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
70
|
+
[KEYS.ENTER],
|
|
71
|
+
'Do you want to create an example page',
|
|
72
|
+
{
|
|
73
|
+
optional: true,
|
|
74
|
+
},
|
|
75
|
+
));
|
|
76
|
+
|
|
77
|
+
const ciCdPrompted =
|
|
78
|
+
examplePagePrompted &&
|
|
79
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
80
|
+
[KEYS.ENTER],
|
|
81
|
+
'Are you using a CI/CD tool',
|
|
82
|
+
));
|
|
83
|
+
|
|
84
|
+
ciCdPrompted &&
|
|
85
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
86
|
+
// Selecting `No` for CI/CD tool
|
|
87
|
+
[KEYS.DOWN, KEYS.ENTER],
|
|
88
|
+
'Successfully installed the Sentry Next.js SDK!',
|
|
89
|
+
));
|
|
90
|
+
|
|
91
|
+
wizardInstance.kill();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
afterAll(() => {
|
|
95
|
+
revertLocalChanges(projectDir);
|
|
96
|
+
cleanupGit(projectDir);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('package.json is updated correctly', () => {
|
|
100
|
+
checkPackageJson(projectDir, integration);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('.env-sentry-build-plugin is created and contains the auth token', () => {
|
|
104
|
+
checkEnvBuildPlugin(projectDir);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('example page exists', () => {
|
|
108
|
+
checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);
|
|
109
|
+
checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('config files created', () => {
|
|
113
|
+
checkFileExists(`${projectDir}/sentry.server.config.ts`);
|
|
114
|
+
checkFileExists(`${projectDir}/sentry.client.config.ts`);
|
|
115
|
+
checkFileExists(`${projectDir}/sentry.edge.config.ts`);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('global error file exists', () => {
|
|
119
|
+
checkFileExists(`${projectDir}/src/app/global-error.tsx`);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('instrumentation file exists', () => {
|
|
123
|
+
checkFileExists(`${projectDir}/src/instrumentation.ts`);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('instrumentation file contains Sentry initialization', () => {
|
|
127
|
+
checkFileContents(`${projectDir}/src/instrumentation.ts`, [
|
|
128
|
+
"import * as Sentry from '@sentry/nextjs';",
|
|
129
|
+
`export async function register() {
|
|
130
|
+
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
131
|
+
await import('../sentry.server.config');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
135
|
+
await import('../sentry.edge.config');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const onRequestError = Sentry.captureRequestError;`,
|
|
140
|
+
]);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('next.config file contains Sentry wrapper', () => {
|
|
144
|
+
checkFileContents(`${projectDir}/next.config.mjs`, [
|
|
145
|
+
"import {withSentryConfig} from '@sentry/nextjs'",
|
|
146
|
+
'export default withSentryConfig(nextConfig, {',
|
|
147
|
+
]);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test('runs on dev mode correctly', async () => {
|
|
151
|
+
await checkIfRunsOnDevMode(projectDir, 'Ready in');
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('builds correctly', async () => {
|
|
155
|
+
await checkIfBuilds(projectDir, 'server-rendered on demand');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test('runs on prod mode correctly', async () => {
|
|
159
|
+
await checkIfRunsOnProdMode(projectDir, 'Ready in');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
import { Integration } from '../../lib/Constants';
|
|
3
3
|
import {
|
|
4
4
|
checkEnvBuildPlugin,
|
|
5
|
-
cleanupGit,
|
|
6
|
-
KEYS,
|
|
7
|
-
revertLocalChanges,
|
|
8
|
-
} from '../utils';
|
|
9
|
-
import { startWizardInstance } from '../utils';
|
|
10
|
-
import {
|
|
11
5
|
checkFileContents,
|
|
12
6
|
checkFileExists,
|
|
13
7
|
checkIfBuilds,
|
|
14
8
|
checkIfRunsOnDevMode,
|
|
15
9
|
checkIfRunsOnProdMode,
|
|
16
10
|
checkPackageJson,
|
|
11
|
+
cleanupGit,
|
|
12
|
+
KEYS,
|
|
13
|
+
revertLocalChanges,
|
|
14
|
+
startWizardInstance,
|
|
17
15
|
TEST_ARGS,
|
|
18
16
|
} from '../utils';
|
|
19
17
|
import * as path from 'path';
|
|
@@ -31,44 +29,37 @@ describe('Remix', () => {
|
|
|
31
29
|
'Please select your package manager.',
|
|
32
30
|
);
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
wizardInstance.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
wizardInstance.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (examplePagePrompted) {
|
|
67
|
-
wizardInstance.sendStdin(KEYS.ENTER);
|
|
68
|
-
wizardInstance.sendStdin(KEYS.ENTER);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
await wizardInstance.waitForOutput(
|
|
32
|
+
const tracingOptionPrompted =
|
|
33
|
+
packageManagerPrompted &&
|
|
34
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
35
|
+
// Selecting `yarn` as the package manager
|
|
36
|
+
[KEYS.DOWN, KEYS.ENTER],
|
|
37
|
+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
38
|
+
'to track the performance of your application?',
|
|
39
|
+
{
|
|
40
|
+
timeout: 240_000,
|
|
41
|
+
},
|
|
42
|
+
));
|
|
43
|
+
|
|
44
|
+
const replayOptionPrompted =
|
|
45
|
+
tracingOptionPrompted &&
|
|
46
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
47
|
+
[KEYS.ENTER],
|
|
48
|
+
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
49
|
+
'to get a video-like reproduction of errors during a user session?',
|
|
50
|
+
));
|
|
51
|
+
|
|
52
|
+
replayOptionPrompted &&
|
|
53
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
54
|
+
[KEYS.ENTER],
|
|
55
|
+
'Do you want to create an example page',
|
|
56
|
+
{
|
|
57
|
+
optional: true,
|
|
58
|
+
},
|
|
59
|
+
));
|
|
60
|
+
|
|
61
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
62
|
+
[KEYS.ENTER, KEYS.ENTER],
|
|
72
63
|
'Sentry has been successfully configured for your Remix project',
|
|
73
64
|
);
|
|
74
65
|
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* eslint-disable jest/expect-expect */
|
|
2
|
+
import { Integration } from '../../lib/Constants';
|
|
3
|
+
import {
|
|
4
|
+
checkEnvBuildPlugin,
|
|
5
|
+
checkFileContents,
|
|
6
|
+
checkFileExists,
|
|
7
|
+
checkIfBuilds,
|
|
8
|
+
checkIfRunsOnDevMode,
|
|
9
|
+
checkIfRunsOnProdMode,
|
|
10
|
+
checkPackageJson,
|
|
11
|
+
cleanupGit,
|
|
12
|
+
KEYS,
|
|
13
|
+
revertLocalChanges,
|
|
14
|
+
startWizardInstance,
|
|
15
|
+
TEST_ARGS,
|
|
16
|
+
} from '../utils';
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
|
|
19
|
+
describe('Sveltekit', () => {
|
|
20
|
+
const integration = Integration.sveltekit;
|
|
21
|
+
const projectDir = path.resolve(
|
|
22
|
+
__dirname,
|
|
23
|
+
'../test-applications/sveltekit-test-app',
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
beforeAll(async () => {
|
|
27
|
+
const wizardInstance = startWizardInstance(integration, projectDir);
|
|
28
|
+
|
|
29
|
+
const packageManagerPrompted = await wizardInstance.waitForOutput(
|
|
30
|
+
'Please select your package manager.',
|
|
31
|
+
{
|
|
32
|
+
optional: true,
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const tracingOptionPrompted =
|
|
37
|
+
packageManagerPrompted &&
|
|
38
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
39
|
+
// Selecting `yarn` as the package manager
|
|
40
|
+
[KEYS.DOWN, KEYS.ENTER],
|
|
41
|
+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
42
|
+
'to track the performance of your application?',
|
|
43
|
+
{
|
|
44
|
+
timeout: 240_000,
|
|
45
|
+
}
|
|
46
|
+
));
|
|
47
|
+
|
|
48
|
+
const replayOptionPrompted =
|
|
49
|
+
tracingOptionPrompted &&
|
|
50
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
51
|
+
[KEYS.ENTER],
|
|
52
|
+
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
53
|
+
'to get a video-like reproduction of errors during a user session?',
|
|
54
|
+
));
|
|
55
|
+
|
|
56
|
+
replayOptionPrompted &&
|
|
57
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
58
|
+
[KEYS.ENTER],
|
|
59
|
+
'Do you want to create an example page',
|
|
60
|
+
{
|
|
61
|
+
optional: true,
|
|
62
|
+
},
|
|
63
|
+
));
|
|
64
|
+
|
|
65
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
66
|
+
[KEYS.ENTER, KEYS.ENTER],
|
|
67
|
+
'Successfully installed the Sentry SvelteKit SDK!',
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
wizardInstance.kill();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
afterAll(() => {
|
|
74
|
+
revertLocalChanges(projectDir);
|
|
75
|
+
cleanupGit(projectDir);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('should have the correct package.json', () => {
|
|
79
|
+
checkPackageJson(projectDir, integration);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('should have the correct .env.sentry-build-plugin', () => {
|
|
83
|
+
checkEnvBuildPlugin(projectDir);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('example page exists', () => {
|
|
87
|
+
checkFileExists(path.resolve(projectDir, 'src/routes/sentry-example/+page.svelte'));
|
|
88
|
+
checkFileExists(path.resolve(projectDir, 'src/routes/sentry-example/+server.js'));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('vite.config contains sentry plugin', () => {
|
|
92
|
+
checkFileContents(path.resolve(projectDir, 'vite.config.ts'), `plugins: [sentrySvelteKit({
|
|
93
|
+
sourceMapsUploadOptions: {
|
|
94
|
+
`);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('hook files created', () => {
|
|
98
|
+
checkFileExists(path.resolve(projectDir, 'src/hooks.server.ts'));
|
|
99
|
+
checkFileExists(path.resolve(projectDir, 'src/hooks.client.ts'));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('hooks.client.ts contains sentry import', () => {
|
|
103
|
+
checkFileContents(
|
|
104
|
+
path.resolve(projectDir, 'src/hooks.client.ts'),
|
|
105
|
+
[`import * as Sentry from '@sentry/sveltekit';`,
|
|
106
|
+
`Sentry.init({
|
|
107
|
+
dsn: '${TEST_ARGS.PROJECT_DSN}',
|
|
108
|
+
|
|
109
|
+
tracesSampleRate: 1.0,
|
|
110
|
+
|
|
111
|
+
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
112
|
+
// in development and sample at a lower rate in production
|
|
113
|
+
replaysSessionSampleRate: 0.1,
|
|
114
|
+
|
|
115
|
+
// If the entire session is not sampled, use the below sample rate to sample
|
|
116
|
+
// sessions when an error occurs.
|
|
117
|
+
replaysOnErrorSampleRate: 1.0,
|
|
118
|
+
|
|
119
|
+
// If you don't want to use Session Replay, just remove the line below:
|
|
120
|
+
integrations: [replayIntegration()],
|
|
121
|
+
});`]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
test('hooks.server.ts contains sentry import', () => {
|
|
126
|
+
checkFileContents(
|
|
127
|
+
path.resolve(projectDir, 'src/hooks.server.ts'),
|
|
128
|
+
[
|
|
129
|
+
`import * as Sentry from '@sentry/sveltekit';`,
|
|
130
|
+
`Sentry.init({
|
|
131
|
+
dsn: '${TEST_ARGS.PROJECT_DSN}',
|
|
132
|
+
|
|
133
|
+
tracesSampleRate: 1.0,
|
|
134
|
+
|
|
135
|
+
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
136
|
+
// spotlight: import.meta.env.DEV,
|
|
137
|
+
});`])
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
test('runs on dev mode correctly', async () => {
|
|
142
|
+
await checkIfRunsOnDevMode(projectDir, 'ready in');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('should build successfully', async () => {
|
|
146
|
+
await checkIfBuilds(projectDir, 'Successfully uploaded source maps to Sentry');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('runs on prod mode correctly', async () => {
|
|
150
|
+
// We can't use the full prompt `Network: use--host to expose` as `--host` can be printed in bold.
|
|
151
|
+
await checkIfRunsOnProdMode(projectDir, 'to expose', "preview");
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
package/e2e-tests/utils/index.ts
CHANGED
|
@@ -16,8 +16,11 @@ export const KEYS = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const TEST_ARGS = {
|
|
19
|
-
AUTH_TOKEN: 'TEST_AUTH_TOKEN',
|
|
20
|
-
PROJECT_DSN:
|
|
19
|
+
AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',
|
|
20
|
+
PROJECT_DSN:
|
|
21
|
+
process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',
|
|
22
|
+
ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',
|
|
23
|
+
PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',
|
|
21
24
|
};
|
|
22
25
|
|
|
23
26
|
export const log = {
|
|
@@ -55,6 +58,28 @@ export class WizardTestEnv {
|
|
|
55
58
|
this.taskHandle.stdin.write(input);
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Sends the input and waits for the output.
|
|
63
|
+
* @returns a promise that resolves when the output was found
|
|
64
|
+
* @throws an error when the output was not found within the timeout
|
|
65
|
+
*/
|
|
66
|
+
sendStdinAndWaitForOutput(
|
|
67
|
+
input: string | string[],
|
|
68
|
+
output: string,
|
|
69
|
+
options?: { timeout?: number; optional?: boolean },
|
|
70
|
+
) {
|
|
71
|
+
const outputPromise = this.waitForOutput(output, options);
|
|
72
|
+
|
|
73
|
+
if (Array.isArray(input)) {
|
|
74
|
+
for (const i of input) {
|
|
75
|
+
this.sendStdin(i);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
this.sendStdin(input);
|
|
79
|
+
}
|
|
80
|
+
return outputPromise;
|
|
81
|
+
}
|
|
82
|
+
|
|
58
83
|
/**
|
|
59
84
|
* Waits for the provided output with `.includes()` logic.
|
|
60
85
|
*
|
|
@@ -71,7 +96,7 @@ export class WizardTestEnv {
|
|
|
71
96
|
} = {},
|
|
72
97
|
) {
|
|
73
98
|
const { timeout, optional } = {
|
|
74
|
-
timeout:
|
|
99
|
+
timeout: 60_000,
|
|
75
100
|
optional: false,
|
|
76
101
|
...options,
|
|
77
102
|
};
|
|
@@ -122,7 +147,7 @@ export function initGit(projectDir: string): void {
|
|
|
122
147
|
execSync('git commit -m init', { cwd: projectDir });
|
|
123
148
|
} catch (e) {
|
|
124
149
|
log.error('Error initializing git');
|
|
125
|
-
|
|
150
|
+
log.error(e);
|
|
126
151
|
}
|
|
127
152
|
}
|
|
128
153
|
|
|
@@ -139,7 +164,7 @@ export function cleanupGit(projectDir: string): void {
|
|
|
139
164
|
execSync(`rm -rf ${projectDir}/.git`);
|
|
140
165
|
} catch (e) {
|
|
141
166
|
log.error('Error cleaning up git');
|
|
142
|
-
|
|
167
|
+
log.error(e);
|
|
143
168
|
}
|
|
144
169
|
}
|
|
145
170
|
|
|
@@ -159,7 +184,7 @@ export function revertLocalChanges(projectDir: string): void {
|
|
|
159
184
|
execSync('git clean -fd .', { cwd: projectDir });
|
|
160
185
|
} catch (e) {
|
|
161
186
|
log.error('Error reverting local changes');
|
|
162
|
-
|
|
187
|
+
log.error(e);
|
|
163
188
|
}
|
|
164
189
|
}
|
|
165
190
|
|
|
@@ -173,6 +198,7 @@ export function revertLocalChanges(projectDir: string): void {
|
|
|
173
198
|
export function startWizardInstance(
|
|
174
199
|
integration: Integration,
|
|
175
200
|
projectDir: string,
|
|
201
|
+
debug = false,
|
|
176
202
|
): WizardTestEnv {
|
|
177
203
|
const binPath = path.join(__dirname, '../../dist/bin.js');
|
|
178
204
|
|
|
@@ -191,8 +217,12 @@ export function startWizardInstance(
|
|
|
191
217
|
TEST_ARGS.AUTH_TOKEN,
|
|
192
218
|
'--preSelectedProject.dsn',
|
|
193
219
|
TEST_ARGS.PROJECT_DSN,
|
|
220
|
+
'--preSelectedProject.orgSlug',
|
|
221
|
+
TEST_ARGS.ORG_SLUG,
|
|
222
|
+
'--preSelectedProject.projectSlug',
|
|
223
|
+
TEST_ARGS.PROJECT_SLUG,
|
|
194
224
|
],
|
|
195
|
-
{ cwd: projectDir },
|
|
225
|
+
{ cwd: projectDir, debug },
|
|
196
226
|
);
|
|
197
227
|
}
|
|
198
228
|
|
|
@@ -266,7 +296,11 @@ export async function checkIfBuilds(
|
|
|
266
296
|
cwd: projectDir,
|
|
267
297
|
});
|
|
268
298
|
|
|
269
|
-
await expect(
|
|
299
|
+
await expect(
|
|
300
|
+
testEnv.waitForOutput(expectedOutput, {
|
|
301
|
+
timeout: 120_000,
|
|
302
|
+
}),
|
|
303
|
+
).resolves.toBe(true);
|
|
270
304
|
}
|
|
271
305
|
|
|
272
306
|
/**
|
|
@@ -280,7 +314,11 @@ export async function checkIfRunsOnDevMode(
|
|
|
280
314
|
) {
|
|
281
315
|
const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });
|
|
282
316
|
|
|
283
|
-
await expect(
|
|
317
|
+
await expect(
|
|
318
|
+
testEnv.waitForOutput(expectedOutput, {
|
|
319
|
+
timeout: 120_000,
|
|
320
|
+
}),
|
|
321
|
+
).resolves.toBe(true);
|
|
284
322
|
testEnv.kill();
|
|
285
323
|
}
|
|
286
324
|
|
|
@@ -292,11 +330,16 @@ export async function checkIfRunsOnDevMode(
|
|
|
292
330
|
export async function checkIfRunsOnProdMode(
|
|
293
331
|
projectDir: string,
|
|
294
332
|
expectedOutput: string,
|
|
333
|
+
startCommand = 'start',
|
|
295
334
|
) {
|
|
296
|
-
const testEnv = new WizardTestEnv('npm', ['run',
|
|
335
|
+
const testEnv = new WizardTestEnv('npm', ['run', startCommand], {
|
|
297
336
|
cwd: projectDir,
|
|
298
337
|
});
|
|
299
338
|
|
|
300
|
-
await expect(
|
|
339
|
+
await expect(
|
|
340
|
+
testEnv.waitForOutput(expectedOutput, {
|
|
341
|
+
timeout: 120_000,
|
|
342
|
+
}),
|
|
343
|
+
).resolves.toBe(true);
|
|
301
344
|
testEnv.kill();
|
|
302
345
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.34.
|
|
3
|
+
"version": "3.34.3",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@types/yargs": "^16.0.9",
|
|
56
56
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
57
57
|
"@typescript-eslint/parser": "^5.13.0",
|
|
58
|
+
"dotenv": "^16.4.5",
|
|
58
59
|
"eslint": "^8.18.0",
|
|
59
60
|
"eslint-config-prettier": "^8.3.0",
|
|
60
61
|
"eslint-plugin-jest": "^25.3.0",
|
|
@@ -66,9 +67,6 @@
|
|
|
66
67
|
"tsx": "^3.14.0",
|
|
67
68
|
"typescript": "^5.0.4"
|
|
68
69
|
},
|
|
69
|
-
"resolutions": {
|
|
70
|
-
"**/xmldom": "^0.6.0"
|
|
71
|
-
},
|
|
72
70
|
"engines": {
|
|
73
71
|
"node": ">=14.18.0",
|
|
74
72
|
"npm": ">=3.10.7",
|
|
@@ -87,7 +85,7 @@
|
|
|
87
85
|
"fix:prettier": "prettier --write \"{lib,src,test}/**/*.ts\"",
|
|
88
86
|
"fix:eslint": "eslint . --format stylish --fix",
|
|
89
87
|
"test": "yarn build && jest",
|
|
90
|
-
"test:e2e": "yarn build &&
|
|
88
|
+
"test:e2e": "yarn build && ./e2e-tests/run.sh",
|
|
91
89
|
"try": "ts-node bin.ts",
|
|
92
90
|
"try:uninstall": "ts-node bin.ts --uninstall",
|
|
93
91
|
"test:watch": "jest --watch"
|
package/src/apple/templates.ts
CHANGED
|
@@ -2,9 +2,13 @@ export function getRunScriptTemplate(
|
|
|
2
2
|
orgSlug: string,
|
|
3
3
|
projectSlug: string,
|
|
4
4
|
uploadSource = true,
|
|
5
|
+
includeHomebrewPath = false,
|
|
5
6
|
): string {
|
|
6
7
|
// eslint-disable-next-line no-useless-escape
|
|
7
|
-
|
|
8
|
+
const includeHomebrew = includeHomebrewPath
|
|
9
|
+
? '\\nif [[ "$(uname -m)" == arm64 ]]; then\\nexport PATH="/opt/homebrew/bin:$PATH"\\nfi'
|
|
10
|
+
: '';
|
|
11
|
+
return `# This script is responsable to upload debug symbols and source context for Sentry.${includeHomebrew}\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=${orgSlug}\\nexport SENTRY_PROJECT=${projectSlug}\\nERROR=$(sentry-cli debug-files upload ${
|
|
8
12
|
uploadSource ? '--include-sources ' : ''
|
|
9
13
|
}"$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)\\nif [ ! $? -eq 0 ]; then\\necho "warning: sentry-cli - $ERROR"\\nfi\\nelse\\necho "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"\\nfi\\n`;
|
|
10
14
|
}
|
|
@@ -164,6 +164,7 @@ function addUploadSymbolsScript(
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');
|
|
167
168
|
xcodeProject.addBuildPhase(
|
|
168
169
|
[],
|
|
169
170
|
'PBXShellScriptBuildPhase',
|
|
@@ -178,6 +179,7 @@ function addUploadSymbolsScript(
|
|
|
178
179
|
sentryProject.organization.slug,
|
|
179
180
|
sentryProject.slug,
|
|
180
181
|
uploadSource,
|
|
182
|
+
isHomebrewInstalled,
|
|
181
183
|
),
|
|
182
184
|
},
|
|
183
185
|
);
|