@sentry/wizard 5.0.0 → 5.2.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.d.ts +1 -0
  3. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js +91 -0
  4. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js.map +1 -0
  5. package/dist/e2e-tests/tests/expo.test.js +19 -9
  6. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  7. package/dist/e2e-tests/tests/nextjs-14.test.js +27 -0
  8. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  9. package/dist/e2e-tests/tests/react-native.test.js +19 -13
  10. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  11. package/dist/e2e-tests/utils/index.d.ts +17 -0
  12. package/dist/e2e-tests/utils/index.js +94 -1
  13. package/dist/e2e-tests/utils/index.js.map +1 -1
  14. package/dist/src/nextjs/nextjs-wizard.js +38 -20
  15. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  16. package/dist/src/nextjs/templates.d.ts +9 -2
  17. package/dist/src/nextjs/templates.js +70 -15
  18. package/dist/src/nextjs/templates.js.map +1 -1
  19. package/dist/src/nextjs/utils.d.ts +2 -0
  20. package/dist/src/nextjs/utils.js +42 -1
  21. package/dist/src/nextjs/utils.js.map +1 -1
  22. package/dist/src/nuxt/templates.js +29 -12
  23. package/dist/src/nuxt/templates.js.map +1 -1
  24. package/dist/src/remix/sdk-example.js +20 -5
  25. package/dist/src/remix/sdk-example.js.map +1 -1
  26. package/dist/src/sourcemaps/sourcemaps-wizard.js +14 -0
  27. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  28. package/dist/src/sourcemaps/tools/wrangler.d.ts +28 -0
  29. package/dist/src/sourcemaps/tools/wrangler.js +276 -0
  30. package/dist/src/sourcemaps/tools/wrangler.js.map +1 -0
  31. package/dist/src/sourcemaps/utils/detect-tool.d.ts +1 -1
  32. package/dist/src/sourcemaps/utils/detect-tool.js +1 -0
  33. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  34. package/dist/src/sveltekit/templates.js +13 -6
  35. package/dist/src/sveltekit/templates.js.map +1 -1
  36. package/dist/src/utils/clack/index.d.ts +9 -1
  37. package/dist/src/utils/clack/index.js +8 -1
  38. package/dist/src/utils/clack/index.js.map +1 -1
  39. package/dist/src/version.d.ts +1 -1
  40. package/dist/src/version.js +1 -1
  41. package/dist/src/version.js.map +1 -1
  42. package/dist/test/nextjs/templates.test.js +176 -0
  43. package/dist/test/nextjs/templates.test.js.map +1 -1
  44. package/dist/test/nextjs/utils.test.d.ts +1 -0
  45. package/dist/test/nextjs/utils.test.js +104 -0
  46. package/dist/test/nextjs/utils.test.js.map +1 -0
  47. package/dist/test/sourcemaps/tools/wrangler.test.d.ts +1 -0
  48. package/dist/test/sourcemaps/tools/wrangler.test.js +132 -0
  49. package/dist/test/sourcemaps/tools/wrangler.test.js.map +1 -0
  50. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0
