Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
- Bump CLI from v2.55.0 to v2.56.0 ([#5223](https://github.com/getsentry/sentry-react-native/pull/5223))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2560)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.55.0...2.56.0)
- Bump JavaScript SDK from v10.12.0 to v10.17.0 ([#5195](https://github.com/getsentry/sentry-react-native/pull/5195))
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#10170)
- [diff](https://github.com/getsentry/sentry-javascript/compare/10.12.0...10.17.0)

## 7.2.0

Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@babel/preset-env": "^7.25.3",
"@babel/preset-typescript": "^7.18.6",
"@sentry/core": "10.12.0",
"@sentry/core": "10.17.0",
"@sentry/react-native": "7.2.0",
"@types/node": "^20.9.3",
"@types/react": "^18.2.64",
Expand Down
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@
},
"dependencies": {
"@sentry/babel-plugin-component-annotate": "4.3.0",
"@sentry/browser": "10.12.0",
"@sentry/browser": "10.17.0",
"@sentry/cli": "2.56.0",
"@sentry/core": "10.12.0",
"@sentry/react": "10.12.0",
"@sentry/types": "10.12.0"
"@sentry/core": "10.17.0",
"@sentry/react": "10.17.0",
"@sentry/types": "10.17.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@expo/metro-config": "~0.20.0",
"@mswjs/interceptors": "^0.25.15",
"@react-native/babel-preset": "0.77.1",
"@sentry-internal/eslint-config-sdk": "10.12.0",
"@sentry-internal/eslint-plugin-sdk": "10.12.0",
"@sentry-internal/typescript": "10.12.0",
"@sentry-internal/eslint-config-sdk": "10.17.0",
"@sentry-internal/eslint-plugin-sdk": "10.17.0",
"@sentry-internal/typescript": "10.17.0",
"@sentry/wizard": "6.5.0",
"@testing-library/react-native": "^12.7.2",
"@types/jest": "^29.5.13",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class ReactNativeClient extends Client<ReactNativeClientOptions> {
public close(): PromiseLike<boolean> {
// As super.close() flushes queued events, we wait for that to finish before closing the native SDK.
return super.close().then((result: boolean) => {
return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;
return NATIVE.closeNativeSdk().then(() => result);
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/touchevents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function getFileName(props: Record<string, unknown>): string | undefined {

function getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {
return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0
? props[SENTRY_LABEL_PROP_KEY] as string
? props[SENTRY_LABEL_PROP_KEY]
// For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in
// the "check-label" if sentence, so we have to assign it to a variable here first
: typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/tracing/reactnativetracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ export function getCurrentReactNativeTracingIntegration(): ReactNativeTracingInt
* Returns React Native Tracing integration of given client.
*/
export function getReactNativeTracingIntegration(client: Client): ReactNativeTracingIntegration | undefined {
return client.getIntegrationByName(INTEGRATION_NAME) as ReactNativeTracingIntegration | undefined;
return client.getIntegrationByName(INTEGRATION_NAME);
}
2 changes: 1 addition & 1 deletion packages/core/src/js/tracing/reactnavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const reactNavigationIntegration = ({
debug.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`);
return;
}
navigationContainer = newNavigationContainer as NavigationContainer;
navigationContainer = newNavigationContainer;

if (!navigationContainer) {
debug.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ export const NATIVE: SentryNativeWrapper = {
throw this._NativeClientError;
}
const ignoreErrorsStr = options.ignoreErrors?.filter(item => typeof item === 'string') as string[] | undefined;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const ignoreErrorsRegex = options.ignoreErrors
?.filter(item => item instanceof RegExp)
.map(item => (item as RegExp).source) as string[] | undefined;
Expand Down
12 changes: 6 additions & 6 deletions packages/core/test/integrations/logEnricherIntegration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('LogEnricher Integration', () => {
// Extract the log handler
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
expect(beforeCaptureLogCall).toBeDefined();
logHandler = beforeCaptureLogCall![1] as (log: Log) => void;
logHandler = beforeCaptureLogCall[1];

mockLog = {
message: 'Test log message',
Expand Down Expand Up @@ -245,7 +245,7 @@ describe('LogEnricher Integration', () => {

const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
expect(beforeCaptureLogCall).toBeDefined();
const newLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
const newLogHandler = beforeCaptureLogCall[1];

newLogHandler(mockLog);

Expand Down Expand Up @@ -291,7 +291,7 @@ describe('LogEnricher Integration', () => {

const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
expect(beforeCaptureLogCall).toBeDefined();
const emptyLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
const emptyLogHandler = beforeCaptureLogCall[1];

emptyLogHandler(mockLog);

Expand Down Expand Up @@ -323,7 +323,7 @@ describe('LogEnricher Integration', () => {

const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
expect(beforeCaptureLogCall).toBeDefined();
const partialLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
const partialLogHandler = beforeCaptureLogCall[1];

partialLogHandler(mockLog);

Expand Down Expand Up @@ -357,7 +357,7 @@ describe('LogEnricher Integration', () => {

const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
expect(beforeCaptureLogCall).toBeDefined();
const partialLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
const partialLogHandler = beforeCaptureLogCall[1];

partialLogHandler(mockLog);

Expand Down Expand Up @@ -447,7 +447,7 @@ describe('LogEnricher Integration', () => {

const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
expect(beforeCaptureLogCall).toBeDefined();
logHandler = beforeCaptureLogCall![1] as (log: Log) => void;
logHandler = beforeCaptureLogCall[1];

mockLog = {
message: 'Test log message',
Expand Down
18 changes: 9 additions & 9 deletions packages/core/test/tracing/addTracingExtensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Tracing extensions', () => {
test('transaction has default op', async () => {
const transaction = startSpanManual({ name: 'parent' }, span => span);

expect(spanToJSON(transaction!)).toEqual(
expect(spanToJSON(transaction)).toEqual(
expect.objectContaining({
op: 'default',
}),
Expand All @@ -25,7 +25,7 @@ describe('Tracing extensions', () => {
test('transaction does not overwrite custom op', async () => {
const transaction = startSpanManual({ name: 'parent', op: 'custom' }, span => span);

expect(spanToJSON(transaction!)).toEqual(
expect(spanToJSON(transaction)).toEqual(
expect.objectContaining({
op: 'custom',
}),
Expand All @@ -36,7 +36,7 @@ describe('Tracing extensions', () => {
startSpanManual({ name: 'parent', scope: getCurrentScope() }, () => {});
const span = startSpanManual({ name: 'child', scope: getCurrentScope() }, span => span);

expect(spanToJSON(span!)).toEqual(
expect(spanToJSON(span)).toEqual(
expect.objectContaining({
op: 'default',
}),
Expand All @@ -47,7 +47,7 @@ describe('Tracing extensions', () => {
startSpanManual({ name: 'parent', op: 'custom', scope: getCurrentScope() }, () => {});
const span = startSpanManual({ name: 'child', op: 'custom', scope: getCurrentScope() }, span => span);

expect(spanToJSON(span!)).toEqual(
expect(spanToJSON(span)).toEqual(
expect.objectContaining({
op: 'custom',
}),
Expand All @@ -60,22 +60,22 @@ describe('Tracing extensions', () => {
childSpan = startSpanManual({ name: 'child', scope: getCurrentScope() }, __span => __span);
return _span;
});
childSpan!.end();
transaction!.end();
childSpan.end();
transaction.end();

await client.flush();
expect(client.event).toEqual(
expect.objectContaining({
contexts: expect.objectContaining({
trace: expect.objectContaining({
trace_id: transaction!.spanContext().traceId,
trace_id: transaction.spanContext().traceId,
}),
}),
}),
);
expect(spanToJSON(childSpan!)).toEqual(
expect(spanToJSON(childSpan)).toEqual(
expect.objectContaining({
parent_span_id: spanToJSON(transaction!).span_id,
parent_span_id: spanToJSON(transaction).span_id,
}),
);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/tracing/integrations/appStart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ function expectEventWithStandaloneColdAppStart(
timestamp: expect.any(Number),
trace_id: expect.any(String),
span_id: expect.any(String),
parent_span_id: actualEvent!.contexts!.trace!.span_id,
parent_span_id: actualEvent.contexts.trace.span_id,
origin: SPAN_ORIGIN_AUTO_APP_START,
status: 'ok',
data: {
Expand Down Expand Up @@ -1248,7 +1248,7 @@ function expectEventWithStandaloneWarmAppStart(
timestamp: expect.any(Number),
trace_id: expect.any(String),
span_id: expect.any(String),
parent_span_id: actualEvent!.contexts!.trace!.span_id,
parent_span_id: actualEvent.contexts.trace.span_id,
origin: SPAN_ORIGIN_AUTO_APP_START,
status: 'ok',
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('StallTracking', () => {
jest.runOnlyPendingTimers();
});
jest.runOnlyPendingTimers();
rootSpan!.end(childSpanEnd);
rootSpan.end(childSpanEnd);

await client.flush();

Expand All @@ -169,7 +169,7 @@ describe('StallTracking', () => {
jest.runOnlyPendingTimers();
});
jest.runOnlyPendingTimers();
rootSpan!.end(childSpanEnd! + 20);
rootSpan.end(childSpanEnd! + 20);

await client.flush();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe('User Interaction Tracing', () => {
op: 'different.op',
}),
);
expect(firstTransactionEvent!.timestamp).toBeGreaterThanOrEqual(spanToJSON(secondTransaction!).start_timestamp!);
expect(firstTransactionEvent.timestamp).toBeGreaterThanOrEqual(spanToJSON(secondTransaction).start_timestamp);
});

test('different UI event and same element finish first transaction with last span', () => {
Expand Down Expand Up @@ -252,9 +252,9 @@ describe('User Interaction Tracing', () => {

const firstTransactionContext = spanToJSON(firstTransaction!);
const secondTransactionContext = spanToJSON(secondTransaction!);
expect(firstTransactionContext!.timestamp).toEqual(expect.any(Number));
expect(secondTransactionContext!.timestamp).toEqual(expect.any(Number));
expect(firstTransactionContext!.span_id).not.toEqual(secondTransactionContext!.span_id);
expect(firstTransactionContext.timestamp).toEqual(expect.any(Number));
expect(secondTransactionContext.timestamp).toEqual(expect.any(Number));
expect(firstTransactionContext.span_id).not.toEqual(secondTransactionContext.span_id);
});

test('do not start UI event transaction if active transaction on scope', () => {
Expand Down Expand Up @@ -297,7 +297,7 @@ describe('User Interaction Tracing', () => {
timestamp: expect.any(Number),
}),
);
expect(interactionTransactionContext!.timestamp).toBeLessThanOrEqual(routingTransactionContext!.start_timestamp!);
expect(interactionTransactionContext.timestamp).toBeLessThanOrEqual(routingTransactionContext.start_timestamp);
});

test('does not start UI span when app is in background', () => {
Expand Down
16 changes: 8 additions & 8 deletions packages/core/test/tracing/reactnavigation.ttid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ describe('React Navigation - TTID', () => {
TestRenderer.render(<TimeToFullDisplay record />);
mockRecordedTimeToDisplay({
ttidNavigation: {
[spanToJSON(getActiveSpan()!).span_id!]: nowInSeconds(),
[spanToJSON(getActiveSpan()).span_id]: nowInSeconds(),
},
ttfd: {
[spanToJSON(getActiveSpan()!).span_id!]: nowInSeconds(),
[spanToJSON(getActiveSpan()).span_id]: nowInSeconds(),
},
});

Expand Down Expand Up @@ -362,10 +362,10 @@ describe('React Navigation - TTID', () => {
TestRenderer.render(<TimeToFullDisplay record />);
mockRecordedTimeToDisplay({
ttidNavigation: {
[spanToJSON(getActiveSpan()!).span_id!]: timestampInSeconds(),
[spanToJSON(getActiveSpan()).span_id]: timestampInSeconds(),
},
ttfd: {
[spanToJSON(getActiveSpan()!).span_id!]: timestampInSeconds() - 1,
[spanToJSON(getActiveSpan()).span_id]: timestampInSeconds() - 1,
},
});

Expand All @@ -389,10 +389,10 @@ describe('React Navigation - TTID', () => {
TestRenderer.render(<TimeToFullDisplay record />);
mockRecordedTimeToDisplay({
ttidNavigation: {
[spanToJSON(getActiveSpan()!).span_id!]: timestampInSeconds(),
[spanToJSON(getActiveSpan()).span_id]: timestampInSeconds(),
},
ttfd: {
[spanToJSON(getActiveSpan()!).span_id!]: timestampInSeconds(),
[spanToJSON(getActiveSpan()).span_id]: timestampInSeconds(),
},
});

Expand Down Expand Up @@ -489,7 +489,7 @@ describe('React Navigation - TTID', () => {
timeToDisplayComponent.update(<TimeToInitialDisplay record />);
mockRecordedTimeToDisplay({
ttid: {
[spanToJSON(getActiveSpan()!).span_id!]: manualInitialDisplayEndTimestampMs / 1_000,
[spanToJSON(getActiveSpan()).span_id]: manualInitialDisplayEndTimestampMs / 1_000,
},
});

Expand Down Expand Up @@ -670,7 +670,7 @@ describe('React Navigation - TTID', () => {
function mockAutomaticTimeToDisplay(): void {
mockRecordedTimeToDisplay({
ttidNavigation: {
[spanToJSON(getActiveSpan()!).span_id!]: nowInSeconds(),
[spanToJSON(getActiveSpan()).span_id]: nowInSeconds(),
},
});
}
Expand Down
Loading
Loading