Skip to content

Commit 7a324dd

Browse files
Merge branch 'develop' into priscila/feat/add-remix-e2e-test
2 parents f675847 + ac435dd commit 7a324dd

File tree

225 files changed

+3331
-2266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+3331
-2266
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
- 'scripts/**'
9090
- 'packages/core/**'
9191
- 'packages/tracing/**'
92+
- 'packages/tracing-internal/**'
9293
- 'packages/utils/**'
9394
- 'packages/types/**'
9495
- 'packages/integrations/**'
@@ -424,7 +425,7 @@ jobs:
424425
name: Nextjs (Node ${{ matrix.node }}) Tests
425426
needs: [job_get_metadata, job_build]
426427
if: needs.job_get_metadata.outputs.changed_nextjs == 'true' || github.event_name != 'pull_request'
427-
timeout-minutes: 15
428+
timeout-minutes: 25
428429
runs-on: ubuntu-20.04
429430
strategy:
430431
fail-fast: false
@@ -684,7 +685,7 @@ jobs:
684685
yarn test
685686
686687
job_remix_integration_tests:
687-
name: Remix (Node ${{ matrix.node }}) Tests
688+
name: Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
688689
needs: [job_get_metadata, job_build]
689690
if: needs.job_get_metadata.outputs.changed_remix == 'true' || github.event_name != 'pull_request'
690691
runs-on: ubuntu-20.04
@@ -693,6 +694,7 @@ jobs:
693694
fail-fast: false
694695
matrix:
695696
node: [14, 16, 18]
697+
remix: [1, 2]
696698
steps:
697699
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
698700
uses: actions/checkout@v3
@@ -709,6 +711,7 @@ jobs:
709711
- name: Run integration tests
710712
env:
711713
NODE_VERSION: ${{ matrix.node }}
714+
REMIX_VERSION: ${{ matrix.remix }}
712715
run: |
713716
cd packages/remix
714717
yarn test:integration:ci

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
## 7.56.0
8+
9+
- feat(replay): Rework slow click & multi click detection (#8322)
10+
- feat(replay): Stop replay when event buffer exceeds max. size (#8315)
11+
- feat(replay): Consider `window.open` for slow clicks (#8308)
12+
- fix(core): Temporarily store debug IDs in stack frame and only put them into `debug_meta` before sending (#8347)
13+
- fix(remix): Extract deferred responses correctly in root loaders. (#8305)
14+
- fix(vue): Don't call `next` in Vue router 4 instrumentation (#8351)
15+
716
## 7.55.2
817

918
- fix(replay): Stop exporting `EventType` from `@sentry-internal/rrweb` (#8334)

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "7.55.2",
3+
"version": "7.56.0",
44
"npmClient": "yarn",
55
"useWorkspaces": true
66
}

packages/angular-ivy/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/angular-ivy",
3-
"version": "7.55.2",
3+
"version": "7.56.0",
44
"description": "Official Sentry SDK for Angular with full Ivy Support",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy",
@@ -21,9 +21,9 @@
2121
"rxjs": "^6.5.5 || ^7.x"
2222
},
2323
"dependencies": {
24-
"@sentry/browser": "7.55.2",
25-
"@sentry/types": "7.55.2",
26-
"@sentry/utils": "7.55.2",
24+
"@sentry/browser": "7.56.0",
25+
"@sentry/types": "7.56.0",
26+
"@sentry/utils": "7.56.0",
2727
"tslib": "^2.3.0"
2828
},
2929
"devDependencies": {

packages/angular-ivy/src/sdk.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VERSION } from '@angular/core';
22
import type { BrowserOptions } from '@sentry/browser';
3-
import { init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
3+
import { defaultIntegrations, init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
44
import { logger } from '@sentry/utils';
55

66
import { IS_DEBUG_BUILD } from './flags';
@@ -21,6 +21,18 @@ export function init(options: BrowserOptions): void {
2121
version: SDK_VERSION,
2222
};
2323

24+
// Filter out TryCatch integration as it interferes with our Angular `ErrorHandler`:
25+
// TryCatch would catch certain errors before they reach the `ErrorHandler` and thus provide a
26+
// lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide.
27+
// see:
28+
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
29+
// - https://github.com/getsentry/sentry-javascript/issues/2744
30+
if (options.defaultIntegrations === undefined) {
31+
options.defaultIntegrations = defaultIntegrations.filter(integration => {
32+
return integration.name !== 'TryCatch';
33+
});
34+
}
35+
2436
checkAndSetAngularVersion();
2537
browserInit(options);
2638
}

packages/angular/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/angular",
3-
"version": "7.55.2",
3+
"version": "7.56.0",
44
"description": "Official Sentry SDK for Angular",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular",
@@ -21,9 +21,9 @@
2121
"rxjs": "^6.5.5 || ^7.x"
2222
},
2323
"dependencies": {
24-
"@sentry/browser": "7.55.2",
25-
"@sentry/types": "7.55.2",
26-
"@sentry/utils": "7.55.2",
24+
"@sentry/browser": "7.56.0",
25+
"@sentry/types": "7.56.0",
26+
"@sentry/utils": "7.56.0",
2727
"tslib": "^2.0.0"
2828
},
2929
"devDependencies": {

packages/angular/src/sdk.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VERSION } from '@angular/core';
22
import type { BrowserOptions } from '@sentry/browser';
3-
import { init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
3+
import { defaultIntegrations, init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
44
import { logger } from '@sentry/utils';
55

66
import { IS_DEBUG_BUILD } from './flags';
@@ -21,6 +21,18 @@ export function init(options: BrowserOptions): void {
2121
version: SDK_VERSION,
2222
};
2323

24+
// Filter out TryCatch integration as it interferes with our Angular `ErrorHandler`:
25+
// TryCatch would catch certain errors before they reach the `ErrorHandler` and thus provide a
26+
// lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide.
27+
// see:
28+
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
29+
// - https://github.com/getsentry/sentry-javascript/issues/2744
30+
if (options.defaultIntegrations === undefined) {
31+
options.defaultIntegrations = defaultIntegrations.filter(integration => {
32+
return integration.name !== 'TryCatch';
33+
});
34+
}
35+
2436
checkAndSetAngularVersion();
2537
browserInit(options);
2638
}

packages/angular/src/tracing.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ActivatedRouteSnapshot, Event, RouterState } from '@angular/router
55
// Duplicated import to work around a TypeScript bug where it'd complain that `Router` isn't imported as a type.
66
// We need to import it as a value to satisfy Angular dependency injection. So:
77
// eslint-disable-next-line @typescript-eslint/consistent-type-imports, import/no-duplicates
8-
import { Router } from '@angular/router';
8+
import { NavigationCancel, NavigationError, Router } from '@angular/router';
99
// eslint-disable-next-line import/no-duplicates
1010
import { NavigationEnd, NavigationStart, ResolveEnd } from '@angular/router';
1111
import { getCurrentHub, WINDOW } from '@sentry/browser';
@@ -131,7 +131,9 @@ export class TraceService implements OnDestroy {
131131
);
132132

133133
public navEnd$: Observable<Event> = this._router.events.pipe(
134-
filter(event => event instanceof NavigationEnd),
134+
filter(
135+
event => event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError,
136+
),
135137
tap(() => {
136138
if (this._routingSpan) {
137139
runOutsideAngular(() => {

packages/angular/test/sdk.test.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as SentryBrowser from '@sentry/browser';
22

3-
import { init } from '../src/sdk';
3+
import { defaultIntegrations, init } from '../src/index';
44

55
describe('init', () => {
66
it('sets the Angular version (if available) in the global scope', () => {
@@ -13,4 +13,33 @@ describe('init', () => {
1313
expect(setContextSpy).toHaveBeenCalledTimes(1);
1414
expect(setContextSpy).toHaveBeenCalledWith('angular', { version: 10 });
1515
});
16+
17+
describe('filtering out the `TryCatch` integration', () => {
18+
const browserInitSpy = jest.spyOn(SentryBrowser, 'init');
19+
20+
beforeEach(() => {
21+
browserInitSpy.mockClear();
22+
});
23+
24+
it('filters if `defaultIntegrations` is not set', () => {
25+
init({});
26+
27+
expect(browserInitSpy).toHaveBeenCalledTimes(1);
28+
29+
const options = browserInitSpy.mock.calls[0][0] || {};
30+
expect(options.defaultIntegrations).not.toContainEqual(expect.objectContaining({ name: 'TryCatch' }));
31+
});
32+
33+
it.each([false as const, defaultIntegrations])(
34+
"doesn't filter if `defaultIntegrations` is set to %s",
35+
defaultIntegrations => {
36+
init({ defaultIntegrations });
37+
38+
expect(browserInitSpy).toHaveBeenCalledTimes(1);
39+
40+
const options = browserInitSpy.mock.calls[0][0] || {};
41+
expect(options.defaultIntegrations).toEqual(defaultIntegrations);
42+
},
43+
);
44+
});
1645
});

packages/angular/test/tracing.test.ts

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from '@angular/core';
2-
import type { ActivatedRouteSnapshot } from '@angular/router';
2+
import type { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
33
import type { Hub } from '@sentry/types';
44

55
import { instrumentAngularRouting, TraceClassDecorator, TraceDirective, TraceMethodDecorator } from '../src';
@@ -185,6 +185,66 @@ describe('Angular Tracing', () => {
185185
env.destroy();
186186
});
187187

188+
it('finishes routing span on navigation error', async () => {
189+
const customStartTransaction = jest.fn(defaultStartTransaction);
190+
191+
const env = await TestEnv.setup({
192+
customStartTransaction,
193+
routes: [
194+
{
195+
path: '',
196+
component: AppComponent,
197+
},
198+
],
199+
useTraceService: true,
200+
});
201+
202+
const finishMock = jest.fn();
203+
transaction.startChild = jest.fn(() => ({
204+
finish: finishMock,
205+
}));
206+
207+
await env.navigateInAngular('/somewhere');
208+
209+
expect(finishMock).toHaveBeenCalledTimes(1);
210+
211+
env.destroy();
212+
});
213+
214+
it('finishes routing span on navigation cancel', async () => {
215+
const customStartTransaction = jest.fn(defaultStartTransaction);
216+
217+
class CanActivateGuard implements CanActivate {
218+
canActivate(_route: ActivatedRouteSnapshot, _state: RouterStateSnapshot): boolean {
219+
return false;
220+
}
221+
}
222+
223+
const env = await TestEnv.setup({
224+
customStartTransaction,
225+
routes: [
226+
{
227+
path: 'cancel',
228+
component: AppComponent,
229+
canActivate: [CanActivateGuard],
230+
},
231+
],
232+
useTraceService: true,
233+
additionalProviders: [{ provide: CanActivateGuard, useClass: CanActivateGuard }],
234+
});
235+
236+
const finishMock = jest.fn();
237+
transaction.startChild = jest.fn(() => ({
238+
finish: finishMock,
239+
}));
240+
241+
await env.navigateInAngular('/cancel');
242+
243+
expect(finishMock).toHaveBeenCalledTimes(1);
244+
245+
env.destroy();
246+
});
247+
188248
describe('URL parameterization', () => {
189249
it.each([
190250
[

packages/angular/test/utils/index.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Provider } from '@angular/core';
12
import { Component, NgModule } from '@angular/core';
23
import type { ComponentFixture } from '@angular/core/testing';
34
import { TestBed } from '@angular/core/testing';
@@ -47,6 +48,7 @@ export class TestEnv {
4748
startTransactionOnPageLoad?: boolean;
4849
startTransactionOnNavigation?: boolean;
4950
useTraceService?: boolean;
51+
additionalProviders?: Provider[];
5052
}): Promise<TestEnv> {
5153
instrumentAngularRouting(
5254
conf.customStartTransaction || jest.fn(),
@@ -60,14 +62,16 @@ export class TestEnv {
6062
TestBed.configureTestingModule({
6163
imports: [AppModule, RouterTestingModule.withRoutes(routes)],
6264
declarations: [...(conf.components || []), AppComponent],
63-
providers: useTraceService
65+
providers: (useTraceService
6466
? [
6567
{
6668
provide: TraceService,
6769
deps: [Router],
6870
},
71+
...(conf.additionalProviders || []),
6972
]
70-
: [],
73+
: []
74+
).concat(...(conf.additionalProviders || [])),
7175
});
7276

7377
const router: Router = TestBed.inject(Router);
@@ -80,10 +84,16 @@ export class TestEnv {
8084
public async navigateInAngular(url: string): Promise<void> {
8185
return new Promise(resolve => {
8286
return this.fixture.ngZone?.run(() => {
83-
void this.router.navigateByUrl(url).then(() => {
84-
this.fixture.detectChanges();
85-
resolve();
86-
});
87+
void this.router
88+
.navigateByUrl(url)
89+
.then(() => {
90+
this.fixture.detectChanges();
91+
resolve();
92+
})
93+
.catch(() => {
94+
this.fixture.detectChanges();
95+
resolve();
96+
});
8797
});
8898
});
8999
}

packages/browser-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry-internal/browser-integration-tests",
3-
"version": "7.55.2",
3+
"version": "7.56.0",
44
"main": "index.js",
55
"license": "MIT",
66
"engines": {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class MyTestClass {
2+
prop1 = 'value1';
3+
prop2 = 2;
4+
}
5+
6+
Sentry.captureException(new MyTestClass());
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
7+
sentryTest('should capture an POJO', async ({ getLocalTestPath, page }) => {
8+
const url = await getLocalTestPath({ testDir: __dirname });
9+
10+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
11+
12+
expect(eventData.exception?.values).toHaveLength(1);
13+
expect(eventData.exception?.values?.[0]).toMatchObject({
14+
type: 'Error',
15+
value: 'Object captured as exception with keys: prop1, prop2',
16+
mechanism: {
17+
type: 'generic',
18+
handled: true,
19+
},
20+
});
21+
});

packages/browser-integration-tests/suites/public-api/captureException/empty_obj/test.ts renamed to packages/browser-integration-tests/suites/public-api/captureException/emptyObj/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sentryTest('should capture an empty object', async ({ getLocalTestPath, page })
1212
expect(eventData.exception?.values).toHaveLength(1);
1313
expect(eventData.exception?.values?.[0]).toMatchObject({
1414
type: 'Error',
15-
value: 'Non-Error exception captured with keys: [object has no keys]',
15+
value: 'Object captured as exception with keys: [object has no keys]',
1616
mechanism: {
1717
type: 'generic',
1818
handled: true,

0 commit comments

Comments
 (0)