@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
|
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.checkIfRunsOnProdMode = exports.checkIfRunsOnDevMode = exports.checkIfExpoBundles = exports.checkIfReactNativeBundles = exports.checkIfFlutterBuilds = exports.checkIfBuilds = exports.checkSentryProperties = exports.checkEnvBuildPlugin = exports.checkSentryCliRc = exports.checkPackageJson = exports.checkFileDoesNotExist = exports.checkFileExists = exports.checkFileContents = exports.checkFileDoesNotContain = exports.modifyFile = exports.createFile = exports.
|
|
26
|
+
exports.checkIfRunsOnProdMode = exports.checkIfRunsOnDevMode = exports.checkIfExpoBundles = exports.checkIfReactNativeBundles = exports.checkIfFlutterBuilds = exports.checkIfLints = exports.checkIfBuilds = exports.checkSentryProperties = exports.checkEnvBuildPlugin = exports.checkSentryCliRc = exports.checkPackageJson = exports.checkFileDoesNotExist = exports.checkFileExists = exports.checkFileContents = exports.checkFileDoesNotContain = exports.modifyFile = exports.createFile = exports.getWizardCommand = exports.ProcessRunner = exports.createIsolatedTestEnv = exports.log = exports.TEST_ARGS = exports.KEYS = void 0;
|
|
27
27
|
const fs = __importStar(require("node:fs"));
|
|
28
|
+
const os = __importStar(require("node:os"));
|
|
28
29
|
const path = __importStar(require("node:path"));
|
|
29
|
-
const Constants_1 = require("../../lib/Constants");
|
|
30
30
|
const node_child_process_1 = require("node:child_process");
|
|
31
31
|
const Logging_1 = require("../../lib/Helper/Logging");
|
|
32
32
|
const vitest_1 = require("vitest");
|
|
@@ -73,7 +73,51 @@ exports.log = {
|
|
|
73
73
|
(0, Logging_1.red)(`[ERROR] ${formatMessage(message, 0)}`);
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Creates an isolated test environment by copying a test application to a temporary directory.
|
|
78
|
+
* Each call creates a NEW unique temporary directory, allowing multiple isolated environments
|
|
79
|
+
* per test file (useful for tests that run the wizard multiple times with different configs).
|
|
80
|
+
*
|
|
81
|
+
* @param testAppName - Name of the test application folder (e.g., 'nextjs-16-test-app')
|
|
82
|
+
* @returns Object with projectDir path and cleanup function
|
|
83
|
+
*/
|
|
84
|
+
function createIsolatedTestEnv(testAppName) {
|
|
85
|
+
const sourceDir = path.resolve(__dirname, '../test-applications', testAppName);
|
|
86
|
+
const tmpBaseDir = path.join(os.tmpdir(), 'sentry-wizard-e2e');
|
|
87
|
+
if (!fs.existsSync(tmpBaseDir)) {
|
|
88
|
+
fs.mkdirSync(tmpBaseDir, { recursive: true });
|
|
89
|
+
}
|
|
90
|
+
const projectDir = fs.mkdtempSync(path.join(tmpBaseDir, `${testAppName}-`));
|
|
91
|
+
exports.log.info(`Created isolated test env at: ${projectDir}`);
|
|
92
|
+
try {
|
|
93
|
+
fs.cpSync(sourceDir, projectDir, { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
exports.log.error('Error copying test application');
|
|
97
|
+
exports.log.error(e);
|
|
98
|
+
throw e;
|
|
99
|
+
}
|
|
100
|
+
initGit(projectDir);
|
|
101
|
+
const cleanup = () => {
|
|
102
|
+
try {
|
|
103
|
+
const keepOnFailure = process.env.SENTRY_WIZARD_E2E_KEEP_TEMP === 'true';
|
|
104
|
+
if (keepOnFailure) {
|
|
105
|
+
exports.log.info(`Keeping temp directory for debugging: ${projectDir}`);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
109
|
+
exports.log.info(`Cleaned up isolated test env: ${projectDir}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
exports.log.error(`Error cleaning up test environment at ${projectDir}`);
|
|
114
|
+
exports.log.error(e);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return { projectDir, cleanup };
|
|
118
|
+
}
|
|
119
|
+
exports.createIsolatedTestEnv = createIsolatedTestEnv;
|
|
120
|
+
class ProcessRunner {
|
|
77
121
|
taskHandle;
|
|
78
122
|
constructor(cmd, args, opts) {
|
|
79
123
|
this.taskHandle = (0, node_child_process_1.spawn)(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });
|
|
@@ -82,26 +126,6 @@ class WizardTestEnv {
|
|
|
82
126
|
this.taskHandle.stderr?.pipe(process.stderr);
|
|
83
127
|
}
|
|
84
128
|
}
|
|
85
|
-
sendStdin(input) {
|
|
86
|
-
this.taskHandle.stdin?.write(input);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Sends the input and waits for the output.
|
|
90
|
-
* @returns a promise that resolves when the output was found
|
|
91
|
-
* @throws an error when the output was not found within the timeout
|
|
92
|
-
*/
|
|
93
|
-
sendStdinAndWaitForOutput(input, output, options) {
|
|
94
|
-
const outputPromise = this.waitForOutput(output, options);
|
|
95
|
-
if (Array.isArray(input)) {
|
|
96
|
-
for (const i of input) {
|
|
97
|
-
this.sendStdin(i);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
this.sendStdin(input);
|
|
102
|
-
}
|
|
103
|
-
return outputPromise;
|
|
104
|
-
}
|
|
105
129
|
/**
|
|
106
130
|
* Waits for the task to exit with a given `statusCode`.
|
|
107
131
|
*
|
|
@@ -182,73 +206,7 @@ class WizardTestEnv {
|
|
|
182
206
|
this.taskHandle.unref();
|
|
183
207
|
}
|
|
184
208
|
}
|
|
185
|
-
exports.
|
|
186
|
-
/**
|
|
187
|
-
* Initialize a git repository in the given directory
|
|
188
|
-
* @param projectDir
|
|
189
|
-
*/
|
|
190
|
-
function initGit(projectDir) {
|
|
191
|
-
try {
|
|
192
|
-
(0, node_child_process_1.execSync)('git init', { cwd: projectDir });
|
|
193
|
-
// Add all files to the git repo
|
|
194
|
-
(0, node_child_process_1.execSync)('git add -A', { cwd: projectDir });
|
|
195
|
-
// Add author info to avoid git commit error
|
|
196
|
-
(0, node_child_process_1.execSync)('git config user.email test@test.sentry.io', { cwd: projectDir });
|
|
197
|
-
(0, node_child_process_1.execSync)('git config user.name Test', { cwd: projectDir });
|
|
198
|
-
(0, node_child_process_1.execSync)('git commit -m init', { cwd: projectDir });
|
|
199
|
-
}
|
|
200
|
-
catch (e) {
|
|
201
|
-
exports.log.error('Error initializing git');
|
|
202
|
-
exports.log.error(e);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
exports.initGit = initGit;
|
|
206
|
-
/**
|
|
207
|
-
* Cleanup the git repository in the given directory
|
|
208
|
-
*
|
|
209
|
-
* Caution! Make sure `projectDir` is a test project directory,
|
|
210
|
-
* if in doubt, please commit your local non-test changes first!
|
|
211
|
-
* @param projectDir
|
|
212
|
-
*/
|
|
213
|
-
function cleanupGit(projectDir) {
|
|
214
|
-
try {
|
|
215
|
-
// Remove the .git directory
|
|
216
|
-
(0, node_child_process_1.execSync)(`rm -rf ${projectDir}/.git`);
|
|
217
|
-
}
|
|
218
|
-
catch (e) {
|
|
219
|
-
exports.log.error('Error cleaning up git');
|
|
220
|
-
exports.log.error(e);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
exports.cleanupGit = cleanupGit;
|
|
224
|
-
/**
|
|
225
|
-
* Revert local changes in the given directory
|
|
226
|
-
*
|
|
227
|
-
* Caution! Make sure `projectDir` is a test project directory,
|
|
228
|
-
* if in doubt, please commit your local non-test changes first!
|
|
229
|
-
*
|
|
230
|
-
* @param projectDir
|
|
231
|
-
*/
|
|
232
|
-
function revertLocalChanges(projectDir) {
|
|
233
|
-
try {
|
|
234
|
-
// Check if this is a git repository first
|
|
235
|
-
const isGitRepo = fs.existsSync(path.join(projectDir, '.git'));
|
|
236
|
-
if (isGitRepo) {
|
|
237
|
-
// Revert tracked files
|
|
238
|
-
(0, node_child_process_1.execSync)('git restore .', { cwd: projectDir });
|
|
239
|
-
// Revert untracked files
|
|
240
|
-
(0, node_child_process_1.execSync)('git clean -fd .', { cwd: projectDir });
|
|
241
|
-
}
|
|
242
|
-
// Remove node_modules and dist (.gitignore'd and therefore not removed via git clean)
|
|
243
|
-
(0, node_child_process_1.execSync)('rm -rf node_modules', { cwd: projectDir });
|
|
244
|
-
(0, node_child_process_1.execSync)('rm -rf dist', { cwd: projectDir });
|
|
245
|
-
}
|
|
246
|
-
catch (e) {
|
|
247
|
-
exports.log.error('Error reverting local changes');
|
|
248
|
-
exports.log.error(e);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
exports.revertLocalChanges = revertLocalChanges;
|
|
209
|
+
exports.ProcessRunner = ProcessRunner;
|
|
252
210
|
function getWizardCommand(integration) {
|
|
253
211
|
const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN
|
|
254
212
|
? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]
|
|
@@ -271,33 +229,6 @@ function getWizardCommand(integration) {
|
|
|
271
229
|
return `${binPath} ${args.join(' ')}`;
|
|
272
230
|
}
|
|
273
231
|
exports.getWizardCommand = getWizardCommand;
|
|
274
|
-
/**
|
|
275
|
-
* Start the wizard instance with the given integration and project directory
|
|
276
|
-
* @param integration
|
|
277
|
-
* @param projectDir
|
|
278
|
-
*
|
|
279
|
-
* @returns WizardTestEnv
|
|
280
|
-
*/
|
|
281
|
-
function startWizardInstance(integration, projectDir, debug = false, spotlight = false) {
|
|
282
|
-
const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN
|
|
283
|
-
? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]
|
|
284
|
-
: ['dist', 'bin.js'];
|
|
285
|
-
const binPath = path.join(__dirname, '..', '..', ...binName);
|
|
286
|
-
revertLocalChanges(projectDir);
|
|
287
|
-
cleanupGit(projectDir);
|
|
288
|
-
initGit(projectDir);
|
|
289
|
-
const args = ['--debug', '-i', integration];
|
|
290
|
-
if (spotlight) {
|
|
291
|
-
// Spotlight mode: skip authentication
|
|
292
|
-
args.push('--spotlight');
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
args.push('--preSelectedProject.authToken', exports.TEST_ARGS.AUTH_TOKEN, '--preSelectedProject.dsn', exports.TEST_ARGS.PROJECT_DSN, '--preSelectedProject.orgSlug', exports.TEST_ARGS.ORG_SLUG, '--preSelectedProject.projectSlug', exports.TEST_ARGS.PROJECT_SLUG);
|
|
296
|
-
}
|
|
297
|
-
args.push('--disable-telemetry');
|
|
298
|
-
return new WizardTestEnv(binPath, args, { cwd: projectDir, debug });
|
|
299
|
-
}
|
|
300
|
-
exports.startWizardInstance = startWizardInstance;
|
|
301
232
|
/**
|
|
302
233
|
* Create a file with the given content
|
|
303
234
|
*
|
|
@@ -371,54 +302,17 @@ function checkFileDoesNotExist(filePath) {
|
|
|
371
302
|
}
|
|
372
303
|
exports.checkFileDoesNotExist = checkFileDoesNotExist;
|
|
373
304
|
/**
|
|
374
|
-
*
|
|
375
|
-
* @param type Integration type
|
|
376
|
-
* @returns Package name or undefined if no package exists
|
|
377
|
-
*/
|
|
378
|
-
function mapIntegrationToPackageName(type) {
|
|
379
|
-
switch (type) {
|
|
380
|
-
case Constants_1.Integration.android:
|
|
381
|
-
return undefined; // Android doesn't have a JavaScript package
|
|
382
|
-
case Constants_1.Integration.reactNative:
|
|
383
|
-
return '@sentry/react-native';
|
|
384
|
-
case Constants_1.Integration.flutter:
|
|
385
|
-
return undefined; // Flutter doesn't have a JavaScript package
|
|
386
|
-
case Constants_1.Integration.cordova:
|
|
387
|
-
return '@sentry/cordova';
|
|
388
|
-
case Constants_1.Integration.angular:
|
|
389
|
-
return '@sentry/angular';
|
|
390
|
-
case Constants_1.Integration.electron:
|
|
391
|
-
return '@sentry/electron';
|
|
392
|
-
case Constants_1.Integration.nextjs:
|
|
393
|
-
return '@sentry/nextjs';
|
|
394
|
-
case Constants_1.Integration.nuxt:
|
|
395
|
-
return '@sentry/nuxt';
|
|
396
|
-
case Constants_1.Integration.remix:
|
|
397
|
-
return '@sentry/remix';
|
|
398
|
-
case Constants_1.Integration.reactRouter:
|
|
399
|
-
return '@sentry/react-router';
|
|
400
|
-
case Constants_1.Integration.sveltekit:
|
|
401
|
-
return '@sentry/sveltekit';
|
|
402
|
-
case Constants_1.Integration.sourcemaps:
|
|
403
|
-
return undefined; // Sourcemaps doesn't install a package
|
|
404
|
-
case Constants_1.Integration.ios:
|
|
405
|
-
return undefined; // iOS doesn't have a JavaScript package
|
|
406
|
-
default:
|
|
407
|
-
return undefined;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Check if the package.json contains the given integration
|
|
305
|
+
* Check if the package.json lists the given package as a dependency or dev dependency
|
|
412
306
|
*
|
|
413
307
|
* @param projectDir
|
|
414
308
|
* @param integration
|
|
415
309
|
*/
|
|
416
|
-
function checkPackageJson(projectDir,
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
310
|
+
function checkPackageJson(projectDir, packageName, devDependency = false) {
|
|
311
|
+
const packageJson = fs.readFileSync(`${projectDir}/package.json`, 'utf-8');
|
|
312
|
+
const packageJsonObject = JSON.parse(packageJson);
|
|
313
|
+
const packageVersion = packageJsonObject.dependencies?.[packageName] ||
|
|
314
|
+
(devDependency && packageJsonObject.devDependencies?.[packageName]);
|
|
315
|
+
(0, vitest_1.expect)(packageVersion).toBeTruthy();
|
|
422
316
|
}
|
|
423
317
|
exports.checkPackageJson = checkPackageJson;
|
|
424
318
|
/**
|
|
@@ -452,25 +346,40 @@ exports.checkSentryProperties = checkSentryProperties;
|
|
|
452
346
|
* @param projectDir
|
|
453
347
|
*/
|
|
454
348
|
async function checkIfBuilds(projectDir) {
|
|
455
|
-
const
|
|
349
|
+
const npmRunner = new ProcessRunner('npm', ['run', 'build'], {
|
|
456
350
|
cwd: projectDir,
|
|
457
351
|
});
|
|
458
|
-
const builtSuccessfully = await
|
|
352
|
+
const builtSuccessfully = await npmRunner.waitForStatusCode(0, {
|
|
459
353
|
timeout: 120000,
|
|
460
354
|
});
|
|
461
355
|
(0, vitest_1.expect)(builtSuccessfully).toBe(true);
|
|
462
356
|
}
|
|
463
357
|
exports.checkIfBuilds = checkIfBuilds;
|
|
358
|
+
/**
|
|
359
|
+
* Check if the project lints successfully
|
|
360
|
+
* Runs `npm run lint` and expects status code 0.
|
|
361
|
+
* @param projectDir
|
|
362
|
+
*/
|
|
363
|
+
async function checkIfLints(projectDir) {
|
|
364
|
+
const npmRunner = new ProcessRunner('npm', ['run', 'lint'], {
|
|
365
|
+
cwd: projectDir,
|
|
366
|
+
});
|
|
367
|
+
const lintedSuccessfully = await npmRunner.waitForStatusCode(0, {
|
|
368
|
+
timeout: 120000,
|
|
369
|
+
});
|
|
370
|
+
(0, vitest_1.expect)(lintedSuccessfully).toBe(true);
|
|
371
|
+
}
|
|
372
|
+
exports.checkIfLints = checkIfLints;
|
|
464
373
|
/**
|
|
465
374
|
* Check if the flutter project builds
|
|
466
375
|
* @param projectDir
|
|
467
376
|
*/
|
|
468
377
|
async function checkIfFlutterBuilds(projectDir, expectedOutput, debug = false) {
|
|
469
|
-
const
|
|
378
|
+
const flutterRunner = new ProcessRunner('flutter', ['build', 'web'], {
|
|
470
379
|
cwd: projectDir,
|
|
471
380
|
debug: debug,
|
|
472
381
|
});
|
|
473
|
-
const outputReceived = await
|
|
382
|
+
const outputReceived = await flutterRunner.waitForOutput(expectedOutput, {
|
|
474
383
|
timeout: 120000,
|
|
475
384
|
});
|
|
476
385
|
(0, vitest_1.expect)(outputReceived).toBe(true);
|
|
@@ -511,14 +420,14 @@ async function checkIfReactNativeBundles(projectDir, platform, debug = false) {
|
|
|
511
420
|
'--assets-dest',
|
|
512
421
|
assetsDest,
|
|
513
422
|
];
|
|
514
|
-
const
|
|
423
|
+
const npxRunner = new ProcessRunner('npx', bundleCommandArgs, {
|
|
515
424
|
cwd: projectDir,
|
|
516
425
|
debug: debug,
|
|
517
426
|
});
|
|
518
|
-
const builtSuccessfully = await
|
|
427
|
+
const builtSuccessfully = await npxRunner.waitForStatusCode(0, {
|
|
519
428
|
timeout: 300000,
|
|
520
429
|
});
|
|
521
|
-
|
|
430
|
+
npxRunner.kill();
|
|
522
431
|
return builtSuccessfully;
|
|
523
432
|
}
|
|
524
433
|
exports.checkIfReactNativeBundles = checkIfReactNativeBundles;
|
|
@@ -530,20 +439,15 @@ exports.checkIfReactNativeBundles = checkIfReactNativeBundles;
|
|
|
530
439
|
* @param debug runs the command in debug mode if true
|
|
531
440
|
*/
|
|
532
441
|
async function checkIfExpoBundles(projectDir, platform, debug = false) {
|
|
533
|
-
const exportCommandArgs = [
|
|
534
|
-
|
|
535
|
-
'export',
|
|
536
|
-
'--platform',
|
|
537
|
-
platform,
|
|
538
|
-
];
|
|
539
|
-
const testEnv = new WizardTestEnv('npx', exportCommandArgs, {
|
|
442
|
+
const exportCommandArgs = ['expo', 'export', '--platform', platform];
|
|
443
|
+
const npxRunner = new ProcessRunner('npx', exportCommandArgs, {
|
|
540
444
|
cwd: projectDir,
|
|
541
445
|
debug: debug,
|
|
542
446
|
});
|
|
543
|
-
const builtSuccessfully = await
|
|
447
|
+
const builtSuccessfully = await npxRunner.waitForStatusCode(0, {
|
|
544
448
|
timeout: 300000,
|
|
545
449
|
});
|
|
546
|
-
|
|
450
|
+
npxRunner.kill();
|
|
547
451
|
return builtSuccessfully;
|
|
548
452
|
}
|
|
549
453
|
exports.checkIfExpoBundles = checkIfExpoBundles;
|
|
@@ -553,11 +457,13 @@ exports.checkIfExpoBundles = checkIfExpoBundles;
|
|
|
553
457
|
* @param expectedOutput
|
|
554
458
|
*/
|
|
555
459
|
async function checkIfRunsOnDevMode(projectDir, expectedOutput) {
|
|
556
|
-
const
|
|
557
|
-
|
|
460
|
+
const npmRunner = new ProcessRunner('npm', ['run', 'dev'], {
|
|
461
|
+
cwd: projectDir,
|
|
462
|
+
});
|
|
463
|
+
(0, vitest_1.expect)(await npmRunner.waitForOutput(expectedOutput, {
|
|
558
464
|
timeout: 120000,
|
|
559
465
|
})).toBe(true);
|
|
560
|
-
|
|
466
|
+
npmRunner.kill();
|
|
561
467
|
}
|
|
562
468
|
exports.checkIfRunsOnDevMode = checkIfRunsOnDevMode;
|
|
563
469
|
/**
|
|
@@ -566,13 +472,32 @@ exports.checkIfRunsOnDevMode = checkIfRunsOnDevMode;
|
|
|
566
472
|
* @param expectedOutput
|
|
567
473
|
*/
|
|
568
474
|
async function checkIfRunsOnProdMode(projectDir, expectedOutput, startCommand = 'start') {
|
|
569
|
-
const
|
|
475
|
+
const npmRunner = new ProcessRunner('npm', ['run', startCommand], {
|
|
570
476
|
cwd: projectDir,
|
|
571
477
|
});
|
|
572
|
-
(0, vitest_1.expect)(await
|
|
478
|
+
(0, vitest_1.expect)(await npmRunner.waitForOutput(expectedOutput, {
|
|
573
479
|
timeout: 120000,
|
|
574
480
|
})).toBe(true);
|
|
575
|
-
|
|
481
|
+
npmRunner.kill();
|
|
576
482
|
}
|
|
577
483
|
exports.checkIfRunsOnProdMode = checkIfRunsOnProdMode;
|
|
484
|
+
/**
|
|
485
|
+
* Initialize a git repository in the given directory
|
|
486
|
+
* @param projectDir
|
|
487
|
+
*/
|
|
488
|
+
function initGit(projectDir) {
|
|
489
|
+
try {
|
|
490
|
+
(0, node_child_process_1.execSync)('git init', { cwd: projectDir });
|
|
491
|
+
// Add all files to the git repo
|
|
492
|
+
(0, node_child_process_1.execSync)('git add -A', { cwd: projectDir });
|
|
493
|
+
// Add author info to avoid git commit error
|
|
494
|
+
(0, node_child_process_1.execSync)('git config user.email test@test.sentry.io', { cwd: projectDir });
|
|
495
|
+
(0, node_child_process_1.execSync)('git config user.name Test', { cwd: projectDir });
|
|
496
|
+
(0, node_child_process_1.execSync)('git commit -m init', { cwd: projectDir });
|
|
497
|
+
}
|
|
498
|
+
catch (e) {
|
|
499
|
+
exports.log.error('Error initializing git');
|
|
500
|
+
exports.log.error(e);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
578
503
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../e2e-tests/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAElC,mDAAkD;AAClD,2DAAqD;AAErD,sDAA2D;AAC3D,mCAAgC;AAEnB,QAAA,IAAI,GAAG;IAClB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;CACX,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;IACnE,WAAW,EACT,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,0CAA0C;IAC3E,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,eAAe;IACxD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,mBAAmB;CACrE,CAAC;AAEW,QAAA,GAAG,GAAG;IACjB,OAAO,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,IAAA,eAAK,EAAC,aAAa,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;QACxB,IAAA,aAAG,EAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IAC3B,CAAC;IACD,KAAK,EAAE,CAAC,OAAgB,EAAE,EAAE;QAC1B,SAAS,aAAa,CAAC,OAAgB,EAAE,KAAa;YACpD,IAAI,KAAK,GAAG,CAAC,EAAE;gBACb,OAAO,KAAK,CAAC;aACd;YAED,IAAI,OAAO,YAAY,KAAK,EAAE;gBAC5B,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CAAC;IACf,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAvBD,gDAuBC;AAED;;;;GAIG;AACI,KAAK,UAAU,oBAAoB,CACxC,UAAkB,EAClB,cAAsB;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;IAE9E,IAAA,eAAM,EACJ,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QAC1C,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAbD,oDAaC;AAED;;;;GAIG;AACI,KAAK,UAAU,qBAAqB,CACzC,UAAkB,EAClB,cAAsB,EACtB,YAAY,GAAG,OAAO;IAEtB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE;QAC9D,GAAG,EAAE,UAAU;KAChB,CAAC,CAAC;IAEH,IAAA,eAAM,EACJ,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE;QAC1C,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAhBD,sDAgBC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { Integration } from '../../lib/Constants';\nimport { spawn, execSync } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { dim, green, red } from '../../lib/Helper/Logging';\nimport { expect } from 'vitest';\n\nexport const KEYS = {\n UP: '\\u001b[A',\n DOWN: '\\u001b[B',\n LEFT: '\\u001b[D',\n RIGHT: '\\u001b[C',\n ENTER: '\\r',\n SPACE: ' ',\n};\n\nexport const TEST_ARGS = {\n AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',\n PROJECT_DSN:\n process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',\n ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',\n PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',\n};\n\nexport const log = {\n success: (message: string) => {\n green(`[SUCCESS] ${message}`);\n },\n info: (message: string) => {\n dim(`[INFO] ${message}`);\n },\n error: (message: unknown) => {\n function formatMessage(message: unknown, depth: number): string {\n if (depth > 3) {\n return '...';\n }\n\n if (message instanceof Error) {\n return JSON.stringify(\n {\n name: message.name,\n message: message.message,\n stack: message.stack,\n ...(message.cause\n ? {\n cause: formatMessage(message.cause, depth + 1),\n }\n : {}),\n },\n null,\n 2,\n );\n }\n return String(message);\n }\n red(`[ERROR] ${formatMessage(message, 0)}`);\n },\n};\n\nexport class WizardTestEnv {\n taskHandle: ChildProcess;\n\n constructor(\n cmd: string,\n args: string[],\n opts?: {\n cwd?: string;\n debug?: boolean;\n },\n ) {\n this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });\n\n if (opts?.debug) {\n this.taskHandle.stdout?.pipe(process.stdout);\n this.taskHandle.stderr?.pipe(process.stderr);\n }\n }\n\n sendStdin(input: string) {\n this.taskHandle.stdin?.write(input);\n }\n\n /**\n * Sends the input and waits for the output.\n * @returns a promise that resolves when the output was found\n * @throws an error when the output was not found within the timeout\n */\n sendStdinAndWaitForOutput(\n input: string | string[],\n output: string,\n options?: { timeout?: number; optional?: boolean },\n ) {\n const outputPromise = this.waitForOutput(output, options);\n\n if (Array.isArray(input)) {\n for (const i of input) {\n this.sendStdin(i);\n }\n } else {\n this.sendStdin(input);\n }\n return outputPromise;\n }\n\n /**\n * Waits for the task to exit with a given `statusCode`.\n *\n * @returns a promise that resolves to `true` if the run ends with the status\n * code, or it rejects when the `timeout` was reached.\n */\n waitForStatusCode(\n statusCode: number | null,\n options: {\n /** Timeout in ms */\n timeout?: number;\n } = {},\n ) {\n const { timeout } = {\n timeout: 60_000,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.kill();\n reject(\n new Error(`Timeout waiting for status code: ${statusCode ?? 'null'}`),\n );\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.on('exit', (code: number | null) => {\n clearTimeout(timeoutId);\n resolve(code === statusCode);\n });\n });\n }\n\n /**\n * Waits for the provided output with `.includes()` logic.\n *\n * @returns a promise that resolves to `true` if the output was found, `false` if the output was not found within the\n * timeout and `optional: true` is set, or it rejects when the timeout was reached with `optional: false`\n */\n waitForOutput(\n output: string,\n options: {\n /** Timeout in ms */\n timeout?: number;\n /** Whether to always resolve after the timeout, no matter whether the input was actually found or not. */\n optional?: boolean;\n } = {},\n ) {\n const { timeout, optional } = {\n timeout: 60_000,\n optional: false,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n let outputBuffer = '';\n const timeoutId = setTimeout(() => {\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n\n this.kill();\n if (optional) {\n // The output is not found but it's optional so we can resolve the promise with false\n resolve(false);\n } else {\n reject(\n new Error(\n `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,\n ),\n );\n }\n }, timeout);\n\n const dataListener = (data: string) => {\n outputBuffer += data;\n if (outputBuffer.includes(output)) {\n clearTimeout(timeoutId);\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n // The output is found so we can resolve the promise with true\n resolve(true);\n }\n };\n\n const errorListener = (err: Error) => {\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n clearTimeout(timeoutId);\n reject(err);\n };\n\n this.taskHandle.on('error', errorListener);\n this.taskHandle.stdout?.on('data', dataListener);\n });\n }\n\n kill() {\n this.taskHandle.stdin?.destroy();\n this.taskHandle.stderr?.destroy();\n this.taskHandle.stdout?.destroy();\n this.taskHandle.kill('SIGINT');\n this.taskHandle.unref();\n }\n}\n\n/**\n * Initialize a git repository in the given directory\n * @param projectDir\n */\nexport function initGit(projectDir: string): void {\n try {\n execSync('git init', { cwd: projectDir });\n // Add all files to the git repo\n execSync('git add -A', { cwd: projectDir });\n // Add author info to avoid git commit error\n execSync('git config user.email test@test.sentry.io', { cwd: projectDir });\n execSync('git config user.name Test', { cwd: projectDir });\n execSync('git commit -m init', { cwd: projectDir });\n } catch (e) {\n log.error('Error initializing git');\n log.error(e);\n }\n}\n\n/**\n * Cleanup the git repository in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n * @param projectDir\n */\nexport function cleanupGit(projectDir: string): void {\n try {\n // Remove the .git directory\n execSync(`rm -rf ${projectDir}/.git`);\n } catch (e) {\n log.error('Error cleaning up git');\n log.error(e);\n }\n}\n\n/**\n * Revert local changes in the given directory\n *\n * Caution! Make sure `projectDir` is a test project directory,\n * if in doubt, please commit your local non-test changes first!\n *\n * @param projectDir\n */\nexport function revertLocalChanges(projectDir: string): void {\n try {\n // Check if this is a git repository first\n const isGitRepo = fs.existsSync(path.join(projectDir, '.git'));\n\n if (isGitRepo) {\n // Revert tracked files\n execSync('git restore .', { cwd: projectDir });\n // Revert untracked files\n execSync('git clean -fd .', { cwd: projectDir });\n }\n\n // Remove node_modules and dist (.gitignore'd and therefore not removed via git clean)\n execSync('rm -rf node_modules', { cwd: projectDir });\n execSync('rm -rf dist', { cwd: projectDir });\n } catch (e) {\n log.error('Error reverting local changes');\n log.error(e);\n }\n}\n\nexport function getWizardCommand(integration: Integration): string {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n const args = [\n '--debug',\n '-i',\n integration,\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n '--disable-telemetry',\n ];\n\n return `${binPath} ${args.join(' ')}`;\n}\n\n/**\n * Start the wizard instance with the given integration and project directory\n * @param integration\n * @param projectDir\n *\n * @returns WizardTestEnv\n */\nexport function startWizardInstance(\n integration: Integration,\n projectDir: string,\n debug = false,\n spotlight = false,\n): WizardTestEnv {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n initGit(projectDir);\n\n const args = ['--debug', '-i', integration];\n\n if (spotlight) {\n // Spotlight mode: skip authentication\n args.push('--spotlight');\n } else {\n args.push(\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n );\n }\n\n args.push('--disable-telemetry');\n\n return new WizardTestEnv(binPath, args, { cwd: projectDir, debug });\n}\n\n/**\n * Create a file with the given content\n *\n * @param filePath\n * @param content\n */\nexport function createFile(filePath: string, content?: string) {\n return fs.writeFileSync(filePath, content || '');\n}\n\n/**\n * Modify the file with the new content\n *\n * @param filePath\n * @param oldContent\n * @param newContent\n */\nexport function modifyFile(\n filePath: string,\n replaceMap: Record<string, string>,\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n let newFileContent = fileContent;\n\n for (const [oldContent, newContent] of Object.entries(replaceMap)) {\n newFileContent = newFileContent.replace(oldContent, newContent);\n }\n\n fs.writeFileSync(filePath, newFileContent);\n}\n\n/**\n * Read the file contents and check if it does not contain the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileDoesNotContain(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).not.toContain(c);\n }\n}\n\n/**\n * Read the file contents and check if it contains the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileContents(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).toContain(c);\n }\n}\n\n/**\n * Check if the file exists\n *\n * @param filePath\n */\nexport function checkFileExists(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(true);\n}\n\n/**\n * Check if the file does not exist\n *\n * @param filePath\n */\nexport function checkFileDoesNotExist(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(false);\n}\n\n/**\n * Map integration to its corresponding Sentry package name\n * @param type Integration type\n * @returns Package name or undefined if no package exists\n */\nfunction mapIntegrationToPackageName(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return undefined; // Android doesn't have a JavaScript package\n case Integration.reactNative:\n return '@sentry/react-native';\n case Integration.flutter:\n return undefined; // Flutter doesn't have a JavaScript package\n case Integration.cordova:\n return '@sentry/cordova';\n case Integration.angular:\n return '@sentry/angular';\n case Integration.electron:\n return '@sentry/electron';\n case Integration.nextjs:\n return '@sentry/nextjs';\n case Integration.nuxt:\n return '@sentry/nuxt';\n case Integration.remix:\n return '@sentry/remix';\n case Integration.reactRouter:\n return '@sentry/react-router';\n case Integration.sveltekit:\n return '@sentry/sveltekit';\n case Integration.sourcemaps:\n return undefined; // Sourcemaps doesn't install a package\n case Integration.ios:\n return undefined; // iOS doesn't have a JavaScript package\n default:\n return undefined;\n }\n}\n\n/**\n * Check if the package.json contains the given integration\n *\n * @param projectDir\n * @param integration\n */\nexport function checkPackageJson(projectDir: string, integration: Integration) {\n const packageName = mapIntegrationToPackageName(integration);\n if (!packageName) {\n throw new Error(`No package name found for integration: ${integration}`);\n }\n checkFileContents(`${projectDir}/package.json`, packageName);\n}\n\n/**\n * Check if the .sentryclirc contains the auth token\n *\n * @param projectDir\n */\nexport function checkSentryCliRc(projectDir: string) {\n checkFileContents(\n `${projectDir}/.sentryclirc`,\n `token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the .env.sentry-build-plugin contains the auth token\n * @param projectDir\n */\nexport function checkEnvBuildPlugin(projectDir: string) {\n checkFileContents(\n `${projectDir}/.env.sentry-build-plugin`,\n `SENTRY_AUTH_TOKEN=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the sentry.properties contains the auth token\n * @param projectDir\n */\nexport function checkSentryProperties(projectDir: string) {\n checkFileContents(\n `${projectDir}/sentry.properties`,\n `auth_token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the project builds\n * Check if the project builds and ends with status code 0.\n * @param projectDir\n */\nexport async function checkIfBuilds(projectDir: string) {\n const testEnv = new WizardTestEnv('npm', ['run', 'build'], {\n cwd: projectDir,\n });\n\n const builtSuccessfully = await testEnv.waitForStatusCode(0, {\n timeout: 120_000,\n });\n\n expect(builtSuccessfully).toBe(true);\n}\n\n/**\n * Check if the flutter project builds\n * @param projectDir\n */\nexport async function checkIfFlutterBuilds(\n projectDir: string,\n expectedOutput: string,\n debug = false,\n) {\n const testEnv = new WizardTestEnv('flutter', ['build', 'web'], {\n cwd: projectDir,\n debug: debug,\n });\n\n const outputReceived = await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n });\n\n expect(outputReceived).toBe(true);\n}\n\n/**\n * Check if the React Native project bundles successfully for the specified platform.\n * Returns a boolean indicating if the process exits with status code 0.\n * @param projectDir The root directory of the React Native project.\n * @param platform The platform to bundle for ('ios' or 'android').\n * @param debug runs the command in debug mode if true\n */\nexport async function checkIfReactNativeBundles(\n projectDir: string,\n platform: 'ios' | 'android',\n debug = false,\n): Promise<boolean> {\n const entryFile = 'index.js';\n const dev = 'false'; // Test a production-like bundle\n let bundleOutput: string;\n let assetsDest: string;\n\n if (platform === 'ios') {\n bundleOutput = './ios/main.jsbundle';\n assetsDest = './ios';\n } else {\n // android\n bundleOutput = './android/app/src/main/assets/index.android.bundle';\n assetsDest = './android/app/src/main/res';\n }\n\n const bundleCommandArgs = [\n 'react-native',\n 'bundle',\n '--entry-file',\n entryFile,\n '--platform',\n platform,\n '--dev',\n dev,\n '--bundle-output',\n bundleOutput,\n '--assets-dest',\n assetsDest,\n ];\n\n const testEnv = new WizardTestEnv('npx', bundleCommandArgs, {\n cwd: projectDir,\n debug: debug,\n });\n\n const builtSuccessfully = await testEnv.waitForStatusCode(0, {\n timeout: 300_000,\n });\n\n testEnv.kill();\n\n return builtSuccessfully;\n}\n\n/**\n * Check if the Expo project exports successfully for the specified platform.\n * Returns a boolean indicating if the process exits with status code 0.\n * @param projectDir The root directory of the Expo project.\n * @param platform The platform to export for ('ios', 'android', or 'web').\n * @param debug runs the command in debug mode if true\n */\nexport async function checkIfExpoBundles(\n projectDir: string,\n platform: 'ios' | 'android' | 'web',\n debug = false,\n): Promise<boolean> {\n const exportCommandArgs = [\n 'expo',\n 'export',\n '--platform',\n platform,\n ];\n\n const testEnv = new WizardTestEnv('npx', exportCommandArgs, {\n cwd: projectDir,\n debug: debug,\n });\n\n const builtSuccessfully = await testEnv.waitForStatusCode(0, {\n timeout: 300_000,\n });\n\n testEnv.kill();\n return builtSuccessfully;\n}\n\n/**\n * Check if the project runs on dev mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnDevMode(\n projectDir: string,\n expectedOutput: string,\n) {\n const testEnv = new WizardTestEnv('npm', ['run', 'dev'], { cwd: projectDir });\n\n expect(\n await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n testEnv.kill();\n}\n\n/**\n * Check if the project runs on prod mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnProdMode(\n projectDir: string,\n expectedOutput: string,\n startCommand = 'start',\n) {\n const testEnv = new WizardTestEnv('npm', ['run', startCommand], {\n cwd: projectDir,\n });\n\n expect(\n await testEnv.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n testEnv.kill();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../e2e-tests/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,4CAA8B;AAC9B,gDAAkC;AAGlC,2DAAqD;AAErD,sDAA2D;AAC3D,mCAAgC;AAGnB,QAAA,IAAI,GAAG;IAClB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;CACX,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;IACnE,WAAW,EACT,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,0CAA0C;IAC3E,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,eAAe;IACxD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,mBAAmB;CACrE,CAAC;AAEW,QAAA,GAAG,GAAG;IACjB,OAAO,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,IAAA,eAAK,EAAC,aAAa,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;QACxB,IAAA,aAAG,EAAC,UAAU,OAAO,EAAE,CAAC,CAAC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CAAC;IAEH,IAAA,eAAM,EACJ,MAAM,SAAS,CAAC,aAAa,CAAC,cAAc,EAAE;QAC5C,OAAO,EAAE,MAAO;KACjB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,SAAS,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC;AAhBD,sDAgBC;AAED;;;GAGG;AACH,SAAS,OAAO,CAAC,UAAkB;IACjC,IAAI;QACF,IAAA,6BAAQ,EAAC,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAC1C,gCAAgC;QAChC,IAAA,6BAAQ,EAAC,YAAY,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAC5C,4CAA4C;QAC5C,IAAA,6BAAQ,EAAC,2CAA2C,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAC3E,IAAA,6BAAQ,EAAC,2BAA2B,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAC3D,IAAA,6BAAQ,EAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;KACrD;IAAC,OAAO,CAAC,EAAE;QACV,WAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACpC,WAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACd;AACH,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\nimport { Integration } from '../../lib/Constants';\nimport { spawn, execSync } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { dim, green, red } from '../../lib/Helper/Logging';\nimport { expect } from 'vitest';\nimport { PackageDotJson } from '../../src/utils/package-json';\n\nexport const KEYS = {\n UP: '\\u001b[A',\n DOWN: '\\u001b[B',\n LEFT: '\\u001b[D',\n RIGHT: '\\u001b[C',\n ENTER: '\\r',\n SPACE: ' ',\n};\n\nexport const TEST_ARGS = {\n AUTH_TOKEN: process.env.SENTRY_TEST_AUTH_TOKEN || 'TEST_AUTH_TOKEN',\n PROJECT_DSN:\n process.env.SENTRY_TEST_DSN || 'https://public@dsn.ingest.sentry.io/1337',\n ORG_SLUG: process.env.SENTRY_TEST_ORG || 'TEST_ORG_SLUG',\n PROJECT_SLUG: process.env.SENTRY_TEST_PROJECT || 'TEST_PROJECT_SLUG',\n};\n\nexport const log = {\n success: (message: string) => {\n green(`[SUCCESS] ${message}`);\n },\n info: (message: string) => {\n dim(`[INFO] ${message}`);\n },\n error: (message: unknown) => {\n function formatMessage(message: unknown, depth: number): string {\n if (depth > 3) {\n return '...';\n }\n\n if (message instanceof Error) {\n return JSON.stringify(\n {\n name: message.name,\n message: message.message,\n stack: message.stack,\n ...(message.cause\n ? {\n cause: formatMessage(message.cause, depth + 1),\n }\n : {}),\n },\n null,\n 2,\n );\n }\n return String(message);\n }\n red(`[ERROR] ${formatMessage(message, 0)}`);\n },\n};\n\n/**\n * Creates an isolated test environment by copying a test application to a temporary directory.\n * Each call creates a NEW unique temporary directory, allowing multiple isolated environments\n * per test file (useful for tests that run the wizard multiple times with different configs).\n *\n * @param testAppName - Name of the test application folder (e.g., 'nextjs-16-test-app')\n * @returns Object with projectDir path and cleanup function\n */\nexport function createIsolatedTestEnv(testAppName: string): {\n projectDir: string;\n cleanup: () => void;\n} {\n const sourceDir = path.resolve(\n __dirname,\n '../test-applications',\n testAppName,\n );\n const tmpBaseDir = path.join(os.tmpdir(), 'sentry-wizard-e2e');\n\n if (!fs.existsSync(tmpBaseDir)) {\n fs.mkdirSync(tmpBaseDir, { recursive: true });\n }\n\n const projectDir = fs.mkdtempSync(path.join(tmpBaseDir, `${testAppName}-`));\n\n log.info(`Created isolated test env at: ${projectDir}`);\n\n try {\n fs.cpSync(sourceDir, projectDir, { recursive: true });\n } catch (e) {\n log.error('Error copying test application');\n log.error(e);\n throw e;\n }\n\n initGit(projectDir);\n\n const cleanup = () => {\n try {\n const keepOnFailure = process.env.SENTRY_WIZARD_E2E_KEEP_TEMP === 'true';\n\n if (keepOnFailure) {\n log.info(`Keeping temp directory for debugging: ${projectDir}`);\n } else {\n fs.rmSync(projectDir, { recursive: true, force: true });\n log.info(`Cleaned up isolated test env: ${projectDir}`);\n }\n } catch (e) {\n log.error(`Error cleaning up test environment at ${projectDir}`);\n log.error(e);\n }\n };\n\n return { projectDir, cleanup };\n}\n\nexport class ProcessRunner {\n taskHandle: ChildProcess;\n\n constructor(\n cmd: string,\n args: string[],\n opts?: {\n cwd?: string;\n debug?: boolean;\n },\n ) {\n this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });\n\n if (opts?.debug) {\n this.taskHandle.stdout?.pipe(process.stdout);\n this.taskHandle.stderr?.pipe(process.stderr);\n }\n }\n\n /**\n * Waits for the task to exit with a given `statusCode`.\n *\n * @returns a promise that resolves to `true` if the run ends with the status\n * code, or it rejects when the `timeout` was reached.\n */\n waitForStatusCode(\n statusCode: number | null,\n options: {\n /** Timeout in ms */\n timeout?: number;\n } = {},\n ) {\n const { timeout } = {\n timeout: 60_000,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.kill();\n reject(\n new Error(`Timeout waiting for status code: ${statusCode ?? 'null'}`),\n );\n }, timeout);\n\n this.taskHandle.on('error', (err: Error) => {\n clearTimeout(timeoutId);\n reject(err);\n });\n\n this.taskHandle.on('exit', (code: number | null) => {\n clearTimeout(timeoutId);\n resolve(code === statusCode);\n });\n });\n }\n\n /**\n * Waits for the provided output with `.includes()` logic.\n *\n * @returns a promise that resolves to `true` if the output was found, `false` if the output was not found within the\n * timeout and `optional: true` is set, or it rejects when the timeout was reached with `optional: false`\n */\n waitForOutput(\n output: string,\n options: {\n /** Timeout in ms */\n timeout?: number;\n /** Whether to always resolve after the timeout, no matter whether the input was actually found or not. */\n optional?: boolean;\n } = {},\n ) {\n const { timeout, optional } = {\n timeout: 60_000,\n optional: false,\n ...options,\n };\n\n return new Promise<boolean>((resolve, reject) => {\n let outputBuffer = '';\n const timeoutId = setTimeout(() => {\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n\n this.kill();\n if (optional) {\n // The output is not found but it's optional so we can resolve the promise with false\n resolve(false);\n } else {\n reject(\n new Error(\n `Timeout waiting for output: ${output}. Got the following instead: ${outputBuffer}`,\n ),\n );\n }\n }, timeout);\n\n const dataListener = (data: string) => {\n outputBuffer += data;\n if (outputBuffer.includes(output)) {\n clearTimeout(timeoutId);\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n // The output is found so we can resolve the promise with true\n resolve(true);\n }\n };\n\n const errorListener = (err: Error) => {\n this.taskHandle.off('error', errorListener);\n this.taskHandle.stdout?.off('data', dataListener);\n clearTimeout(timeoutId);\n reject(err);\n };\n\n this.taskHandle.on('error', errorListener);\n this.taskHandle.stdout?.on('data', dataListener);\n });\n }\n\n kill() {\n this.taskHandle.stdin?.destroy();\n this.taskHandle.stderr?.destroy();\n this.taskHandle.stdout?.destroy();\n this.taskHandle.kill('SIGINT');\n this.taskHandle.unref();\n }\n}\n\nexport function getWizardCommand(integration: Integration): string {\n const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN\n ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]\n : ['dist', 'bin.js'];\n const binPath = path.join(__dirname, '..', '..', ...binName);\n\n const args = [\n '--debug',\n '-i',\n integration,\n '--preSelectedProject.authToken',\n TEST_ARGS.AUTH_TOKEN,\n '--preSelectedProject.dsn',\n TEST_ARGS.PROJECT_DSN,\n '--preSelectedProject.orgSlug',\n TEST_ARGS.ORG_SLUG,\n '--preSelectedProject.projectSlug',\n TEST_ARGS.PROJECT_SLUG,\n '--disable-telemetry',\n ];\n\n return `${binPath} ${args.join(' ')}`;\n}\n\n/**\n * Create a file with the given content\n *\n * @param filePath\n * @param content\n */\nexport function createFile(filePath: string, content?: string) {\n return fs.writeFileSync(filePath, content || '');\n}\n\n/**\n * Modify the file with the new content\n *\n * @param filePath\n * @param oldContent\n * @param newContent\n */\nexport function modifyFile(\n filePath: string,\n replaceMap: Record<string, string>,\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n let newFileContent = fileContent;\n\n for (const [oldContent, newContent] of Object.entries(replaceMap)) {\n newFileContent = newFileContent.replace(oldContent, newContent);\n }\n\n fs.writeFileSync(filePath, newFileContent);\n}\n\n/**\n * Read the file contents and check if it does not contain the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileDoesNotContain(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n\n for (const c of contentArray) {\n expect(fileContent).not.toContain(c);\n }\n}\n\n/**\n * Read the file contents and check if it contains the given content\n *\n * @param {string} filePath\n * @param {(string | string[])} content\n */\nexport function checkFileContents(\n filePath: string,\n content: string | string[],\n) {\n const fileContent = fs.readFileSync(filePath, 'utf-8');\n const contentArray = Array.isArray(content) ? content : [content];\n for (const c of contentArray) {\n expect(fileContent).toContain(c);\n }\n}\n\n/**\n * Check if the file exists\n *\n * @param filePath\n */\nexport function checkFileExists(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(true);\n}\n\n/**\n * Check if the file does not exist\n *\n * @param filePath\n */\nexport function checkFileDoesNotExist(filePath: string) {\n expect(fs.existsSync(filePath)).toBe(false);\n}\n\n/**\n * Check if the package.json lists the given package as a dependency or dev dependency\n *\n * @param projectDir\n * @param integration\n */\nexport function checkPackageJson(\n projectDir: string,\n packageName: string,\n devDependency = false,\n) {\n const packageJson = fs.readFileSync(`${projectDir}/package.json`, 'utf-8');\n const packageJsonObject = JSON.parse(packageJson) as PackageDotJson;\n\n const packageVersion =\n packageJsonObject.dependencies?.[packageName] ||\n (devDependency && packageJsonObject.devDependencies?.[packageName]);\n\n expect(packageVersion).toBeTruthy();\n}\n\n/**\n * Check if the .sentryclirc contains the auth token\n *\n * @param projectDir\n */\nexport function checkSentryCliRc(projectDir: string) {\n checkFileContents(\n `${projectDir}/.sentryclirc`,\n `token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the .env.sentry-build-plugin contains the auth token\n * @param projectDir\n */\nexport function checkEnvBuildPlugin(projectDir: string) {\n checkFileContents(\n `${projectDir}/.env.sentry-build-plugin`,\n `SENTRY_AUTH_TOKEN=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the sentry.properties contains the auth token\n * @param projectDir\n */\nexport function checkSentryProperties(projectDir: string) {\n checkFileContents(\n `${projectDir}/sentry.properties`,\n `auth_token=${TEST_ARGS.AUTH_TOKEN}`,\n );\n}\n\n/**\n * Check if the project builds\n * Check if the project builds and ends with status code 0.\n * @param projectDir\n */\nexport async function checkIfBuilds(projectDir: string) {\n const npmRunner = new ProcessRunner('npm', ['run', 'build'], {\n cwd: projectDir,\n });\n\n const builtSuccessfully = await npmRunner.waitForStatusCode(0, {\n timeout: 120_000,\n });\n\n expect(builtSuccessfully).toBe(true);\n}\n\n/**\n * Check if the project lints successfully\n * Runs `npm run lint` and expects status code 0.\n * @param projectDir\n */\nexport async function checkIfLints(projectDir: string) {\n const npmRunner = new ProcessRunner('npm', ['run', 'lint'], {\n cwd: projectDir,\n });\n\n const lintedSuccessfully = await npmRunner.waitForStatusCode(0, {\n timeout: 120_000,\n });\n\n expect(lintedSuccessfully).toBe(true);\n}\n\n/**\n * Check if the flutter project builds\n * @param projectDir\n */\nexport async function checkIfFlutterBuilds(\n projectDir: string,\n expectedOutput: string,\n debug = false,\n) {\n const flutterRunner = new ProcessRunner('flutter', ['build', 'web'], {\n cwd: projectDir,\n debug: debug,\n });\n\n const outputReceived = await flutterRunner.waitForOutput(expectedOutput, {\n timeout: 120_000,\n });\n\n expect(outputReceived).toBe(true);\n}\n\n/**\n * Check if the React Native project bundles successfully for the specified platform.\n * Returns a boolean indicating if the process exits with status code 0.\n * @param projectDir The root directory of the React Native project.\n * @param platform The platform to bundle for ('ios' or 'android').\n * @param debug runs the command in debug mode if true\n */\nexport async function checkIfReactNativeBundles(\n projectDir: string,\n platform: 'ios' | 'android',\n debug = false,\n): Promise<boolean> {\n const entryFile = 'index.js';\n const dev = 'false'; // Test a production-like bundle\n let bundleOutput: string;\n let assetsDest: string;\n\n if (platform === 'ios') {\n bundleOutput = './ios/main.jsbundle';\n assetsDest = './ios';\n } else {\n // android\n bundleOutput = './android/app/src/main/assets/index.android.bundle';\n assetsDest = './android/app/src/main/res';\n }\n\n const bundleCommandArgs = [\n 'react-native',\n 'bundle',\n '--entry-file',\n entryFile,\n '--platform',\n platform,\n '--dev',\n dev,\n '--bundle-output',\n bundleOutput,\n '--assets-dest',\n assetsDest,\n ];\n\n const npxRunner = new ProcessRunner('npx', bundleCommandArgs, {\n cwd: projectDir,\n debug: debug,\n });\n\n const builtSuccessfully = await npxRunner.waitForStatusCode(0, {\n timeout: 300_000,\n });\n\n npxRunner.kill();\n\n return builtSuccessfully;\n}\n\n/**\n * Check if the Expo project exports successfully for the specified platform.\n * Returns a boolean indicating if the process exits with status code 0.\n * @param projectDir The root directory of the Expo project.\n * @param platform The platform to export for ('ios', 'android', or 'web').\n * @param debug runs the command in debug mode if true\n */\nexport async function checkIfExpoBundles(\n projectDir: string,\n platform: 'ios' | 'android' | 'web',\n debug = false,\n): Promise<boolean> {\n const exportCommandArgs = ['expo', 'export', '--platform', platform];\n\n const npxRunner = new ProcessRunner('npx', exportCommandArgs, {\n cwd: projectDir,\n debug: debug,\n });\n\n const builtSuccessfully = await npxRunner.waitForStatusCode(0, {\n timeout: 300_000,\n });\n\n npxRunner.kill();\n return builtSuccessfully;\n}\n\n/**\n * Check if the project runs on dev mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnDevMode(\n projectDir: string,\n expectedOutput: string,\n) {\n const npmRunner = new ProcessRunner('npm', ['run', 'dev'], {\n cwd: projectDir,\n });\n\n expect(\n await npmRunner.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n npmRunner.kill();\n}\n\n/**\n * Check if the project runs on prod mode\n * @param projectDir\n * @param expectedOutput\n */\nexport async function checkIfRunsOnProdMode(\n projectDir: string,\n expectedOutput: string,\n startCommand = 'start',\n) {\n const npmRunner = new ProcessRunner('npm', ['run', startCommand], {\n cwd: projectDir,\n });\n\n expect(\n await npmRunner.waitForOutput(expectedOutput, {\n timeout: 120_000,\n }),\n ).toBe(true);\n\n npmRunner.kill();\n}\n\n/**\n * Initialize a git repository in the given directory\n * @param projectDir\n */\nfunction initGit(projectDir: string): void {\n try {\n execSync('git init', { cwd: projectDir });\n // Add all files to the git repo\n execSync('git add -A', { cwd: projectDir });\n // Add author info to avoid git commit error\n execSync('git config user.email test@test.sentry.io', { cwd: projectDir });\n execSync('git config user.name Test', { cwd: projectDir });\n execSync('git commit -m init', { cwd: projectDir });\n } catch (e) {\n log.error('Error initializing git');\n log.error(e);\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const dirname = new URL('.', import.meta.url).pathname;
|
|
5
|
+
const tests = readdirSync(join(dirname, '../e2e-tests/tests'));
|
|
6
|
+
|
|
7
|
+
const matrixValues = tests
|
|
8
|
+
.filter((test) => test.endsWith('.test.ts'))
|
|
9
|
+
.map((test) => test.replace('.test.ts', ''));
|
|
10
|
+
|
|
11
|
+
console.log(JSON.stringify(matrixValues));
|
package/dist/lib/Constants.d.ts
CHANGED
package/dist/lib/Constants.js
CHANGED
|
@@ -10,6 +10,7 @@ var Integration;
|
|
|
10
10
|
Integration["android"] = "android";
|
|
11
11
|
Integration["cordova"] = "cordova";
|
|
12
12
|
Integration["angular"] = "angular";
|
|
13
|
+
Integration["cloudflare"] = "cloudflare";
|
|
13
14
|
Integration["electron"] = "electron";
|
|
14
15
|
Integration["nextjs"] = "nextjs";
|
|
15
16
|
Integration["nuxt"] = "nuxt";
|
|
@@ -65,6 +66,8 @@ function getIntegrationDescription(type) {
|
|
|
65
66
|
return 'Configure Source Maps Upload';
|
|
66
67
|
case Integration.ios:
|
|
67
68
|
return 'iOS';
|
|
69
|
+
case Integration.cloudflare:
|
|
70
|
+
return 'Cloudflare';
|
|
68
71
|
default:
|
|
69
72
|
return 'React Native';
|
|
70
73
|
}
|
|
@@ -94,6 +97,8 @@ function mapIntegrationToPlatform(type) {
|
|
|
94
97
|
return 'javascript-sveltekit';
|
|
95
98
|
case Integration.sourcemaps:
|
|
96
99
|
return undefined;
|
|
100
|
+
case Integration.cloudflare:
|
|
101
|
+
return 'node-cloudflare-workers';
|
|
97
102
|
case Integration.ios:
|
|
98
103
|
return 'iOS';
|
|
99
104
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,0CAA2B,CAAA;IAC3B,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;AAC3B,CAAC,EAfW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAetB;AAED,wCAAwC;AACxC,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA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wBAAwB,CAAC,IAAY;IACnD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,oBAAoB,CAAC;QAC9B,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,yBAAyB,CAAC;QACnC,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,yBAAyB,CAAC;QACnC,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;KAClD;AACH,CAAC;AA/BD,4DA+BC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAkBY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n flutter = 'flutter',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n angular = 'angular',\n cloudflare = 'cloudflare',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n reactRouter = 'reactRouter',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): Array<{\n checked: boolean;\n name: string;\n value: string;\n}> {\n return Object.keys(Platform).map((platform) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.flutter:\n return 'Flutter';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.reactRouter:\n return 'React Router (framework)';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n case Integration.cloudflare:\n return 'Cloudflare';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.flutter:\n return 'flutter';\n case Integration.cordova:\n return 'cordova';\n case Integration.angular:\n return 'javascript-angular';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.reactRouter:\n return 'javascript-react-router';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.cloudflare:\n return 'node-cloudflare-workers';\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
|