4
+
5
+ - fix(nextjs): Update jsx/tsx snippets ([#1015](https://github.com/getsentry/sentry-wizard/pull/1015))
6
+ - feat(nextjs): deactivate error button when adblocker is detected ([#1010](https://github.com/getsentry/sentry-wizard/pull/1010))
7
+ - feat(remix): deactivate error button when adblocker is detected ([#1017](https://github.com/getsentry/sentry-wizard/pull/1017))
8
+ - feat(sveltekit): deactivate error button when adblocker is detected ([#1018](https://github.com/getsentry/sentry-wizard/pull/1018))
9
+ - feat(nuxt): deactivate error button when adblocker is detected ([#1019](https://github.com/getsentry/sentry-wizard/pull/1019))
10
+
11
+ ## 5.1.0
12
+
13
+ - feat(nextjs): Add template for generateMetadata in App router for next@14 ([#1003](https://github.com/getsentry/sentry-wizard/pull/1003))
14
+ - feat(sourcemaps): Add Cloudflare Wrangler Tool Flow ([#999](https://github.com/getsentry/sentry-wizard/pull/999))
15
+
3
16
  ## 5.0.0
4
17
 
5
18
  ### Breaking changes
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const vitest_1 = require("vitest");
30
+ const utils_1 = require("../utils");
31
+ const Constants_1 = require("../../lib/Constants");
32
+ const path = __importStar(require("path"));
33
+ const fs_1 = __importDefault(require("fs"));
34
+ //@ts-expect-error - clifty is ESM only
35
+ const clifty_1 = require("clifty");
36
+ (0, vitest_1.describe)('Cloudflare-Wrangler-Sourcemaps-Wizard', () => {
37
+ const projectDir = path.resolve(__dirname, '../test-applications/cloudflare-wrangler-sourcemaps-test-app');
38
+ let wizardExitCode;
39
+ (0, vitest_1.beforeAll)(async () => {
40
+ (0, utils_1.initGit)(projectDir);
41
+ (0, utils_1.revertLocalChanges)(projectDir);
42
+ wizardExitCode = await (0, clifty_1.withEnv)({ cwd: projectDir })
43
+ .defineInteraction()
44
+ .step('intro', ({ expectOutput }) => {
45
+ expectOutput('This wizard will help you upload source maps to Sentry');
46
+ })
47
+ .step('select wrangler', ({ expectOutput, whenAsked }) => {
48
+ whenAsked('Which framework, bundler or build tool are you using?').respondWith(clifty_1.KEYS.ENTER);
49
+ expectOutput('Before we get started');
50
+ expectOutput('We recommend using Vite to build your worker instead');
51
+ whenAsked('want to proceed with the Wrangler setup').respondWith(clifty_1.KEYS.ENTER);
52
+ })
53
+ .step('configure source maps upload', ({ expectOutput, whenAsked }) => {
54
+ expectOutput('Installing @sentry/cli');
55
+ whenAsked('Is yarn deploy your build and deploy command?', {
56
+ timeout: 60000, // give CI some time to install @sentry/cli
57
+ }).respondWith(clifty_1.KEYS.ENTER);
58
+ expectOutput('Added a sentry:sourcemaps script to your package.json');
59
+ expectOutput('Added a postdeploy script to your package.json');
60
+ expectOutput('Modified your deploy script to enable uploading source maps');
61
+ expectOutput('Added auth token to .sentryclirc for you to test uploading source maps locally');
62
+ expectOutput('Created .sentryclirc');
63
+ })
64
+ .step('add auth token to CI/CD (skipped)', ({ whenAsked }) => {
65
+ whenAsked('Are you using a CI/CD tool to build and deploy your application?').respondWith(clifty_1.KEYS.DOWN, clifty_1.KEYS.ENTER); // no
66
+ })
67
+ .expectOutput("That's it")
68
+ .run((0, utils_1.getWizardCommand)(Constants_1.Integration.sourcemaps));
69
+ }, 60000);
70
+ (0, vitest_1.afterAll)(() => {
71
+ (0, utils_1.revertLocalChanges)(projectDir);
72
+ (0, utils_1.cleanupGit)(projectDir);
73
+ });
74
+ (0, vitest_1.it)('exits with exit code 0', () => {
75
+ (0, vitest_1.expect)(wizardExitCode).toBe(0);
76
+ });
77
+ (0, vitest_1.it)('adds and adjusts the respective package.json scripts', () => {
78
+ const pkgJson = JSON.parse(fs_1.default.readFileSync(path.join(projectDir, 'package.json'), 'utf8'));
79
+ (0, vitest_1.expect)(pkgJson?.scripts?.['sentry:sourcemaps']).toEqual(`_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=${utils_1.TEST_ARGS.ORG_SLUG} --project=${utils_1.TEST_ARGS.PROJECT_SLUG} && sentry-cli sourcemaps upload --org=${utils_1.TEST_ARGS.ORG_SLUG} --project=${utils_1.TEST_ARGS.PROJECT_SLUG} --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist`);
80
+ (0, vitest_1.expect)(pkgJson?.scripts?.['postdeploy']).toEqual('yarn sentry:sourcemaps');
81
+ (0, vitest_1.expect)(pkgJson?.scripts?.['deploy']).toEqual('wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
82
+ });
83
+ (0, vitest_1.it)('adds sentry-cli as a devDependency', () => {
84
+ const pkgJson = JSON.parse(fs_1.default.readFileSync(path.join(projectDir, 'package.json'), 'utf8'));
85
+ (0, vitest_1.expect)(pkgJson?.devDependencies?.['@sentry/cli']).toBeDefined();
86
+ });
87
+ (0, vitest_1.it)('adds a .sentryclirc file', () => {
88
+ (0, utils_1.checkSentryCliRc)(projectDir);
89
+ });
90
+ });
91
+ //# sourceMappingURL=cloudflare-wrangler-sourcemaps.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare-wrangler-sourcemaps.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAmE;AACnE,oCAOkB;AAClB,mDAAkD;AAClD,2CAA6B;AAC7B,4CAAoB;AACpB,uCAAuC;AACvC,mCAAuC;AAGvC,IAAA,iBAAQ,EAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7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,CAAC,OAAO,CAC1C,gHAAgH,CACjH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC7C,CAAC;QAEpB,IAAA,eAAM,EAAC,OAAO,EAAE,eAAe,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,IAAA,wBAAgB,EAAC,UAAU,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { afterAll, beforeAll, describe, expect, it } from 'vitest';\nimport {\n checkSentryCliRc,\n cleanupGit,\n getWizardCommand,\n initGit,\n revertLocalChanges,\n TEST_ARGS,\n} from '../utils';\nimport { Integration } from '../../lib/Constants';\nimport * as path from 'path';\nimport fs from 'fs';\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\nimport { PackageDotJson } from '../../src/utils/package-json';\n\ndescribe('Cloudflare-Wrangler-Sourcemaps-Wizard', () => {\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/cloudflare-wrangler-sourcemaps-test-app',\n );\n\n let wizardExitCode: number;\n\n beforeAll(async () => {\n initGit(projectDir);\n revertLocalChanges(projectDir);\n\n wizardExitCode = await withEnv({ cwd: projectDir })\n .defineInteraction()\n .step('intro', ({ expectOutput }) => {\n expectOutput('This wizard will help you upload source maps to Sentry');\n })\n .step('select wrangler', ({ expectOutput, whenAsked }) => {\n whenAsked(\n 'Which framework, bundler or build tool are you using?',\n ).respondWith(KEYS.ENTER);\n\n expectOutput('Before we get started');\n expectOutput('We recommend using Vite to build your worker instead');\n whenAsked('want to proceed with the Wrangler setup').respondWith(\n KEYS.ENTER,\n );\n })\n .step('configure source maps upload', ({ expectOutput, whenAsked }) => {\n expectOutput('Installing @sentry/cli');\n whenAsked('Is yarn deploy your build and deploy command?', {\n timeout: 60_000, // give CI some time to install @sentry/cli\n }).respondWith(KEYS.ENTER);\n expectOutput('Added a sentry:sourcemaps script to your package.json');\n expectOutput('Added a postdeploy script to your package.json');\n expectOutput(\n 'Modified your deploy script to enable uploading source maps',\n );\n expectOutput(\n 'Added auth token to .sentryclirc for you to test uploading source maps locally',\n );\n expectOutput('Created .sentryclirc');\n })\n .step('add auth token to CI/CD (skipped)', ({ whenAsked }) => {\n whenAsked(\n 'Are you using a CI/CD tool to build and deploy your application?',\n ).respondWith(KEYS.DOWN, KEYS.ENTER); // no\n })\n .expectOutput(\"That's it\")\n .run(getWizardCommand(Integration.sourcemaps));\n }, 60_000);\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds and adjusts the respective package.json scripts', () => {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(projectDir, 'package.json'), 'utf8'),\n ) as PackageDotJson;\n\n expect(pkgJson?.scripts?.['sentry:sourcemaps']).toEqual(\n `_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=${TEST_ARGS.ORG_SLUG} --project=${TEST_ARGS.PROJECT_SLUG} && sentry-cli sourcemaps upload --org=${TEST_ARGS.ORG_SLUG} --project=${TEST_ARGS.PROJECT_SLUG} --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist`,\n );\n expect(pkgJson?.scripts?.['postdeploy']).toEqual('yarn sentry:sourcemaps');\n expect(pkgJson?.scripts?.['deploy']).toEqual(\n 'wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it('adds sentry-cli as a devDependency', () => {\n const pkgJson = JSON.parse(\n fs.readFileSync(path.join(projectDir, 'package.json'), 'utf8'),\n ) as PackageDotJson;\n\n expect(pkgJson?.devDependencies?.['@sentry/cli']).toBeDefined();\n });\n\n it('adds a .sentryclirc file', () => {\n checkSentryCliRc(projectDir);\n });\n});\n"]}
@@ -26,14 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const path = __importStar(require("node:path"));
27
27
  const Constants_1 = require("../../lib/Constants");
28
28
  const utils_1 = require("../utils");
29
- const utils_2 = require("../utils");
30
- const utils_3 = require("../utils");
31
29
  const vitest_1 = require("vitest");
32
30
  (0, vitest_1.describe)('Expo', () => {
33
31
  const integration = Constants_1.Integration.reactNative;
34
32
  const projectDir = path.resolve(__dirname, '../test-applications/react-native-expo-test-app');
35
33
  (0, vitest_1.beforeAll)(async () => {
36
- const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
34
+ const wizardInstance = (0, utils_1.startWizardInstance)(integration, projectDir);
37
35
  const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
38
36
  const sessionReplayPrompted = packageManagerPrompted &&
39
37
  (await wizardInstance.sendStdinAndWaitForOutput(
@@ -58,10 +56,10 @@ const vitest_1 = require("vitest");
58
56
  (0, utils_1.cleanupGit)(projectDir);
59
57
  });
60
58
  (0, vitest_1.test)('package.json is updated correctly', () => {
61
- (0, utils_3.checkFileContents)(`${projectDir}/package.json`, `@sentry/react-native`);
59
+ (0, utils_1.checkFileContents)(`${projectDir}/package.json`, `@sentry/react-native`);
62
60
  });
63
61
  (0, vitest_1.test)('_layout.tsx is updated correctly', () => {
64
- (0, utils_3.checkFileContents)(`${projectDir}/app/_layout.tsx`, `import * as Sentry from '@sentry/react-native';
62
+ (0, utils_1.checkFileContents)(`${projectDir}/app/_layout.tsx`, `import * as Sentry from '@sentry/react-native';
65
63
 
66
64
  Sentry.init({
67
65
  dsn: 'https://public@dsn.ingest.sentry.io/1337',
@@ -78,10 +76,10 @@ Sentry.init({
78
76
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
79
77
  // spotlight: __DEV__,
80
78
  });`);
81
- (0, utils_3.checkFileContents)(`${projectDir}/app/_layout.tsx`, `export default Sentry.wrap(function RootLayout() {`);
79
+ (0, utils_1.checkFileContents)(`${projectDir}/app/_layout.tsx`, `export default Sentry.wrap(function RootLayout() {`);
82
80
  });
83
81
  (0, vitest_1.test)('app.json is updated correctly', () => {
84
- (0, utils_3.checkFileContents)(`${projectDir}/app.json`, `"@sentry/react-native/expo",
82
+ (0, utils_1.checkFileContents)(`${projectDir}/app.json`, `"@sentry/react-native/expo",
85
83
  {
86
84
  "url": "https://sentry.io/",
87
85
  "project": "${utils_1.TEST_ARGS.PROJECT_SLUG}",
@@ -90,14 +88,26 @@ Sentry.init({
90
88
  });
91
89
  (0, vitest_1.test)('metro.config.js is added', () => {
92
90
  (0, utils_1.checkFileExists)(`${projectDir}/metro.config.js`);
93
- (0, utils_3.checkFileContents)(`${projectDir}/metro.config.js`, `const { getSentryExpoConfig } = require("@sentry/react-native/metro");
91
+ (0, utils_1.checkFileContents)(`${projectDir}/metro.config.js`, `const { getSentryExpoConfig } = require("@sentry/react-native/metro");
94
92
 
95
93
  const config = getSentryExpoConfig(__dirname);
96
94
 
97
95
  module.exports = config;`);
98
96
  });
99
97
  (0, vitest_1.test)('.gitignore is updated correctly', () => {
100
- (0, utils_3.checkFileContents)(`${projectDir}/.gitignore`, `.env.local`);
98
+ (0, utils_1.checkFileContents)(`${projectDir}/.gitignore`, `.env.local`);
99
+ });
100
+ (0, vitest_1.test)('android project is bundled correctly', async () => {
101
+ const bundled = await (0, utils_1.checkIfExpoBundles)(projectDir, 'android');
102
+ (0, vitest_1.expect)(bundled).toBe(true);
103
+ });
104
+ (0, vitest_1.test)('ios project is bundled correctly', async () => {
105
+ const bundled = await (0, utils_1.checkIfExpoBundles)(projectDir, 'ios');
106
+ (0, vitest_1.expect)(bundled).toBe(true);
107
+ });
108
+ (0, vitest_1.test)('web project is bundled correctly', async () => {
109
+ const bundled = await (0, utils_1.checkIfExpoBundles)(projectDir, 'web');
110
+ (0, vitest_1.expect)(bundled).toBe(true);
101
111
  });
102
112
  });
103
113
  //# sourceMappingURL=expo.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"expo.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/expo.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAMkB;AAClB,oCAA+C;AAC/C,oCAA6C;AAC7C,mCAA6D;AAE7D,IAAA,iBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE;IACpB,MAAM,WAAW,GAAG,uBAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,iDAAiD,CAClD,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,qCAAqC,CACtC,CAAC;QACF,MAAM,qBAAqB,GAC3B,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,0CAA0C;YAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC,EAClC,gIAAgI,CACjI,CAAC,CAAC;QACH,MAAM,sBAAsB,GAC5B,qBAAqB;YACnB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,wBAAwB;YACxB,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,mJAAmJ,CACpJ,CAAC,CAAC;QACL,MAAM,iBAAiB,GACvB,sBAAsB;YACpB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,yBAAyB;YACzB,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,0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iB,EAAC,GAAG,UAAU,aAAa,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkFileExists,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport { checkFileContents } from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\ndescribe('Expo', () => {\n const integration = Integration.reactNative;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/react-native-expo-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n const sessionReplayPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.DOWN, KEYS.ENTER],\n 'Do you want to enable Session Replay to help debug issues? (See https://docs.sentry.io/platforms/react-native/session-replay/)',\n ));\n const feedbackWidgetPrompted =\n sessionReplayPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable session replay\n [KEYS.ENTER],\n 'Do you want to enable the Feedback Widget to collect feedback from your users? (See https://docs.sentry.io/platforms/react-native/user-feedback/)',\n ));\n const testEventPrompted =\n feedbackWidgetPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable feedback widget\n [KEYS.ENTER],\n 'Have you successfully sent a test event?',\n ));\n testEventPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Respond that test event was sent\n [KEYS.ENTER],\n 'Everything is set up!',\n ));\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkFileContents(`${projectDir}/package.json`, `@sentry/react-native`);\n });\n\n test('_layout.tsx is updated correctly', () => {\n checkFileContents(\n `${projectDir}/app/_layout.tsx`,\n `import * as Sentry from '@sentry/react-native';\n\nSentry.init({\n dsn: 'https://public@dsn.ingest.sentry.io/1337',\n\n // Adds more context data to events (IP address, cookies, user, etc.)\n // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/\n sendDefaultPii: true,\n\n // Configure Session Replay\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: __DEV__,\n});`,\n );\n checkFileContents(\n `${projectDir}/app/_layout.tsx`,\n `export default Sentry.wrap(function RootLayout() {`,\n );\n });\n\n test('app.json is updated correctly', () => {\n checkFileContents(\n `${projectDir}/app.json`,\n `\"@sentry/react-native/expo\",\n {\n \"url\": \"https://sentry.io/\",\n \"project\": \"${TEST_ARGS.PROJECT_SLUG}\",\n \"organization\": \"${TEST_ARGS.ORG_SLUG}\"\n }`,\n );\n });\n\n test('metro.config.js is added', () => {\n checkFileExists(`${projectDir}/metro.config.js`);\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `const { getSentryExpoConfig } = require(\"@sentry/react-native/metro\");\n\nconst config = getSentryExpoConfig(__dirname);\n\nmodule.exports = config;`,\n );\n });\n\n test('.gitignore is updated correctly', () => {\n checkFileContents(`${projectDir}/.gitignore`, `.env.local`);\n });\n});\n"]}
1
+ {"version":3,"file":"expo.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/expo.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCASkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE;IACpB,MAAM,WAAW,GAAG,uBAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,iDAAiD,CAClD,CA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,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAkB,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkFileContents,\n checkFileExists,\n checkIfExpoBundles,\n cleanupGit,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test, expect } from 'vitest';\n\ndescribe('Expo', () => {\n const integration = Integration.reactNative;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/react-native-expo-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n const sessionReplayPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.DOWN, KEYS.ENTER],\n 'Do you want to enable Session Replay to help debug issues? (See https://docs.sentry.io/platforms/react-native/session-replay/)',\n ));\n const feedbackWidgetPrompted =\n sessionReplayPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable session replay\n [KEYS.ENTER],\n 'Do you want to enable the Feedback Widget to collect feedback from your users? (See https://docs.sentry.io/platforms/react-native/user-feedback/)',\n ));\n const testEventPrompted =\n feedbackWidgetPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable feedback widget\n [KEYS.ENTER],\n 'Have you successfully sent a test event?',\n ));\n testEventPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Respond that test event was sent\n [KEYS.ENTER],\n 'Everything is set up!',\n ));\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkFileContents(`${projectDir}/package.json`, `@sentry/react-native`);\n });\n\n test('_layout.tsx is updated correctly', () => {\n checkFileContents(\n `${projectDir}/app/_layout.tsx`,\n `import * as Sentry from '@sentry/react-native';\n\nSentry.init({\n dsn: 'https://public@dsn.ingest.sentry.io/1337',\n\n // Adds more context data to events (IP address, cookies, user, etc.)\n // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/\n sendDefaultPii: true,\n\n // Configure Session Replay\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: __DEV__,\n});`,\n );\n checkFileContents(\n `${projectDir}/app/_layout.tsx`,\n `export default Sentry.wrap(function RootLayout() {`,\n );\n });\n\n test('app.json is updated correctly', () => {\n checkFileContents(\n `${projectDir}/app.json`,\n `\"@sentry/react-native/expo\",\n {\n \"url\": \"https://sentry.io/\",\n \"project\": \"${TEST_ARGS.PROJECT_SLUG}\",\n \"organization\": \"${TEST_ARGS.ORG_SLUG}\"\n }`,\n );\n });\n\n test('metro.config.js is added', () => {\n checkFileExists(`${projectDir}/metro.config.js`);\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `const { getSentryExpoConfig } = require(\"@sentry/react-native/metro\");\n\nconst config = getSentryExpoConfig(__dirname);\n\nmodule.exports = config;`,\n );\n });\n\n test('.gitignore is updated correctly', () => {\n checkFileContents(`${projectDir}/.gitignore`, `.env.local`);\n });\n\n test('android project is bundled correctly', async () => {\n const bundled = await checkIfExpoBundles(projectDir, 'android');\n expect(bundled).toBe(true);\n });\n\n test('ios project is bundled correctly', async () => {\n const bundled = await checkIfExpoBundles(projectDir, 'ios');\n expect(bundled).toBe(true);\n });\n\n test('web project is bundled correctly', async () => {\n const bundled = await checkIfExpoBundles(projectDir, 'web');\n expect(bundled).toBe(true);\n });\n});\n"]}
@@ -118,5 +118,32 @@ export const onRequestError = Sentry.captureRequestError;`,
118
118
  (0, vitest_1.test)('runs on prod mode correctly', async () => {
119
119
  await (0, utils_3.checkIfRunsOnProdMode)(projectDir, 'Ready in');
120
120
  });
121
+ (0, vitest_1.test)('root layout contains generateMetadata function', () => {
122
+ (0, utils_3.checkFileContents)(`${projectDir}/src/app/layout.tsx`, [
123
+ "// This file was generated by the Sentry wizard because we couldn't find a root layout file.",
124
+ "import * as Sentry from '@sentry/nextjs';",
125
+ "import type { Metadata } from 'next';",
126
+ '',
127
+ 'export function generateMetadata(): Metadata {',
128
+ ' return {',
129
+ ' other: {',
130
+ ' ...Sentry.getTraceData(),',
131
+ ' }',
132
+ ' }',
133
+ '};',
134
+ '',
135
+ 'export default function RootLayout({',
136
+ ' children,',
137
+ '}: {',
138
+ ' children: React.ReactNode',
139
+ '}) {',
140
+ ' return (',
141
+ ' <html lang="en">',
142
+ ' <body>{children}</body>',
143
+ ' </html>',
144
+ ' )',
145
+ '}',
146
+ ]);
147
+ });
121
148
  });
122
149
  //# sourceMappingURL=nextjs-14.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nextjs-14.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-14.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAOkB;AAClB,mCAA6D;AAE7D,IAAA,iBAAQ,EAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,yCAAyC,CAC1C,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB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;YACxD,2CAA2C;YAC3C;;;;;;;;;;0DAUoD;SACrD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,0CAA0C,EAAE,GAAG,EAAE;QACpD,IAAA,yBAAiB,EAAC,GAAG,UAAU,kBAAkB,EAAE;YACjD,iDAAiD;YACjD,+CAA+C;SAChD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\ndescribe('NextJS-14', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-14-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const examplePagePrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `No` for CI/CD tool\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/layout.tsx`);\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation files exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n \"import * as Sentry from '@sentry/nextjs';\",\n `export async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('../sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('../sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.mjs`, [\n \"import {withSentryConfig} from '@sentry/nextjs'\",\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n});\n"]}
1
+ {"version":3,"file":"nextjs-14.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-14.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAOkB;AAClB,mCAA6D;AAE7D,IAAA,iBAAQ,EAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,yCAAyC,CAC1C,CAAC;IAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,M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rD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,0CAA0C,EAAE,GAAG,EAAE;QACpD,IAAA,yBAAiB,EAAC,GAAG,UAAU,kBAAkB,EAAE;YACjD,iDAAiD;YACjD,+CAA+C;SAChD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,gDAAgD,EAAE,GAAG,EAAE;QAC1D,IAAA,yBAAiB,EAAC,GAAG,UAAU,qBAAqB,EAAE;YACpD,8FAA8F;YAC9F,2CAA2C;YAC3C,uCAAuC;YACvC,EAAE;YACF,gDAAgD;YAChD,YAAY;YACZ,cAAc;YACd,iCAAiC;YACjC,OAAO;YACP,KAAK;YACL,IAAI;YACJ,EAAE;YACF,sCAAsC;YACtC,aAAa;YACb,MAAM;YACN,6BAA6B;YAC7B,MAAM;YACN,YAAY;YACZ,sBAAsB;YACtB,+BAA+B;YAC/B,aAAa;YACb,KAAK;YACL,GAAG;SACJ,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\ndescribe('NextJS-14', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-14-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const tracingOptionPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const examplePagePrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `No` for CI/CD tool\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/layout.tsx`);\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation files exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n checkFileExists(`${projectDir}/src/instrumentation-client.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n \"import * as Sentry from '@sentry/nextjs';\",\n `export async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('../sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('../sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.mjs`, [\n \"import {withSentryConfig} from '@sentry/nextjs'\",\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n\n test('root layout contains generateMetadata function', () => {\n checkFileContents(`${projectDir}/src/app/layout.tsx`, [\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\",\n \"import * as Sentry from '@sentry/nextjs';\",\n \"import type { Metadata } from 'next';\",\n '',\n 'export function generateMetadata(): Metadata {',\n ' return {',\n ' other: {',\n ' ...Sentry.getTraceData(),',\n ' }',\n ' }',\n '};',\n '',\n 'export default function RootLayout({',\n ' children,',\n '}: {',\n ' children: React.ReactNode',\n '}) {',\n ' return (',\n ' <html lang=\"en\">',\n ' <body>{children}</body>',\n ' </html>',\n ' )',\n '}',\n ]);\n });\n});\n"]}
@@ -26,15 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const path = __importStar(require("node:path"));
27
27
  const Constants_1 = require("../../lib/Constants");
28
28
  const utils_1 = require("../utils");
29
- const utils_2 = require("../utils");
30
- const utils_3 = require("../utils");
31
29
  const vitest_1 = require("vitest");
32
30
  (0, vitest_1.describe)('ReactNative', () => {
33
31
  const integration = Constants_1.Integration.reactNative;
34
32
  const projectDir = path.resolve(__dirname, '../test-applications/react-native-test-app');
35
33
  let podInstallPrompted = false;
36
34
  (0, vitest_1.beforeAll)(async () => {
37
- const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
35
+ const wizardInstance = (0, utils_1.startWizardInstance)(integration, projectDir);
38
36
  const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
39
37
  const sessionReplayPrompted = packageManagerPrompted &&
40
38
  (await wizardInstance.sendStdinAndWaitForOutput(
@@ -71,16 +69,16 @@ const vitest_1 = require("vitest");
71
69
  (0, utils_1.cleanupGit)(projectDir);
72
70
  });
73
71
  (0, vitest_1.test)('package.json is updated correctly', () => {
74
- (0, utils_3.checkFileContents)(`${projectDir}/package.json`, `@sentry/react-native`);
72
+ (0, utils_1.checkFileContents)(`${projectDir}/package.json`, `@sentry/react-native`);
75
73
  });
76
74
  (0, vitest_1.test)('metro.config.js is updated correctly', () => {
77
- (0, utils_3.checkFileContents)(`${projectDir}/metro.config.js`, `const {
75
+ (0, utils_1.checkFileContents)(`${projectDir}/metro.config.js`, `const {
78
76
  withSentryConfig
79
77
  } = require("@sentry/react-native/metro");`);
80
- (0, utils_3.checkFileContents)(`${projectDir}/metro.config.js`, `module.exports = withSentryConfig(mergeConfig(getDefaultConfig(__dirname), config));`);
78
+ (0, utils_1.checkFileContents)(`${projectDir}/metro.config.js`, `module.exports = withSentryConfig(mergeConfig(getDefaultConfig(__dirname), config));`);
81
79
  });
82
80
  (0, vitest_1.test)('App.tsx is updated correctly', () => {
83
- (0, utils_3.checkFileContents)(`${projectDir}/App.tsx`, `import * as Sentry from '@sentry/react-native';
81
+ (0, utils_1.checkFileContents)(`${projectDir}/App.tsx`, `import * as Sentry from '@sentry/react-native';
84
82
 
85
83
  Sentry.init({
86
84
  dsn: 'https://public@dsn.ingest.sentry.io/1337',
@@ -97,13 +95,13 @@ Sentry.init({
97
95
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
98
96
  // spotlight: __DEV__,
99
97
  });`);
100
- (0, utils_3.checkFileContents)(`${projectDir}/App.tsx`, `export default Sentry.wrap(App);`);
98
+ (0, utils_1.checkFileContents)(`${projectDir}/App.tsx`, `export default Sentry.wrap(App);`);
101
99
  });
102
100
  (0, vitest_1.test)('ios/sentry.properties is added', () => {
103
101
  if (!podInstallPrompted) {
104
102
  return;
105
103
  }
106
- (0, utils_3.checkFileContents)(`${projectDir}/ios/sentry.properties`, `auth.token=${utils_1.TEST_ARGS.AUTH_TOKEN}
104
+ (0, utils_1.checkFileContents)(`${projectDir}/ios/sentry.properties`, `auth.token=${utils_1.TEST_ARGS.AUTH_TOKEN}
107
105
 
108
106
  defaults.org=${utils_1.TEST_ARGS.ORG_SLUG}
109
107
  defaults.project=${utils_1.TEST_ARGS.PROJECT_SLUG}
@@ -111,7 +109,7 @@ defaults.project=${utils_1.TEST_ARGS.PROJECT_SLUG}
111
109
  defaults.url=https://sentry.io/`);
112
110
  });
113
111
  (0, vitest_1.test)('android/sentry.properties is added', () => {
114
- (0, utils_3.checkFileContents)(`${projectDir}/android/sentry.properties`, `auth.token=${utils_1.TEST_ARGS.AUTH_TOKEN}
112
+ (0, utils_1.checkFileContents)(`${projectDir}/android/sentry.properties`, `auth.token=${utils_1.TEST_ARGS.AUTH_TOKEN}
115
113
 
116
114
  defaults.org=${utils_1.TEST_ARGS.ORG_SLUG}
117
115
  defaults.project=${utils_1.TEST_ARGS.PROJECT_SLUG}
@@ -119,14 +117,22 @@ defaults.project=${utils_1.TEST_ARGS.PROJECT_SLUG}
119
117
  defaults.url=https://sentry.io/`);
120
118
  });
121
119
  (0, vitest_1.test)('build.gradle is updated correctly', () => {
122
- (0, utils_3.checkFileContents)(`${projectDir}/android/app/build.gradle`, `apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle")`);
120
+ (0, utils_1.checkFileContents)(`${projectDir}/android/app/build.gradle`, `apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle")`);
123
121
  });
124
122
  (0, vitest_1.test)('xcode project is updated correctly', () => {
125
123
  if (!podInstallPrompted) {
126
124
  return;
127
125
  }
128
- (0, utils_3.checkFileContents)(`${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`, `../node_modules/@sentry/react-native/scripts/sentry-xcode.sh`);
129
- (0, utils_3.checkFileContents)(`${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`, `../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`);
126
+ (0, utils_1.checkFileContents)(`${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`, `../node_modules/@sentry/react-native/scripts/sentry-xcode.sh`);
127
+ (0, utils_1.checkFileContents)(`${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`, `../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`);
128
+ });
129
+ (0, vitest_1.test)('android project is bundled correctly', async () => {
130
+ const bundled = await (0, utils_1.checkIfReactNativeBundles)(projectDir, 'android');
131
+ (0, vitest_1.expect)(bundled).toBe(true);
132
+ });
133
+ (0, vitest_1.test)('ios project is bundled correctly', async () => {
134
+ const bundled = await (0, utils_1.checkIfReactNativeBundles)(projectDir, 'ios');
135
+ (0, vitest_1.expect)(bundled).toBe(true);
130
136
  });
131
137
  });
132
138
  //# sourceMappingURL=react-native.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-native.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/react-native.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAA2E;AAC3E,oCAA+C;AAC/C,oCAA6C;AAC7C,mCAA6D;AAE7D,IAAA,iBAAQ,EAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,WAAW,GAAG,uBAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,4CAA4C,CAC7C,CAAC;IAEF,IAAI,kBAAkB,GAAG,KAAK,CAAC;IAE/B,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,qCAAqC,CACtC,CAAC;QACF,MAAM,qBAAqB,GACzB,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,0CAA0C;YAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC,EAClC,gIAAgI,CACjI,CAAC,CAAC;QAEL,MAAM,sBAAsB,GAC1B,qBAAqB;YACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,wBAAwB;YACxB,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,mJAAmJ,CACpJ,CAAC,CAAC;QAEL,kBAAkB;YAChB,sBAAsB;gBACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;gBAC7C,yBAAyB;gBACzB,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A8B,EAAE,GAAG,EAAE;QACxC,IAAA,yBAAiB,EACf,GAAG,UAAU,UAAU,EACvB;;;;;;;;;;;;;;;;IAgBF,CACC,CAAC;QACF,IAAA,yBAAiB,EACf,GAAG,UAAU,UAAU,EACvB,kCAAkC,CACnC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,gCAAgC,EAAE,GAAG,EAAE;QAC1C,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO;SACR;QACD,IAAA,yBAAiB,EACf,GAAG,UAAU,wBAAwB,EACrC,cAAc,iBAAS,CAAC,UAAU;;eAEzB,iBAAS,CAAC,QAAQ;mBACd,iBAAS,CAAC,YAAY;;gCAET,CAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,IAAA,yBAAiB,EACf,GAAG,UAAU,4BAA4B,EACzC,cAAc,iBAAS,CAAC,UAAU;;eAEzB,iBAAS,CAAC,QAAQ;mBACd,iBAAS,CAAC,YAAY;;gCAET,CAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,mCAAmC,EAAE,GAAG,EAAE;QAC7C,IAAA,yBAAiB,EACf,GAAG,UAAU,2BAA2B,EACxC,6IAA6I,CAC9I,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO;SACR;QACD,IAAA,yBAAiB,EACf,GAAG,UAAU,+CAA+C,EAC5D,8DAA8D,CAC/D,CAAC;QACF,IAAA,yBAAiB,EACf,GAAG,UAAU,+CAA+C,EAC5D,0EAA0E,CAC3E,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport { KEYS, TEST_ARGS, cleanupGit, revertLocalChanges } from '../utils';\nimport { startWizardInstance } from '../utils';\nimport { checkFileContents } from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\ndescribe('ReactNative', () => {\n const integration = Integration.reactNative;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/react-native-test-app',\n );\n\n let podInstallPrompted = false;\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n const sessionReplayPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.DOWN, KEYS.ENTER],\n 'Do you want to enable Session Replay to help debug issues? (See https://docs.sentry.io/platforms/react-native/session-replay/)',\n ));\n\n const feedbackWidgetPrompted =\n sessionReplayPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable session replay\n [KEYS.ENTER],\n 'Do you want to enable the Feedback Widget to collect feedback from your users? (See https://docs.sentry.io/platforms/react-native/user-feedback/)',\n ));\n\n podInstallPrompted =\n feedbackWidgetPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable feedback widget\n [KEYS.ENTER],\n 'Do you want to run `pod install` now?',\n {\n optional: true,\n timeout: 5000,\n },\n ));\n\n const prettierPrompted =\n podInstallPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Skip pod install\n [KEYS.DOWN, KEYS.ENTER],\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n ));\n\n const testEventPrompted =\n prettierPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Skip prettier\n [KEYS.DOWN, KEYS.ENTER],\n 'Have you successfully sent a test event?',\n ));\n \n testEventPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Respond that test event was sent\n [KEYS.ENTER],\n 'Everything is set up!',\n ));\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkFileContents(`${projectDir}/package.json`, `@sentry/react-native`);\n });\n\n test('metro.config.js is updated correctly', () => {\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `const {\n withSentryConfig\n} = require(\"@sentry/react-native/metro\");`,\n );\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `module.exports = withSentryConfig(mergeConfig(getDefaultConfig(__dirname), config));`,\n );\n });\n\n test('App.tsx is updated correctly', () => {\n checkFileContents(\n `${projectDir}/App.tsx`,\n `import * as Sentry from '@sentry/react-native';\n\nSentry.init({\n dsn: 'https://public@dsn.ingest.sentry.io/1337',\n\n // Adds more context data to events (IP address, cookies, user, etc.)\n // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/\n sendDefaultPii: true,\n\n // Configure Session Replay\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: __DEV__,\n});`,\n );\n checkFileContents(\n `${projectDir}/App.tsx`,\n `export default Sentry.wrap(App);`,\n );\n });\n\n test('ios/sentry.properties is added', () => {\n if (!podInstallPrompted) {\n return;\n }\n checkFileContents(\n `${projectDir}/ios/sentry.properties`,\n `auth.token=${TEST_ARGS.AUTH_TOKEN}\n\ndefaults.org=${TEST_ARGS.ORG_SLUG}\ndefaults.project=${TEST_ARGS.PROJECT_SLUG}\n\ndefaults.url=https://sentry.io/`,\n );\n });\n\n test('android/sentry.properties is added', () => {\n checkFileContents(\n `${projectDir}/android/sentry.properties`,\n `auth.token=${TEST_ARGS.AUTH_TOKEN}\n\ndefaults.org=${TEST_ARGS.ORG_SLUG}\ndefaults.project=${TEST_ARGS.PROJECT_SLUG}\n\ndefaults.url=https://sentry.io/`,\n );\n });\n\n test('build.gradle is updated correctly', () => {\n checkFileContents(\n `${projectDir}/android/app/build.gradle`,\n `apply from: new File([\"node\", \"--print\", \"require.resolve('@sentry/react-native/package.json')\"].execute().text.trim(), \"../sentry.gradle\")`,\n );\n });\n\n test('xcode project is updated correctly', () => {\n if (!podInstallPrompted) {\n return;\n }\n checkFileContents(\n `${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`,\n `../node_modules/@sentry/react-native/scripts/sentry-xcode.sh`,\n );\n checkFileContents(\n `${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`,\n `../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n );\n });\n});\n"]}
1
+ {"version":3,"file":"react-native.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/react-native.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAQkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,WAAW,GAAG,uBAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,4CAA4C,CAC7C,CAAC;IAEF,IAAI,kBAAkB,GAAG,KAAK,CAAC;IAE/B,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,qCAAqC,CACtC,CAAC;QACF,MAAM,qBAAqB,GACzB,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,0CAA0C;YAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC,EAClC,gIAAgI,CACjI,CAAC,CAAC;QAEL,MAAM,sBAAsB,GAC1B,qBAAqB;YACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,wBAAwB;YACxB,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5D,0EAA0E,CAC3E,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAyB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QACvE,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAyB,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACnE,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n cleanupGit,\n checkFileContents,\n checkIfReactNativeBundles,\n revertLocalChanges,\n startWizardInstance\n} from '../utils';\nimport { afterAll, beforeAll, describe, test, expect } from 'vitest';\n\ndescribe('ReactNative', () => {\n const integration = Integration.reactNative;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/react-native-test-app',\n );\n\n let podInstallPrompted = false;\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n const sessionReplayPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.DOWN, KEYS.ENTER],\n 'Do you want to enable Session Replay to help debug issues? (See https://docs.sentry.io/platforms/react-native/session-replay/)',\n ));\n\n const feedbackWidgetPrompted =\n sessionReplayPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable session replay\n [KEYS.ENTER],\n 'Do you want to enable the Feedback Widget to collect feedback from your users? (See https://docs.sentry.io/platforms/react-native/user-feedback/)',\n ));\n\n podInstallPrompted =\n feedbackWidgetPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Enable feedback widget\n [KEYS.ENTER],\n 'Do you want to run `pod install` now?',\n {\n optional: true,\n timeout: 5000,\n },\n ));\n\n const prettierPrompted =\n podInstallPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Skip pod install\n [KEYS.DOWN, KEYS.ENTER],\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n ));\n\n const testEventPrompted =\n prettierPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Skip prettier\n [KEYS.DOWN, KEYS.ENTER],\n 'Have you successfully sent a test event?',\n ));\n\n testEventPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Respond that test event was sent\n [KEYS.ENTER],\n 'Everything is set up!',\n ));\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkFileContents(`${projectDir}/package.json`, `@sentry/react-native`);\n });\n\n test('metro.config.js is updated correctly', () => {\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `const {\n withSentryConfig\n} = require(\"@sentry/react-native/metro\");`,\n );\n checkFileContents(\n `${projectDir}/metro.config.js`,\n `module.exports = withSentryConfig(mergeConfig(getDefaultConfig(__dirname), config));`,\n );\n });\n\n test('App.tsx is updated correctly', () => {\n checkFileContents(\n `${projectDir}/App.tsx`,\n `import * as Sentry from '@sentry/react-native';\n\nSentry.init({\n dsn: 'https://public@dsn.ingest.sentry.io/1337',\n\n // Adds more context data to events (IP address, cookies, user, etc.)\n // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/\n sendDefaultPii: true,\n\n // Configure Session Replay\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.mobileReplayIntegration(), Sentry.feedbackIntegration()],\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: __DEV__,\n});`,\n );\n checkFileContents(\n `${projectDir}/App.tsx`,\n `export default Sentry.wrap(App);`,\n );\n });\n\n test('ios/sentry.properties is added', () => {\n if (!podInstallPrompted) {\n return;\n }\n checkFileContents(\n `${projectDir}/ios/sentry.properties`,\n `auth.token=${TEST_ARGS.AUTH_TOKEN}\n\ndefaults.org=${TEST_ARGS.ORG_SLUG}\ndefaults.project=${TEST_ARGS.PROJECT_SLUG}\n\ndefaults.url=https://sentry.io/`,\n );\n });\n\n test('android/sentry.properties is added', () => {\n checkFileContents(\n `${projectDir}/android/sentry.properties`,\n `auth.token=${TEST_ARGS.AUTH_TOKEN}\n\ndefaults.org=${TEST_ARGS.ORG_SLUG}\ndefaults.project=${TEST_ARGS.PROJECT_SLUG}\n\ndefaults.url=https://sentry.io/`,\n );\n });\n\n test('build.gradle is updated correctly', () => {\n checkFileContents(\n `${projectDir}/android/app/build.gradle`,\n `apply from: new File([\"node\", \"--print\", \"require.resolve('@sentry/react-native/package.json')\"].execute().text.trim(), \"../sentry.gradle\")`,\n );\n });\n\n test('xcode project is updated correctly', () => {\n if (!podInstallPrompted) {\n return;\n }\n checkFileContents(\n `${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`,\n `../node_modules/@sentry/react-native/scripts/sentry-xcode.sh`,\n );\n checkFileContents(\n `${projectDir}/ios/reactnative078.xcodeproj/project.pbxproj`,\n `../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n );\n });\n\n test('android project is bundled correctly', async () => {\n const bundled = await checkIfReactNativeBundles(projectDir, 'android');\n expect(bundled).toBe(true);\n });\n\n test('ios project is bundled correctly', async () => {\n const bundled = await checkIfReactNativeBundles(projectDir, 'ios');\n expect(bundled).toBe(true);\n });\n});\n"]}
@@ -82,6 +82,7 @@ export declare function cleanupGit(projectDir: string): void;
82
82
  * @param projectDir
83
83
  */
84
84
  export declare function revertLocalChanges(projectDir: string): void;
85
+ export declare function getWizardCommand(integration: Integration): string;
85
86
  /**
86
87
  * Start the wizard instance with the given integration and project directory
87
88
  * @param integration
@@ -159,6 +160,22 @@ export declare function checkIfBuilds(projectDir: string): Promise<void>;
159
160
  * @param projectDir
160
161
  */
161
162
  export declare function checkIfFlutterBuilds(projectDir: string, expectedOutput: string, debug?: boolean): Promise<void>;
163
+ /**
164
+ * Check if the React Native project bundles successfully for the specified platform.
165
+ * Returns a boolean indicating if the process exits with status code 0.
166
+ * @param projectDir The root directory of the React Native project.
167
+ * @param platform The platform to bundle for ('ios' or 'android').
168
+ * @param debug runs the command in debug mode if true
169
+ */
170
+ export declare function checkIfReactNativeBundles(projectDir: string, platform: 'ios' | 'android', debug?: boolean): Promise<boolean>;
171
+ /**
172
+ * Check if the Expo project exports successfully for the specified platform.
173
+ * Returns a boolean indicating if the process exits with status code 0.
174
+ * @param projectDir The root directory of the Expo project.
175
+ * @param platform The platform to export for ('ios', 'android', or 'web').
176
+ * @param debug runs the command in debug mode if true
177
+ */
178
+ export declare function checkIfExpoBundles(projectDir: string, platform: 'ios' | 'android' | 'web', debug?: boolean): Promise<boolean>;
162
179
  /**
163
180
  * Check if the project runs on dev mode
164
181
  * @param projectDir
@@ -23,7 +23,7 @@ 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.checkIfFlutterBuilds = exports.checkIfBuilds = exports.checkSentryProperties = exports.checkEnvBuildPlugin = exports.checkSentryCliRc = exports.checkPackageJson = exports.checkFileExists = exports.checkFileContents = exports.checkFileDoesNotContain = exports.modifyFile = exports.createFile = exports.startWizardInstance = exports.revertLocalChanges = exports.cleanupGit = exports.initGit = exports.WizardTestEnv = exports.log = exports.TEST_ARGS = exports.KEYS = void 0;
26
+ exports.checkIfRunsOnProdMode = exports.checkIfRunsOnDevMode = exports.checkIfExpoBundles = exports.checkIfReactNativeBundles = exports.checkIfFlutterBuilds = exports.checkIfBuilds = exports.checkSentryProperties = exports.checkEnvBuildPlugin = exports.checkSentryCliRc = exports.checkPackageJson = exports.checkFileExists = exports.checkFileContents = exports.checkFileDoesNotContain = exports.modifyFile = exports.createFile = exports.startWizardInstance = exports.getWizardCommand = exports.revertLocalChanges = exports.cleanupGit = exports.initGit = exports.WizardTestEnv = exports.log = exports.TEST_ARGS = exports.KEYS = void 0;
27
27
  const fs = __importStar(require("node:fs"));
28
28
  const path = __importStar(require("node:path"));
29
29
  const node_child_process_1 = require("node:child_process");
@@ -244,6 +244,28 @@ function revertLocalChanges(projectDir) {
244
244
  }
245
245
  }
246
246
  exports.revertLocalChanges = revertLocalChanges;
247
+ function getWizardCommand(integration) {
248
+ const binName = process.env.SENTRY_WIZARD_E2E_TEST_BIN
249
+ ? ['dist-bin', `sentry-wizard-${process.platform}-${process.arch}`]
250
+ : ['dist', 'bin.js'];
251
+ const binPath = path.join(__dirname, '..', '..', ...binName);
252
+ const args = [
253
+ '--debug',
254
+ '-i',
255
+ integration,
256
+ '--preSelectedProject.authToken',
257
+ exports.TEST_ARGS.AUTH_TOKEN,
258
+ '--preSelectedProject.dsn',
259
+ exports.TEST_ARGS.PROJECT_DSN,
260
+ '--preSelectedProject.orgSlug',
261
+ exports.TEST_ARGS.ORG_SLUG,
262
+ '--preSelectedProject.projectSlug',
263
+ exports.TEST_ARGS.PROJECT_SLUG,
264
+ '--disable-telemetry',
265
+ ];
266
+ return `${binPath} ${args.join(' ')}`;
267
+ }
268
+ exports.getWizardCommand = getWizardCommand;
247
269
  /**
248
270
  * Start the wizard instance with the given integration and project directory
249
271
  * @param integration
@@ -403,6 +425,77 @@ async function checkIfFlutterBuilds(projectDir, expectedOutput, debug = false) {
403
425
  (0, vitest_1.expect)(outputReceived).toBe(true);
404
426
  }
405
427
  exports.checkIfFlutterBuilds = checkIfFlutterBuilds;
428
+ /**
429
+ * Check if the React Native project bundles successfully for the specified platform.
430
+ * Returns a boolean indicating if the process exits with status code 0.
431
+ * @param projectDir The root directory of the React Native project.
432
+ * @param platform The platform to bundle for ('ios' or 'android').
433
+ * @param debug runs the command in debug mode if true
434
+ */
435
+ async function checkIfReactNativeBundles(projectDir, platform, debug = false) {
436
+ const entryFile = 'index.js';
437
+ const dev = 'false'; // Test a production-like bundle
438
+ let bundleOutput;
439
+ let assetsDest;
440
+ if (platform === 'ios') {
441
+ bundleOutput = './ios/main.jsbundle';
442
+ assetsDest = './ios';
443
+ }
444
+ else {
445
+ // android
446
+ bundleOutput = './android/app/src/main/assets/index.android.bundle';
447
+ assetsDest = './android/app/src/main/res';
448
+ }
449
+ const bundleCommandArgs = [
450
+ 'react-native',
451
+ 'bundle',
452
+ '--entry-file',
453
+ entryFile,
454
+ '--platform',
455
+ platform,
456
+ '--dev',
457
+ dev,
458
+ '--bundle-output',
459
+ bundleOutput,
460
+ '--assets-dest',
461
+ assetsDest,
462
+ ];
463
+ const testEnv = new WizardTestEnv('npx', bundleCommandArgs, {
464
+ cwd: projectDir,
465
+ debug: debug,
466
+ });
467
+ const builtSuccessfully = await testEnv.waitForStatusCode(0, {
468
+ timeout: 300000,
469
+ });
470
+ testEnv.kill();
471
+ return builtSuccessfully;
472
+ }
473
+ exports.checkIfReactNativeBundles = checkIfReactNativeBundles;
474
+ /**
475
+ * Check if the Expo project exports successfully for the specified platform.
476
+ * Returns a boolean indicating if the process exits with status code 0.
477
+ * @param projectDir The root directory of the Expo project.
478
+ * @param platform The platform to export for ('ios', 'android', or 'web').
479
+ * @param debug runs the command in debug mode if true
480
+ */
481
+ async function checkIfExpoBundles(projectDir, platform, debug = false) {
482
+ const exportCommandArgs = [
483
+ 'expo',
484
+ 'export',
485
+ '--platform',
486
+ platform,
487
+ ];
488
+ const testEnv = new WizardTestEnv('npx', exportCommandArgs, {
489
+ cwd: projectDir,
490
+ debug: debug,
491
+ });
492
+ const builtSuccessfully = await testEnv.waitForStatusCode(0, {
493
+ timeout: 300000,
494
+ });
495
+ testEnv.kill();
496
+ return builtSuccessfully;
497
+ }
498
+ exports.checkIfExpoBundles = checkIfExpoBundles;
406
499
  /**
407
500
  * Check if the project runs on dev mode
408
501
  * @param projectDir