-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore(angular): Add Angular 21 Support #18274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
dev-packages/e2e-tests/test-applications/angular-21/.editorconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Editor configuration, see https://editorconfig.org | ||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| indent_style = space | ||
| indent_size = 2 | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|
|
||
| [*.ts] | ||
| quote_type = single | ||
| ij_typescript_use_double_quotes = false | ||
|
|
||
| [*.md] | ||
| max_line_length = off | ||
| trim_trailing_whitespace = false |
44 changes: 44 additions & 0 deletions
44
dev-packages/e2e-tests/test-applications/angular-21/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. | ||
|
|
||
| # Compiled output | ||
| /dist | ||
| /tmp | ||
| /out-tsc | ||
| /bazel-out | ||
|
|
||
| # Node | ||
| /node_modules | ||
| npm-debug.log | ||
| yarn-error.log | ||
|
|
||
| # IDEs and editors | ||
| .idea/ | ||
| .project | ||
| .classpath | ||
| .c9/ | ||
| *.launch | ||
| .settings/ | ||
| *.sublime-workspace | ||
|
|
||
| # Visual Studio Code | ||
| .vscode/* | ||
| !.vscode/settings.json | ||
| !.vscode/tasks.json | ||
| !.vscode/launch.json | ||
| !.vscode/extensions.json | ||
| .history/* | ||
|
|
||
| # Miscellaneous | ||
| /.angular/cache | ||
| .sass-cache/ | ||
| /connect.lock | ||
| /coverage | ||
| /libpeerconnection.log | ||
| testem.log | ||
| /typings | ||
|
|
||
| # System files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| test-results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @sentry:registry=http://127.0.0.1:4873 | ||
| @sentry-internal:registry=http://127.0.0.1:4873 |
3 changes: 3 additions & 0 deletions
3
dev-packages/e2e-tests/test-applications/angular-21/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Angular 20 | ||
|
|
||
| E2E test app for Angular 20 and `@sentry/angular`. |
87 changes: 87 additions & 0 deletions
87
dev-packages/e2e-tests/test-applications/angular-21/angular.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| { | ||
| "$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
| "version": 1, | ||
| "newProjectRoot": "projects", | ||
| "projects": { | ||
| "angular-20": { | ||
| "projectType": "application", | ||
| "schematics": {}, | ||
| "root": "", | ||
| "sourceRoot": "src", | ||
| "prefix": "app", | ||
| "architect": { | ||
| "build": { | ||
| "builder": "@angular-devkit/build-angular:application", | ||
| "options": { | ||
| "outputPath": "dist/angular-20", | ||
| "index": "src/index.html", | ||
| "browser": "src/main.ts", | ||
| "polyfills": ["zone.js"], | ||
| "tsConfig": "tsconfig.app.json", | ||
| "assets": [ | ||
| { | ||
| "glob": "**/*", | ||
| "input": "public" | ||
| } | ||
| ], | ||
| "styles": ["src/styles.css"], | ||
| "scripts": [] | ||
| }, | ||
| "configurations": { | ||
| "production": { | ||
| "budgets": [ | ||
| { | ||
| "type": "initial", | ||
| "maximumWarning": "500kB", | ||
| "maximumError": "1MB" | ||
| }, | ||
| { | ||
| "type": "anyComponentStyle", | ||
| "maximumWarning": "4kB", | ||
| "maximumError": "8kB" | ||
| } | ||
| ], | ||
| "outputHashing": "all" | ||
| }, | ||
| "development": { | ||
| "optimization": false, | ||
| "extractLicenses": false, | ||
| "sourceMap": true | ||
| } | ||
| }, | ||
| "defaultConfiguration": "production" | ||
| }, | ||
| "serve": { | ||
| "builder": "@angular-devkit/build-angular:dev-server", | ||
| "configurations": { | ||
| "production": { | ||
| "buildTarget": "angular-20:build:production" | ||
| }, | ||
| "development": { | ||
| "buildTarget": "angular-20:build:development" | ||
| } | ||
| }, | ||
| "defaultConfiguration": "development" | ||
| }, | ||
| "extract-i18n": { | ||
| "builder": "@angular-devkit/build-angular:extract-i18n" | ||
| }, | ||
| "test": { | ||
| "builder": "@angular-devkit/build-angular:karma", | ||
| "options": { | ||
| "polyfills": ["zone.js", "zone.js/testing"], | ||
| "tsConfig": "tsconfig.spec.json", | ||
| "assets": [ | ||
| { | ||
| "glob": "**/*", | ||
| "input": "public" | ||
| } | ||
| ], | ||
| "styles": ["src/styles.css"], | ||
| "scripts": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
60 changes: 60 additions & 0 deletions
60
dev-packages/e2e-tests/test-applications/angular-21/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| { | ||
| "name": "angular-21", | ||
| "version": "0.0.0", | ||
| "scripts": { | ||
| "ng": "ng", | ||
| "dev": "ng serve", | ||
| "proxy": "node start-event-proxy.mjs", | ||
| "preview": "http-server dist/angular-21/browser --port 8080 --silent", | ||
| "build": "ng build", | ||
| "watch": "ng build --watch --configuration development", | ||
| "test": "playwright test", | ||
| "test:build": "pnpm install && pnpm build", | ||
| "test:build-canary": "pnpm install && pnpm add @angular/animations@next @angular/common@next @angular/compiler@next @angular/core@next @angular/forms@next @angular/platform-browser@next @angular/platform-browser-dynamic@next @angular/router@next && pnpm add -D @angular-devkit/build-angular@next @angular/cli@next @angular/compiler-cli@next && pnpm build", | ||
| "test:assert": "playwright test", | ||
| "clean": "npx rimraf .angular node_modules pnpm-lock.yaml dist" | ||
| }, | ||
| "private": true, | ||
| "dependencies": { | ||
| "@angular/animations": "^21.0.0", | ||
| "@angular/common": "^21.0.0", | ||
| "@angular/compiler": "^21.0.0", | ||
| "@angular/core": "^21.0.0", | ||
| "@angular/forms": "^21.0.0", | ||
| "@angular/platform-browser": "^21.0.0", | ||
| "@angular/platform-browser-dynamic": "^21.0.0", | ||
| "@angular/router": "^21.0.0", | ||
| "@sentry/angular": "* || latest", | ||
| "rxjs": "~7.8.0", | ||
| "tslib": "^2.3.0", | ||
| "zone.js": "~0.15.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@angular-devkit/build-angular": "^21.0.0", | ||
| "@angular/cli": "^21.0.0", | ||
| "@angular/compiler-cli": "^21.0.0", | ||
| "@playwright/test": "~1.53.2", | ||
| "@sentry-internal/test-utils": "link:../../../test-utils", | ||
| "@sentry/core": "latest || *", | ||
| "@types/jasmine": "~5.1.0", | ||
| "http-server": "^14.1.1", | ||
| "jasmine-core": "~5.4.0", | ||
| "karma": "~6.4.0", | ||
| "karma-chrome-launcher": "~3.2.0", | ||
| "karma-coverage": "~2.2.0", | ||
| "karma-jasmine": "~5.1.0", | ||
| "karma-jasmine-html-reporter": "~2.1.0", | ||
| "typescript": "~5.9.0" | ||
| }, | ||
| "volta": { | ||
| "extends": "../../package.json" | ||
| }, | ||
| "sentryTest": { | ||
| "optionalVariants": [ | ||
| { | ||
| "build-command": "pnpm test:build-canary", | ||
| "label": "angular (canary)" | ||
| } | ||
| ] | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
dev-packages/e2e-tests/test-applications/angular-21/playwright.config.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { getPlaywrightConfig } from '@sentry-internal/test-utils'; | ||
|
|
||
| const config = getPlaywrightConfig({ | ||
| startCommand: `pnpm preview`, | ||
| port: 8080, | ||
| }); | ||
|
|
||
| export default config; |
Binary file added
BIN
+14.7 KB
dev-packages/e2e-tests/test-applications/angular-21/public/favicon.ico
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
dev-packages/e2e-tests/test-applications/angular-21/src/app/app.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { RouterOutlet } from '@angular/router'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-root', | ||
| standalone: true, | ||
| imports: [RouterOutlet], | ||
| template: `<router-outlet></router-outlet>`, | ||
| }) | ||
| export class AppComponent { | ||
| title = 'angular-20'; | ||
| } |
29 changes: 29 additions & 0 deletions
29
dev-packages/e2e-tests/test-applications/angular-21/src/app/app.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { | ||
| ApplicationConfig, | ||
| ErrorHandler, | ||
| inject, | ||
| provideAppInitializer, | ||
| provideZoneChangeDetection, | ||
| } from '@angular/core'; | ||
| import { Router, provideRouter } from '@angular/router'; | ||
|
|
||
| import { TraceService, createErrorHandler } from '@sentry/angular'; | ||
| import { routes } from './app.routes'; | ||
|
|
||
| export const appConfig: ApplicationConfig = { | ||
| providers: [ | ||
| provideZoneChangeDetection({ eventCoalescing: true }), | ||
| provideRouter(routes), | ||
| { | ||
| provide: ErrorHandler, | ||
| useValue: createErrorHandler(), | ||
| }, | ||
| { | ||
| provide: TraceService, | ||
| deps: [Router], | ||
| }, | ||
| provideAppInitializer(() => { | ||
| inject(TraceService); | ||
| }), | ||
| ], | ||
| }; |
42 changes: 42 additions & 0 deletions
42
dev-packages/e2e-tests/test-applications/angular-21/src/app/app.routes.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { Routes } from '@angular/router'; | ||
| import { cancelGuard } from './cancel-guard.guard'; | ||
| import { CancelComponent } from './cancel/cancel.components'; | ||
| import { ComponentTrackingComponent } from './component-tracking/component-tracking.components'; | ||
| import { HomeComponent } from './home/home.component'; | ||
| import { UserComponent } from './user/user.component'; | ||
|
|
||
| export const routes: Routes = [ | ||
| { | ||
| path: 'users/:id', | ||
| component: UserComponent, | ||
| }, | ||
| { | ||
| path: 'home', | ||
| component: HomeComponent, | ||
| }, | ||
| { | ||
| path: 'cancel', | ||
| component: CancelComponent, | ||
| canActivate: [cancelGuard], | ||
| }, | ||
| { | ||
| path: 'component-tracking', | ||
| component: ComponentTrackingComponent, | ||
| }, | ||
| { | ||
| path: 'redirect1', | ||
| redirectTo: '/redirect2', | ||
| }, | ||
| { | ||
| path: 'redirect2', | ||
| redirectTo: '/redirect3', | ||
| }, | ||
| { | ||
| path: 'redirect3', | ||
| redirectTo: '/users/456', | ||
| }, | ||
| { | ||
| path: '**', | ||
| redirectTo: 'home', | ||
| }, | ||
| ]; |
5 changes: 5 additions & 0 deletions
5
dev-packages/e2e-tests/test-applications/angular-21/src/app/cancel-guard.guard.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot } from '@angular/router'; | ||
|
|
||
| export const cancelGuard: CanActivateFn = (_next: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => { | ||
| return false; | ||
| }; |
8 changes: 8 additions & 0 deletions
8
dev-packages/e2e-tests/test-applications/angular-21/src/app/cancel/cancel.components.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { Component } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-cancel', | ||
| standalone: true, | ||
| template: `<div></div>`, | ||
| }) | ||
| export class CancelComponent {} |
21 changes: 21 additions & 0 deletions
21
.../test-applications/angular-21/src/app/component-tracking/component-tracking.components.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { AfterViewInit, Component, OnInit } from '@angular/core'; | ||
| import { TraceClass, TraceMethod, TraceModule } from '@sentry/angular'; | ||
| import { SampleComponent } from '../sample-component/sample-component.components'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-component-tracking', | ||
| standalone: true, | ||
| imports: [TraceModule, SampleComponent], | ||
| template: ` | ||
| <app-sample-component trace="sample-component"></app-sample-component> | ||
| <app-sample-component trace></app-sample-component> | ||
| `, | ||
| }) | ||
| @TraceClass({ name: 'ComponentTrackingComponent' }) | ||
| export class ComponentTrackingComponent implements OnInit, AfterViewInit { | ||
| @TraceMethod({ name: 'ngOnInit' }) | ||
| ngOnInit() {} | ||
|
|
||
| @TraceMethod() | ||
| ngAfterViewInit() {} | ||
| } |
26 changes: 26 additions & 0 deletions
26
dev-packages/e2e-tests/test-applications/angular-21/src/app/home/home.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { RouterLink } from '@angular/router'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-home', | ||
| standalone: true, | ||
| imports: [RouterLink], | ||
| template: ` | ||
| <main> | ||
| <h1>Welcome to Sentry's Angular 20 E2E test app</h1> | ||
Lms24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <ul> | ||
| <li><a id="navLink" [routerLink]="['/users', '123']">Visit User 123</a></li> | ||
| <li><a id="redirectLink" [routerLink]="['/redirect1']">Redirect</a></li> | ||
| <li><a id="cancelLink" [routerLink]="['/cancel']">Cancel</a></li> | ||
| <li><a id="nonExistentLink" [routerLink]="['/non-existent']">Error</a></li> | ||
| <li><a id="componentTracking" [routerLink]="['/component-tracking']">Component Tracking</a></li> | ||
| </ul> | ||
| <button id="errorBtn" (click)="throwError()">Throw error</button> | ||
| </main> | ||
| `, | ||
| }) | ||
| export class HomeComponent { | ||
| throwError() { | ||
| throw new Error('Error thrown from Angular 20 E2E test app'); | ||
Lms24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
12 changes: 12 additions & 0 deletions
12
...ests/test-applications/angular-21/src/app/sample-component/sample-component.components.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { Component, OnInit } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-sample-component', | ||
| standalone: true, | ||
| template: `<div>Component</div>`, | ||
| }) | ||
| export class SampleComponent implements OnInit { | ||
| ngOnInit() { | ||
| console.log('SampleComponent'); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.