@sentry/wizard 4.7.0 → 4.9.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 +19 -0
- package/README.md +19 -19
- package/dist/e2e-tests/tests/angular-17.test.d.ts +1 -0
- package/dist/e2e-tests/tests/angular-17.test.js +196 -0
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -0
- package/dist/e2e-tests/tests/angular-19.test.d.ts +1 -0
- package/dist/e2e-tests/tests/angular-19.test.js +194 -0
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -0
- package/dist/e2e-tests/tests/expo.test.d.ts +1 -0
- package/dist/e2e-tests/tests/expo.test.js +103 -0
- package/dist/e2e-tests/tests/expo.test.js.map +1 -0
- 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/react-native.test.d.ts +1 -0
- package/dist/e2e-tests/tests/react-native.test.js +132 -0
- package/dist/e2e-tests/tests/react-native.test.js.map +1 -0
- package/dist/e2e-tests/tests/remix.test.js +4 -4
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +2 -2
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +7 -0
- package/dist/e2e-tests/utils/index.js +32 -7
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +3 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/SentryCli.d.ts +0 -11
- package/dist/lib/Helper/SentryCli.js +0 -52
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/src/android/templates.js +2 -0
- package/dist/src/android/templates.js.map +1 -1
- package/dist/src/angular/angular-wizard.d.ts +3 -0
- package/dist/src/angular/angular-wizard.js +186 -0
- package/dist/src/angular/angular-wizard.js.map +1 -0
- package/dist/src/angular/codemods/app-config.d.ts +3 -0
- package/dist/src/angular/codemods/app-config.js +211 -0
- package/dist/src/angular/codemods/app-config.js.map +1 -0
- package/dist/src/angular/codemods/main.d.ts +20 -0
- package/dist/src/angular/codemods/main.js +62 -0
- package/dist/src/angular/codemods/main.js.map +1 -0
- package/dist/src/angular/codemods/sourcemaps.d.ts +21 -0
- package/dist/src/angular/codemods/sourcemaps.js +94 -0
- package/dist/src/angular/codemods/sourcemaps.js.map +1 -0
- package/dist/src/angular/example-component.d.ts +8 -0
- package/dist/src/angular/example-component.js +286 -0
- package/dist/src/angular/example-component.js.map +1 -0
- package/dist/src/angular/sdk-setup.d.ts +6 -0
- package/dist/src/angular/sdk-setup.js +99 -0
- package/dist/src/angular/sdk-setup.js.map +1 -0
- package/dist/src/apple/code-tools.d.ts +4 -2
- package/dist/src/apple/code-tools.js +21 -11
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/inject-code-snippet.js +5 -3
- package/dist/src/apple/inject-code-snippet.js.map +1 -1
- package/dist/src/apple/macos-system-helper.d.ts +5 -0
- package/dist/src/apple/macos-system-helper.js +86 -0
- package/dist/src/apple/macos-system-helper.js.map +1 -0
- package/dist/src/apple/templates.js +10 -0
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +237 -11
- package/dist/src/apple/xcode-manager.js +736 -65
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/apple/xcode-project-object-with-id.d.ts +5 -0
- package/dist/src/apple/xcode-project-object-with-id.js +3 -0
- package/dist/src/apple/xcode-project-object-with-id.js.map +1 -0
- package/dist/src/flutter/flutter-wizard.js +10 -2
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/flutter/templates.js +7 -1
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +27 -15
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +56 -7
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +1 -3
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/templates.js +30 -0
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-native/expo-env-file.js +5 -0
- package/dist/src/react-native/expo-env-file.js.map +1 -1
- package/dist/src/react-native/expo-metro.js +22 -6
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/expo.js +11 -1
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/glob.js +14 -4
- package/dist/src/react-native/glob.js.map +1 -1
- package/dist/src/react-native/gradle.js +14 -4
- package/dist/src/react-native/gradle.js.map +1 -1
- package/dist/src/react-native/javascript.d.ts +9 -4
- package/dist/src/react-native/javascript.js +52 -23
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/metro.d.ts +1 -1
- package/dist/src/react-native/metro.js +36 -4
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.d.ts +4 -0
- package/dist/src/react-native/react-native-wizard.js +32 -4
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/xcode.js +29 -10
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +1 -3
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +30 -1
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +11 -5
- package/dist/src/remix/sdk-setup.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/sourcemaps-wizard.d.ts +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +35 -20
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
- package/dist/src/sourcemaps/tools/angular.js +7 -7
- package/dist/src/sourcemaps/tools/angular.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.d.ts +5 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +6 -3
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.js +5 -1
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +4 -1
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +4 -1
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sveltekit/sdk-example.js +1 -1
- package/dist/src/sveltekit/sdk-example.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +3 -5
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +28 -1
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +13 -15
- package/dist/src/utils/clack/index.js +17 -50
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/git.d.ts +11 -0
- package/dist/src/utils/git.js +69 -0
- package/dist/src/utils/git.js.map +1 -0
- package/dist/src/utils/sentrycli-utils.js +13 -4
- package/dist/src/utils/sentrycli-utils.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.d.ts +1 -0
- package/dist/test/angular/angular-wizard.test.js +27 -0
- package/dist/test/angular/angular-wizard.test.js.map +1 -0
- package/dist/test/angular/codemods/sourcemaps.test.d.ts +1 -0
- package/dist/test/angular/codemods/sourcemaps.test.js +237 -0
- package/dist/test/angular/codemods/sourcemaps.test.js.map +1 -0
- package/dist/test/angular/example-component.test.d.ts +1 -0
- package/dist/test/angular/example-component.test.js +105 -0
- package/dist/test/angular/example-component.test.js.map +1 -0
- package/dist/test/apple/code-tools.test.js +54 -35
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/configure-sentry-cli.test.d.ts +1 -0
- package/dist/test/apple/configure-sentry-cli.test.js +131 -0
- package/dist/test/apple/configure-sentry-cli.test.js.map +1 -0
- package/dist/test/apple/macos-system-helper-mocked.test.d.ts +1 -0
- package/dist/test/apple/macos-system-helper-mocked.test.js +46 -0
- package/dist/test/apple/macos-system-helper-mocked.test.js.map +1 -0
- package/dist/test/apple/macos-system-helper.test.d.ts +1 -0
- package/dist/test/apple/macos-system-helper.test.js +88 -0
- package/dist/test/apple/macos-system-helper.test.js.map +1 -0
- package/dist/test/apple/templates.test.js +10 -0
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +745 -379
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +9 -0
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +119 -0
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +113 -0
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +10 -10
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/utils/git.test.d.ts +1 -0
- package/dist/test/utils/git.test.js +70 -0
- package/dist/test/utils/git.test.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.9.0
|
|
4
|
+
|
|
5
|
+
- fix(apple): add support for synchronized Xcode folders ([#904](https://github.com/getsentry/sentry-wizard/pull/904))
|
|
6
|
+
- feat(react-native): Add Feedback Widget step ([#969](https://github.com/getsentry/sentry-wizard/pull/969))
|
|
7
|
+
- feat(react-native): More granular error reporting for RN Wizard ([#861](https://github.com/getsentry/sentry-wizard/pull/861))
|
|
8
|
+
- feat(Mobile): add `sendDefaultPii=true` to Mobile wizards ([#981](https://github.com/getsentry/sentry-wizard/pull/981))
|
|
9
|
+
- fix(apple): Use project-relative path to gitignore file ([#982](https://github.com/getsentry/sentry-wizard/pull/982))
|
|
10
|
+
|
|
11
|
+
## 4.8.0
|
|
12
|
+
|
|
13
|
+
- feat: Add Angular Wizard ([#767](https://github.com/getsentry/sentry-wizard/pull/767))
|
|
14
|
+
- feat(nextjs): Add connectivity check to example page([#951](https://github.com/getsentry/sentry-wizard/pull/951))
|
|
15
|
+
- feat(nextjs): Improve error names in example page to better differentiate between frontend and API errors ([#944](https://github.com/getsentry/sentry-wizard/pull/944))
|
|
16
|
+
- feat(nuxt): Add connectivity check to example page ([#966](https://github.com/getsentry/sentry-wizard/pull/966))
|
|
17
|
+
- feat(remix): Add connectivity check to example page([#967](https://github.com/getsentry/sentry-wizard/pull/967))
|
|
18
|
+
- feat(sveltekit): Add connectivity check to example page ([#972](https://github.com/getsentry/sentry-wizard/pull/972))
|
|
19
|
+
- fix(remix): Linting issues in generated client init code ([#949](https://github.com/getsentry/sentry-wizard/pull/949))
|
|
20
|
+
- fix(sveltekit): Move example page from sentry-example to sentry-example-page( [#973](https://github.com/getsentry/sentry-wizard/pull/973))
|
|
21
|
+
|
|
3
22
|
## 4.7.0
|
|
4
23
|
|
|
5
24
|
- feat: Add `deno` as a package manager ([#905](https://github.com/getsentry/sentry-wizard/pull/905))
|
package/README.md
CHANGED
|
@@ -57,25 +57,25 @@ open a [GitHub issue](https://github.com/getsentry/sentry-wizard/issues)!
|
|
|
57
57
|
|
|
58
58
|
The following CLI arguments are available:
|
|
59
59
|
|
|
60
|
-
| Option | Description | Type | Default | Choices
|
|
61
|
-
| ---------------------- | ----------------------------------------------------------------- | ------- | --------------------------------------- |
|
|
62
|
-
| `--help` | Show help | boolean | |
|
|
63
|
-
| `--version` | Show version number | boolean | |
|
|
64
|
-
| `--debug` | Enable verbose logging | boolean | `false` |
|
|
65
|
-
| `--uninstall` | Revert project setup process. Not available for all integrations. | boolean | `false` |
|
|
66
|
-
| `--skip-connect` | Skips the connection to the server | boolean | `false` |
|
|
67
|
-
| `--quiet` | Do not fallback to prompting user asking questions | boolean | `false` |
|
|
68
|
-
| `-i, --integration` | Choose the integration to setup | choices | Select integration during setup | "reactNative", "flutter", ios", "android", "cordova", "electron", "nextjs", "nuxt", "remix", "sveltekit", "sourcemaps" | `SENTRY_WIZARD_INTEGRATION` |
|
|
69
|
-
| `-p, --platform` | Choose platform(s) | array | Select platform(s) during setup | "ios", "android"
|
|
70
|
-
| `-u, --url` | The URL to your Sentry installation | string | `https://sentry.io` |
|
|
71
|
-
| `--project` | The Sentry project slug to use | string | Select project during setup |
|
|
72
|
-
| `--org` | The Sentry org slug to use | string | Select org during setup |
|
|
73
|
-
| `--saas` | Skip the self-hosted or SaaS URL selection process | boolean | Select self-hosted or SaaS during setup |
|
|
74
|
-
| `-s, --signup` | Redirect to signup page if not logged in | boolean | `false` |
|
|
75
|
-
| `--disable-telemetry` | Don't send telemetry data to Sentry | boolean | `false` |
|
|
76
|
-
| `--force-install` | Force install the SDK NPM package (use with caution!) | boolean | `false` |
|
|
77
|
-
| `--coming-from` | Specify the partner organization initiating this command. | string | |
|
|
78
|
-
| `--ignore-git-changes` | Ignore git changes in the project and not prompt for confirmation | boolean | `false` |
|
|
60
|
+
| Option | Description | Type | Default | Choices | Environment Variable |
|
|
61
|
+
| ---------------------- | ----------------------------------------------------------------- | ------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
|
|
62
|
+
| `--help` | Show help | boolean | | | |
|
|
63
|
+
| `--version` | Show version number | boolean | | | |
|
|
64
|
+
| `--debug` | Enable verbose logging | boolean | `false` | | `SENTRY_WIZARD_DEBUG` |
|
|
65
|
+
| `--uninstall` | Revert project setup process. Not available for all integrations. | boolean | `false` | | `SENTRY_WIZARD_UNINSTALL` |
|
|
66
|
+
| `--skip-connect` | Skips the connection to the server | boolean | `false` | | `SENTRY_WIZARD_SKIP_CONNECT` |
|
|
67
|
+
| `--quiet` | Do not fallback to prompting user asking questions | boolean | `false` | | `SENTRY_WIZARD_QUIET` |
|
|
68
|
+
| `-i, --integration` | Choose the integration to setup | choices | Select integration during setup | "reactNative", "flutter", ios", "android", "cordova", "angular", "electron", "nextjs", "nuxt", "remix", "sveltekit", "sourcemaps" | `SENTRY_WIZARD_INTEGRATION` |
|
|
69
|
+
| `-p, --platform` | Choose platform(s) | array | Select platform(s) during setup | "ios", "android" | `SENTRY_WIZARD_PLATFORM` |
|
|
70
|
+
| `-u, --url` | The URL to your Sentry installation | string | `https://sentry.io` | | `SENTRY_WIZARD_URL` |
|
|
71
|
+
| `--project` | The Sentry project slug to use | string | Select project during setup | | |
|
|
72
|
+
| `--org` | The Sentry org slug to use | string | Select org during setup | | |
|
|
73
|
+
| `--saas` | Skip the self-hosted or SaaS URL selection process | boolean | Select self-hosted or SaaS during setup | | |
|
|
74
|
+
| `-s, --signup` | Redirect to signup page if not logged in | boolean | `false` | | |
|
|
75
|
+
| `--disable-telemetry` | Don't send telemetry data to Sentry | boolean | `false` | | |
|
|
76
|
+
| `--force-install` | Force install the SDK NPM package (use with caution!) | boolean | `false` | | |
|
|
77
|
+
| `--coming-from` | Specify the partner organization initiating this command. | string | | | |
|
|
78
|
+
| `--ignore-git-changes` | Ignore git changes in the project and not prompt for confirmation | boolean | `false` | | |
|
|
79
79
|
|
|
80
80
|
## Resources
|
|
81
81
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const Constants_1 = require("../../lib/Constants");
|
|
27
|
+
const utils_1 = require("../utils");
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const utils_2 = require("../utils");
|
|
30
|
+
const vitest_1 = require("vitest");
|
|
31
|
+
vitest_1.describe.sequential('Angular-17', () => {
|
|
32
|
+
(0, vitest_1.describe)('with empty project', () => {
|
|
33
|
+
const integration = Constants_1.Integration.angular;
|
|
34
|
+
const projectDir = path.resolve(__dirname, '../test-applications/angular-17-test-app');
|
|
35
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
36
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
37
|
+
await runWizardOnAngularProject(projectDir, integration);
|
|
38
|
+
});
|
|
39
|
+
(0, vitest_1.afterAll)(() => {
|
|
40
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
41
|
+
(0, utils_1.cleanupGit)(projectDir);
|
|
42
|
+
});
|
|
43
|
+
checkAngularProject(projectDir, integration);
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.describe)('with pre-defined ErrorHandler', () => {
|
|
46
|
+
const integration = Constants_1.Integration.angular;
|
|
47
|
+
const projectDir = path.resolve(__dirname, '../test-applications/angular-17-test-app');
|
|
48
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
49
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
50
|
+
await runWizardOnAngularProject(projectDir, integration, (projectDir) => {
|
|
51
|
+
(0, utils_1.modifyFile)(`${projectDir}/src/app/app.config.ts`, {
|
|
52
|
+
'providers: [': `providers: [{
|
|
53
|
+
provide: ErrorHandler,
|
|
54
|
+
useValue: null
|
|
55
|
+
},
|
|
56
|
+
`,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.afterAll)(() => {
|
|
61
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
62
|
+
(0, utils_1.cleanupGit)(projectDir);
|
|
63
|
+
});
|
|
64
|
+
checkAngularProject(projectDir, integration, {
|
|
65
|
+
preExistingErrorHandler: true,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
async function runWizardOnAngularProject(projectDir, integration, fileModificationFn) {
|
|
70
|
+
const wizardInstance = (0, utils_1.startWizardInstance)(integration, projectDir, true);
|
|
71
|
+
if (fileModificationFn) {
|
|
72
|
+
fileModificationFn(projectDir);
|
|
73
|
+
await wizardInstance.waitForOutput('Do you want to continue anyway?');
|
|
74
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Please select your package manager.');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
await wizardInstance.waitForOutput('Please select your package manager.');
|
|
78
|
+
}
|
|
79
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
80
|
+
// Selecting `yarn v1` as the package manager
|
|
81
|
+
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER],
|
|
82
|
+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
83
|
+
'to track the performance of your application?', {
|
|
84
|
+
timeout: 240000,
|
|
85
|
+
optional: true,
|
|
86
|
+
});
|
|
87
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
88
|
+
// select "Yes" for tracing
|
|
89
|
+
[utils_1.KEYS.ENTER],
|
|
90
|
+
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
91
|
+
'to get a video-like reproduction of errors during a user session?');
|
|
92
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
93
|
+
// select "Yes" for replay
|
|
94
|
+
[utils_1.KEYS.ENTER], 'Where are your build artifacts located?', {
|
|
95
|
+
timeout: 240000, // installing Sentry CLI can take a while
|
|
96
|
+
});
|
|
97
|
+
const sourcemapsConfiguredPromise = wizardInstance.waitForOutput('Added a sentry:sourcemaps script to your package.json');
|
|
98
|
+
const buildScriptPromptedPromise = wizardInstance.waitForOutput('Do you want to automatically run the sentry:sourcemaps script after each production build?');
|
|
99
|
+
const optionalArtifactsNotFoundPromise = wizardInstance.waitForOutput("We couldn't find artifacts", {
|
|
100
|
+
optional: true,
|
|
101
|
+
timeout: 5000,
|
|
102
|
+
});
|
|
103
|
+
// ./dist is the default value, no need to change it
|
|
104
|
+
wizardInstance.sendStdin(utils_1.KEYS.ENTER);
|
|
105
|
+
const optionalArtifactsNotFoundPrompted = await optionalArtifactsNotFoundPromise;
|
|
106
|
+
if (optionalArtifactsNotFoundPrompted) {
|
|
107
|
+
wizardInstance.sendStdin(utils_1.KEYS.DOWN);
|
|
108
|
+
wizardInstance.sendStdin(utils_1.KEYS.ENTER);
|
|
109
|
+
}
|
|
110
|
+
await sourcemapsConfiguredPromise;
|
|
111
|
+
await buildScriptPromptedPromise;
|
|
112
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, automatically add sentry:sourcemaps script
|
|
113
|
+
'Is yarn build your production build command?');
|
|
114
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, yarn build is the production build command
|
|
115
|
+
'Are you using a CI/CD tool to build and deploy your application?');
|
|
116
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], // no CI/CD tool
|
|
117
|
+
'Do you want to create an example component to test your Sentry setup?');
|
|
118
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, create example component
|
|
119
|
+
'Did you apply the snippet above?');
|
|
120
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, applied the snippet
|
|
121
|
+
'Looks like you have Prettier in your project. Do you want to run it on your files?');
|
|
122
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, run prettier
|
|
123
|
+
'Successfully installed the Sentry Angular SDK!');
|
|
124
|
+
wizardInstance.kill();
|
|
125
|
+
}
|
|
126
|
+
function checkAngularProject(projectDir, integration, options) {
|
|
127
|
+
(0, vitest_1.test)('package.json is updated correctly', () => {
|
|
128
|
+
(0, utils_1.checkPackageJson)(projectDir, integration);
|
|
129
|
+
const packageJsonFile = path.resolve(projectDir, 'package.json');
|
|
130
|
+
(0, utils_1.checkFileContents)(packageJsonFile, [
|
|
131
|
+
`"sentry:sourcemaps": "sentry-cli sourcemaps inject --org ${utils_2.TEST_ARGS.ORG_SLUG} --project ${utils_2.TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${utils_2.TEST_ARGS.ORG_SLUG} --project ${utils_2.TEST_ARGS.PROJECT_SLUG} ./dist"`,
|
|
132
|
+
`"build": "ng build && yarn sentry:sourcemaps"`,
|
|
133
|
+
]);
|
|
134
|
+
});
|
|
135
|
+
(0, vitest_1.test)('Sentry is correctly injected into Angular app config', () => {
|
|
136
|
+
const appConfigFile = path.resolve(projectDir, 'src/main.ts');
|
|
137
|
+
(0, utils_1.checkFileExists)(appConfigFile);
|
|
138
|
+
(0, utils_1.checkFileContents)(appConfigFile, [
|
|
139
|
+
`import * as Sentry from '@sentry/angular'`,
|
|
140
|
+
'Sentry.init({',
|
|
141
|
+
utils_2.TEST_ARGS.PROJECT_DSN,
|
|
142
|
+
'Sentry.browserTracingIntegration()',
|
|
143
|
+
'Sentry.replayIntegration()',
|
|
144
|
+
'tracesSampleRate: 1',
|
|
145
|
+
'replaysSessionSampleRate: 0.1',
|
|
146
|
+
'replaysOnErrorSampleRate: 1',
|
|
147
|
+
]);
|
|
148
|
+
});
|
|
149
|
+
(0, vitest_1.test)('Sentry is correctly injected into Angular app module', () => {
|
|
150
|
+
const appModuleFile = path.resolve(projectDir, 'src/app/app.config.ts');
|
|
151
|
+
(0, utils_1.checkFileExists)(appModuleFile);
|
|
152
|
+
// Checking if the ErrorHandler is already present in the providers array,
|
|
153
|
+
// and if it is, we skip adding it
|
|
154
|
+
if (options?.preExistingErrorHandler) {
|
|
155
|
+
(0, utils_1.checkFileDoesNotContain)(appModuleFile, 'Sentry.createErrorHandler()');
|
|
156
|
+
}
|
|
157
|
+
(0, utils_1.checkFileContents)(appModuleFile, [
|
|
158
|
+
`import * as Sentry from '@sentry/angular'`,
|
|
159
|
+
options?.preExistingErrorHandler
|
|
160
|
+
? `provide: ErrorHandler,
|
|
161
|
+
useValue: null`
|
|
162
|
+
: `provide: ErrorHandler,
|
|
163
|
+
useValue: Sentry.createErrorHandler()`,
|
|
164
|
+
`provide: Sentry.TraceService,
|
|
165
|
+
deps: [Router]`,
|
|
166
|
+
`provide: APP_INITIALIZER,
|
|
167
|
+
useFactory: () => () => {},
|
|
168
|
+
deps: [Sentry.TraceService],
|
|
169
|
+
multi: true`,
|
|
170
|
+
]);
|
|
171
|
+
});
|
|
172
|
+
(0, vitest_1.test)('angular.json is updated correctly', async () => {
|
|
173
|
+
const angularJsonFile = path.resolve(projectDir, 'angular.json');
|
|
174
|
+
(0, utils_1.checkFileExists)(angularJsonFile);
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
176
|
+
const angularJson = (await import(angularJsonFile));
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
178
|
+
for (const [, project] of Object.entries(
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
180
|
+
angularJson.projects)) {
|
|
181
|
+
(0, vitest_1.expect)(
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
183
|
+
project?.architect?.build?.configurations?.production?.sourceMap).toBe(true);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
(0, vitest_1.test)('builds successfully', async () => {
|
|
187
|
+
await (0, utils_1.checkIfBuilds)(projectDir);
|
|
188
|
+
});
|
|
189
|
+
(0, vitest_1.test)('runs on prod mode correctly', async () => {
|
|
190
|
+
await (0, utils_1.checkIfRunsOnProdMode)(projectDir, 'Application bundle generation complete.');
|
|
191
|
+
});
|
|
192
|
+
(0, vitest_1.test)('runs on dev mode correctly', async () => {
|
|
193
|
+
await (0, utils_1.checkIfRunsOnDevMode)(projectDir, 'Application bundle generation complete.');
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=angular-17.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-17.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/angular-17.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAkD;AAClD,oCAakB;AAClB,2CAA6B;AAC7B,oCAAqC;AACrC,mCAAqE;AAErE,iBAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,GAAG,EAAE;IACrC,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,0CAA0C,CAC3C,CAAC;QAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,IAAA,0BAAkB,EAAC,UAAU,CAAC,CA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8D;QAC9D,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,CAAwB,CAAC;QAE3E,8DAA8D;QAC9D,KAAK,MAAM,CAAC,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO;QACtC,8DAA8D;QAC9D,WAAW,CAAC,QAA+B,CAC5C,EAAE;YACD,IAAA,eAAM;YACJ,sEAAsE;YACtE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,CACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACd;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EACzB,UAAU,EACV,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EACxB,UAAU,EACV,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Integration } from '../../lib/Constants';\nimport {\n checkFileContents,\n checkFileDoesNotContain,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n KEYS,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport * as path from 'path';\nimport { TEST_ARGS } from '../utils';\nimport { test, expect, describe, beforeAll, afterAll } from 'vitest';\n\ndescribe.sequential('Angular-17', () => {\n describe('with empty project', () => {\n const integration = Integration.angular;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/angular-17-test-app',\n );\n\n beforeAll(async () => {\n revertLocalChanges(projectDir);\n await runWizardOnAngularProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkAngularProject(projectDir, integration);\n });\n\n describe('with pre-defined ErrorHandler', () => {\n const integration = Integration.angular;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/angular-17-test-app',\n );\n\n beforeAll(async () => {\n revertLocalChanges(projectDir);\n await runWizardOnAngularProject(projectDir, integration, (projectDir) => {\n modifyFile(`${projectDir}/src/app/app.config.ts`, {\n 'providers: [': `providers: [{\n provide: ErrorHandler,\n useValue: null\n },\n `,\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkAngularProject(projectDir, integration, {\n preExistingErrorHandler: true,\n });\n });\n});\n\nasync function runWizardOnAngularProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (projectDir: string) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir, true);\n\n if (fileModificationFn) {\n fileModificationFn(projectDir);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n await wizardInstance.waitForOutput('Please select your package manager.');\n }\n\n await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn v1` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000, // installing the sdk can take a while\n optional: true,\n },\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n // select \"Yes\" for tracing\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n // select \"Yes\" for replay\n [KEYS.ENTER],\n 'Where are your build artifacts located?',\n {\n timeout: 240_000, // installing Sentry CLI can take a while\n },\n );\n\n const sourcemapsConfiguredPromise = wizardInstance.waitForOutput(\n 'Added a sentry:sourcemaps script to your package.json',\n );\n\n const buildScriptPromptedPromise = wizardInstance.waitForOutput(\n 'Do you want to automatically run the sentry:sourcemaps script after each production build?',\n );\n\n const optionalArtifactsNotFoundPromise = wizardInstance.waitForOutput(\n \"We couldn't find artifacts\",\n {\n optional: true,\n timeout: 5000,\n },\n );\n\n // ./dist is the default value, no need to change it\n wizardInstance.sendStdin(KEYS.ENTER);\n\n const optionalArtifactsNotFoundPrompted =\n await optionalArtifactsNotFoundPromise;\n\n if (optionalArtifactsNotFoundPrompted) {\n wizardInstance.sendStdin(KEYS.DOWN);\n wizardInstance.sendStdin(KEYS.ENTER);\n }\n\n await sourcemapsConfiguredPromise;\n\n await buildScriptPromptedPromise;\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, automatically add sentry:sourcemaps script\n 'Is yarn build your production build command?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, yarn build is the production build command\n 'Are you using a CI/CD tool to build and deploy your application?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER], // no CI/CD tool\n 'Do you want to create an example component to test your Sentry setup?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, create example component\n 'Did you apply the snippet above?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, applied the snippet\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, run prettier\n 'Successfully installed the Sentry Angular SDK!',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkAngularProject(\n projectDir: string,\n integration: Integration,\n options?: {\n preExistingErrorHandler?: boolean;\n },\n) {\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n\n const packageJsonFile = path.resolve(projectDir, 'package.json');\n checkFileContents(packageJsonFile, [\n `\"sentry:sourcemaps\": \"sentry-cli sourcemaps inject --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist\"`,\n `\"build\": \"ng build && yarn sentry:sourcemaps\"`,\n ]);\n });\n\n test('Sentry is correctly injected into Angular app config', () => {\n const appConfigFile = path.resolve(projectDir, 'src/main.ts');\n checkFileExists(appConfigFile);\n\n checkFileContents(appConfigFile, [\n `import * as Sentry from '@sentry/angular'`,\n 'Sentry.init({',\n TEST_ARGS.PROJECT_DSN,\n 'Sentry.browserTracingIntegration()',\n 'Sentry.replayIntegration()',\n 'tracesSampleRate: 1',\n 'replaysSessionSampleRate: 0.1',\n 'replaysOnErrorSampleRate: 1',\n ]);\n });\n\n test('Sentry is correctly injected into Angular app module', () => {\n const appModuleFile = path.resolve(projectDir, 'src/app/app.config.ts');\n checkFileExists(appModuleFile);\n\n // Checking if the ErrorHandler is already present in the providers array,\n // and if it is, we skip adding it\n if (options?.preExistingErrorHandler) {\n checkFileDoesNotContain(appModuleFile, 'Sentry.createErrorHandler()');\n }\n\n checkFileContents(appModuleFile, [\n `import * as Sentry from '@sentry/angular'`,\n options?.preExistingErrorHandler\n ? `provide: ErrorHandler,\n useValue: null`\n : `provide: ErrorHandler,\n useValue: Sentry.createErrorHandler()`,\n `provide: Sentry.TraceService,\n deps: [Router]`,\n `provide: APP_INITIALIZER,\n useFactory: () => () => {},\n deps: [Sentry.TraceService],\n multi: true`,\n ]);\n });\n\n test('angular.json is updated correctly', async () => {\n const angularJsonFile = path.resolve(projectDir, 'angular.json');\n checkFileExists(angularJsonFile);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const angularJson = (await import(angularJsonFile)) as Record<string, any>;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const [, project] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n angularJson.projects as Record<string, any>,\n )) {\n expect(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n project?.architect?.build?.configurations?.production?.sourceMap,\n ).toBe(true);\n }\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const Constants_1 = require("../../lib/Constants");
|
|
27
|
+
const utils_1 = require("../utils");
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const utils_2 = require("../utils");
|
|
30
|
+
const vitest_1 = require("vitest");
|
|
31
|
+
vitest_1.describe.sequential('Angular-19', () => {
|
|
32
|
+
(0, vitest_1.describe)('with empty project', () => {
|
|
33
|
+
const integration = Constants_1.Integration.angular;
|
|
34
|
+
const projectDir = path.resolve(__dirname, '../test-applications/angular-19-test-app');
|
|
35
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
36
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
37
|
+
await runWizardOnAngularProject(projectDir, integration);
|
|
38
|
+
});
|
|
39
|
+
(0, vitest_1.afterAll)(() => {
|
|
40
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
41
|
+
(0, utils_1.cleanupGit)(projectDir);
|
|
42
|
+
});
|
|
43
|
+
checkAngularProject(projectDir, integration);
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.describe)('with pre-defined ErrorHandler', () => {
|
|
46
|
+
const integration = Constants_1.Integration.angular;
|
|
47
|
+
const projectDir = path.resolve(__dirname, '../test-applications/angular-19-test-app');
|
|
48
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
49
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
50
|
+
await runWizardOnAngularProject(projectDir, integration, (projectDir) => {
|
|
51
|
+
(0, utils_1.modifyFile)(`${projectDir}/src/app/app.config.ts`, {
|
|
52
|
+
'providers: [': `providers: [{
|
|
53
|
+
provide: ErrorHandler,
|
|
54
|
+
useValue: null
|
|
55
|
+
},
|
|
56
|
+
`,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.afterAll)(() => {
|
|
61
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
62
|
+
(0, utils_1.cleanupGit)(projectDir);
|
|
63
|
+
});
|
|
64
|
+
checkAngularProject(projectDir, integration, {
|
|
65
|
+
preExistingErrorHandler: true,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
async function runWizardOnAngularProject(projectDir, integration, fileModificationFn) {
|
|
70
|
+
const wizardInstance = (0, utils_1.startWizardInstance)(integration, projectDir, true);
|
|
71
|
+
if (fileModificationFn) {
|
|
72
|
+
fileModificationFn(projectDir);
|
|
73
|
+
await wizardInstance.waitForOutput('Do you want to continue anyway?');
|
|
74
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Please select your package manager.');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
await wizardInstance.waitForOutput('Please select your package manager.');
|
|
78
|
+
}
|
|
79
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
80
|
+
// Selecting `yarn` as the package manager
|
|
81
|
+
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER],
|
|
82
|
+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
83
|
+
'to track the performance of your application?', {
|
|
84
|
+
timeout: 240000,
|
|
85
|
+
optional: true,
|
|
86
|
+
});
|
|
87
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
88
|
+
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
89
|
+
'to get a video-like reproduction of errors during a user session?');
|
|
90
|
+
await wizardInstance.sendStdinAndWaitForOutput(
|
|
91
|
+
// The first choice here is Angular
|
|
92
|
+
[utils_1.KEYS.ENTER], 'Where are your build artifacts located?', {
|
|
93
|
+
optional: true,
|
|
94
|
+
timeout: 5000,
|
|
95
|
+
});
|
|
96
|
+
const sourcemapsConfiguredPromise = wizardInstance.waitForOutput('Added a sentry:sourcemaps script to your package.json');
|
|
97
|
+
const buildScriptPromptedPromise = wizardInstance.waitForOutput('Do you want to automatically run the sentry:sourcemaps script after each production build?');
|
|
98
|
+
const optionalArtifactsNotFoundPromise = wizardInstance.waitForOutput("We couldn't find artifacts", {
|
|
99
|
+
optional: true,
|
|
100
|
+
timeout: 5000,
|
|
101
|
+
});
|
|
102
|
+
// ./dist is the default value, no need to change it
|
|
103
|
+
wizardInstance.sendStdin(utils_1.KEYS.ENTER);
|
|
104
|
+
const optionalArtifactsNotFoundPrompted = await optionalArtifactsNotFoundPromise;
|
|
105
|
+
if (optionalArtifactsNotFoundPrompted) {
|
|
106
|
+
wizardInstance.sendStdin(utils_1.KEYS.DOWN);
|
|
107
|
+
wizardInstance.sendStdin(utils_1.KEYS.ENTER);
|
|
108
|
+
}
|
|
109
|
+
await sourcemapsConfiguredPromise;
|
|
110
|
+
await buildScriptPromptedPromise;
|
|
111
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, automatically add sentry:sourcemaps script
|
|
112
|
+
'Is yarn build your production build command?');
|
|
113
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, yarn build is the production build command
|
|
114
|
+
'Are you using a CI/CD tool to build and deploy your application?');
|
|
115
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], // no CI/CD tool
|
|
116
|
+
'Do you want to create an example component to test your Sentry setup?');
|
|
117
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, create example component
|
|
118
|
+
'Did you apply the snippet above?');
|
|
119
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, applied the snippet
|
|
120
|
+
'Looks like you have Prettier in your project. Do you want to run it on your files?');
|
|
121
|
+
await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], // yes, run prettier
|
|
122
|
+
'Successfully installed the Sentry Angular SDK!');
|
|
123
|
+
wizardInstance.kill();
|
|
124
|
+
}
|
|
125
|
+
function checkAngularProject(projectDir, integration, options) {
|
|
126
|
+
(0, vitest_1.test)('package.json is updated correctly', () => {
|
|
127
|
+
(0, utils_1.checkPackageJson)(projectDir, integration);
|
|
128
|
+
const packageJsonFile = path.resolve(projectDir, 'package.json');
|
|
129
|
+
(0, utils_1.checkFileContents)(packageJsonFile, [
|
|
130
|
+
`"sentry:sourcemaps": "sentry-cli sourcemaps inject --org ${utils_2.TEST_ARGS.ORG_SLUG} --project ${utils_2.TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${utils_2.TEST_ARGS.ORG_SLUG} --project ${utils_2.TEST_ARGS.PROJECT_SLUG} ./dist"`,
|
|
131
|
+
`"build": "ng build && yarn sentry:sourcemaps"`,
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
(0, vitest_1.test)('Sentry is correctly injected into Angular app config', () => {
|
|
135
|
+
const appConfigFile = path.resolve(projectDir, 'src/main.ts');
|
|
136
|
+
(0, utils_1.checkFileExists)(appConfigFile);
|
|
137
|
+
(0, utils_1.checkFileContents)(appConfigFile, [
|
|
138
|
+
`import * as Sentry from '@sentry/angular'`,
|
|
139
|
+
'Sentry.init({',
|
|
140
|
+
utils_2.TEST_ARGS.PROJECT_DSN,
|
|
141
|
+
'Sentry.browserTracingIntegration()',
|
|
142
|
+
'Sentry.replayIntegration()',
|
|
143
|
+
'tracesSampleRate: 1',
|
|
144
|
+
'replaysSessionSampleRate: 0.1',
|
|
145
|
+
'replaysOnErrorSampleRate: 1',
|
|
146
|
+
]);
|
|
147
|
+
});
|
|
148
|
+
(0, vitest_1.test)('Sentry is correctly injected into Angular app module', () => {
|
|
149
|
+
const appModuleFile = path.resolve(projectDir, 'src/app/app.config.ts');
|
|
150
|
+
(0, utils_1.checkFileExists)(appModuleFile);
|
|
151
|
+
// Checking if the ErrorHandler is already present in the providers array,
|
|
152
|
+
// and if it is, we skip adding it
|
|
153
|
+
if (options?.preExistingErrorHandler) {
|
|
154
|
+
(0, utils_1.checkFileDoesNotContain)(appModuleFile, 'Sentry.createErrorHandler()');
|
|
155
|
+
}
|
|
156
|
+
(0, utils_1.checkFileContents)(appModuleFile, [
|
|
157
|
+
`import * as Sentry from '@sentry/angular'`,
|
|
158
|
+
options?.preExistingErrorHandler
|
|
159
|
+
? `provide: ErrorHandler,
|
|
160
|
+
useValue: null`
|
|
161
|
+
: `provide: ErrorHandler,
|
|
162
|
+
useValue: Sentry.createErrorHandler()`,
|
|
163
|
+
`provide: Sentry.TraceService,
|
|
164
|
+
deps: [Router]`,
|
|
165
|
+
`provideAppInitializer(() => {
|
|
166
|
+
inject(Sentry.TraceService);
|
|
167
|
+
})`,
|
|
168
|
+
]);
|
|
169
|
+
});
|
|
170
|
+
(0, vitest_1.test)('angular.json is updated correctly', async () => {
|
|
171
|
+
const angularJsonFile = path.resolve(projectDir, 'angular.json');
|
|
172
|
+
(0, utils_1.checkFileExists)(angularJsonFile);
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
+
const angularJson = (await import(angularJsonFile));
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
176
|
+
for (const [, project] of Object.entries(
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
178
|
+
angularJson.projects)) {
|
|
179
|
+
(0, vitest_1.expect)(
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
181
|
+
project?.architect?.build?.configurations?.production?.sourceMap).toBe(true);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
(0, vitest_1.test)('builds successfully', async () => {
|
|
185
|
+
await (0, utils_1.checkIfBuilds)(projectDir);
|
|
186
|
+
});
|
|
187
|
+
(0, vitest_1.test)('runs on prod mode correctly', async () => {
|
|
188
|
+
await (0, utils_1.checkIfRunsOnProdMode)(projectDir, 'Application bundle generation complete.');
|
|
189
|
+
});
|
|
190
|
+
(0, vitest_1.test)('runs on dev mode correctly', async () => {
|
|
191
|
+
await (0, utils_1.checkIfRunsOnDevMode)(projectDir, 'Application bundle generation complete.');
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=angular-19.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-19.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/angular-19.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAkD;AAClD,oCAakB;AAClB,2CAA6B;AAC7B,oCAAqC;AACrC,mCAAqE;AAErE,iBAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,GAAG,EAAE;IACrC,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,0CAA0C,CAC3C,CAAC;QAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,MAAM,yBAAyB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,mBAAmB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,IAAA,iBAAQ,EAAC,+BAA+B,EAAE,GAAG,EAAE;QAC7C,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,0CAA0C,CAC3C,CAAC;QAEF,IAAA,kBAAS,EAAC,KAA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C,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EACzB,UAAU,EACV,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EACxB,UAAU,EACV,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Integration } from '../../lib/Constants';\nimport {\n checkFileContents,\n checkFileDoesNotContain,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n KEYS,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport * as path from 'path';\nimport { TEST_ARGS } from '../utils';\nimport { test, expect, describe, beforeAll, afterAll } from 'vitest';\n\ndescribe.sequential('Angular-19', () => {\n describe('with empty project', () => {\n const integration = Integration.angular;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/angular-19-test-app',\n );\n\n beforeAll(async () => {\n revertLocalChanges(projectDir);\n await runWizardOnAngularProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkAngularProject(projectDir, integration);\n });\n describe('with pre-defined ErrorHandler', () => {\n const integration = Integration.angular;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/angular-19-test-app',\n );\n\n beforeAll(async () => {\n revertLocalChanges(projectDir);\n await runWizardOnAngularProject(projectDir, integration, (projectDir) => {\n modifyFile(`${projectDir}/src/app/app.config.ts`, {\n 'providers: [': `providers: [{\n provide: ErrorHandler,\n useValue: null\n },\n `,\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkAngularProject(projectDir, integration, {\n preExistingErrorHandler: true,\n });\n });\n});\n\nasync function runWizardOnAngularProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (projectDir: string) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir, true);\n\n if (fileModificationFn) {\n fileModificationFn(projectDir);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n await wizardInstance.waitForOutput('Please select your package manager.');\n }\n\n await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000,\n optional: true,\n },\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n // The first choice here is Angular\n [KEYS.ENTER],\n 'Where are your build artifacts located?',\n {\n optional: true,\n timeout: 5000,\n },\n );\n\n const sourcemapsConfiguredPromise = wizardInstance.waitForOutput(\n 'Added a sentry:sourcemaps script to your package.json',\n );\n\n const buildScriptPromptedPromise = wizardInstance.waitForOutput(\n 'Do you want to automatically run the sentry:sourcemaps script after each production build?',\n );\n\n const optionalArtifactsNotFoundPromise = wizardInstance.waitForOutput(\n \"We couldn't find artifacts\",\n {\n optional: true,\n timeout: 5000,\n },\n );\n\n // ./dist is the default value, no need to change it\n wizardInstance.sendStdin(KEYS.ENTER);\n\n const optionalArtifactsNotFoundPrompted =\n await optionalArtifactsNotFoundPromise;\n\n if (optionalArtifactsNotFoundPrompted) {\n wizardInstance.sendStdin(KEYS.DOWN);\n wizardInstance.sendStdin(KEYS.ENTER);\n }\n\n await sourcemapsConfiguredPromise;\n await buildScriptPromptedPromise;\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, automatically add sentry:sourcemaps script\n 'Is yarn build your production build command?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, yarn build is the production build command\n 'Are you using a CI/CD tool to build and deploy your application?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.DOWN, KEYS.ENTER], // no CI/CD tool\n 'Do you want to create an example component to test your Sentry setup?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, create example component\n 'Did you apply the snippet above?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, applied the snippet\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n );\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER], // yes, run prettier\n 'Successfully installed the Sentry Angular SDK!',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkAngularProject(\n projectDir: string,\n integration: Integration,\n options?: {\n preExistingErrorHandler?: boolean;\n },\n) {\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n\n const packageJsonFile = path.resolve(projectDir, 'package.json');\n checkFileContents(packageJsonFile, [\n `\"sentry:sourcemaps\": \"sentry-cli sourcemaps inject --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist && sentry-cli sourcemaps upload --org ${TEST_ARGS.ORG_SLUG} --project ${TEST_ARGS.PROJECT_SLUG} ./dist\"`,\n `\"build\": \"ng build && yarn sentry:sourcemaps\"`,\n ]);\n });\n\n test('Sentry is correctly injected into Angular app config', () => {\n const appConfigFile = path.resolve(projectDir, 'src/main.ts');\n checkFileExists(appConfigFile);\n\n checkFileContents(appConfigFile, [\n `import * as Sentry from '@sentry/angular'`,\n 'Sentry.init({',\n TEST_ARGS.PROJECT_DSN,\n 'Sentry.browserTracingIntegration()',\n 'Sentry.replayIntegration()',\n 'tracesSampleRate: 1',\n 'replaysSessionSampleRate: 0.1',\n 'replaysOnErrorSampleRate: 1',\n ]);\n });\n\n test('Sentry is correctly injected into Angular app module', () => {\n const appModuleFile = path.resolve(projectDir, 'src/app/app.config.ts');\n checkFileExists(appModuleFile);\n\n // Checking if the ErrorHandler is already present in the providers array,\n // and if it is, we skip adding it\n if (options?.preExistingErrorHandler) {\n checkFileDoesNotContain(appModuleFile, 'Sentry.createErrorHandler()');\n }\n\n checkFileContents(appModuleFile, [\n `import * as Sentry from '@sentry/angular'`,\n options?.preExistingErrorHandler\n ? `provide: ErrorHandler,\n useValue: null`\n : `provide: ErrorHandler,\n useValue: Sentry.createErrorHandler()`,\n `provide: Sentry.TraceService,\n deps: [Router]`,\n `provideAppInitializer(() => {\n inject(Sentry.TraceService);\n })`,\n ]);\n });\n\n test('angular.json is updated correctly', async () => {\n const angularJsonFile = path.resolve(projectDir, 'angular.json');\n checkFileExists(angularJsonFile);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const angularJson = (await import(angularJsonFile)) as Record<string, any>;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const [, project] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n angularJson.projects as Record<string, any>,\n )) {\n expect(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n project?.architect?.build?.configurations?.production?.sourceMap,\n ).toBe(true);\n }\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n 'Application bundle generation complete.',\n );\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|