Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into lforst-allowdeny-l…
Browse files Browse the repository at this point in the history
…inked-errors
  • Loading branch information
lforst committed Feb 27, 2025
2 parents 5ce81a1 + 9a55e17 commit 565a6bc
Show file tree
Hide file tree
Showing 79 changed files with 1,892 additions and 163 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

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

Work in this release was contributed by @GerryWilko. Thank you for your contribution!

## 9.2.0

### Important Changes
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "~1.50.0",
"@sentry-internal/rrweb": "2.32.0",
"@sentry-internal/rrweb": "2.33.0",
"@sentry/browser": "9.2.0",
"axios": "1.7.7",
"babel-loader": "^8.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
defaultStackParser,
functionToStringIntegration,
httpContextIntegration,
inboundFiltersIntegration,
eventFiltersIntegration,
linkedErrorsIntegration,
makeFetchTransport,
} from '@sentry/browser';
Expand All @@ -16,7 +16,7 @@ const integrations = [
functionToStringIntegration(),
dedupeIntegration(),
httpContextIntegration(),
inboundFiltersIntegration(),
eventFiltersIntegration(),
linkedErrorsIntegration(),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sentryTest('allows to setup a client manually & capture exceptions', async ({ ge
environment: 'local',
release: '0.0.1',
sdk: {
integrations: ['Breadcrumbs', 'FunctionToString', 'Dedupe', 'HttpContext', 'InboundFilters', 'LinkedErrors'],
integrations: ['Breadcrumbs', 'FunctionToString', 'Dedupe', 'HttpContext', 'EventFilters', 'LinkedErrors'],
name: 'sentry.javascript.browser',
version: expect.any(String),
packages: [{ name: expect.any(String), version: expect.any(String) }],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';
import { describe, afterAll, test } from 'vitest';

describe('ContextLines integration in CJS', () => {
afterAll(() => {
cleanupChildProcesses();
});

// Regression test for: https://github.com/getsentry/sentry-javascript/issues/14892
test('does not leak open file handles', done => {
createRunner(__dirname, 'scenario.ts')
test('does not leak open file handles', async () => {
await createRunner(__dirname, 'scenario.ts')
.expectN(10, {
event: {},
})
.start(done);
.start()
.completed();
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterAll, test } from 'vitest';
import { afterAll, test, describe } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../../../utils/runner';

afterAll(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createRunner } from '../../../../utils/runner';
import { describe, test, expect } from 'vitest'

// Graphql Instrumentation emits some spans by default on server start
const EXPECTED_START_SERVER_TRANSACTION = {
transaction: 'Test Server Start',
};

describe('GraphQL/Apollo Tests > useOperationNameForRootSpan', () => {
test('useOperationNameForRootSpan works with single query operation', done => {
test('useOperationNameForRootSpan works with single query operation', async () => {
const EXPECTED_TRANSACTION = {
transaction: 'GET /test-graphql (query GetHello)',
spans: expect.arrayContaining([
Expand All @@ -24,13 +25,14 @@ describe('GraphQL/Apollo Tests > useOperationNameForRootSpan', () => {
]),
};

createRunner(__dirname, 'scenario-query.js')
await createRunner(__dirname, 'scenario-query.js')
.expect({ transaction: EXPECTED_START_SERVER_TRANSACTION })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
.start()
.completed();
});

test('useOperationNameForRootSpan works with single mutation operation', done => {
test('useOperationNameForRootSpan works with single mutation operation', async () => {
const EXPECTED_TRANSACTION = {
transaction: 'GET /test-graphql (mutation TestMutation)',
spans: expect.arrayContaining([
Expand All @@ -50,13 +52,14 @@ describe('GraphQL/Apollo Tests > useOperationNameForRootSpan', () => {
]),
};

createRunner(__dirname, 'scenario-mutation.js')
await createRunner(__dirname, 'scenario-mutation.js')
.expect({ transaction: EXPECTED_START_SERVER_TRANSACTION })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
.start()
.completed();
});

test('useOperationNameForRootSpan ignores an invalid root span', done => {
test('useOperationNameForRootSpan ignores an invalid root span', async () => {
const EXPECTED_TRANSACTION = {
transaction: 'test span name',
spans: expect.arrayContaining([
Expand All @@ -74,13 +77,14 @@ describe('GraphQL/Apollo Tests > useOperationNameForRootSpan', () => {
]),
};

createRunner(__dirname, 'scenario-invalid-root-span.js')
await createRunner(__dirname, 'scenario-invalid-root-span.js')
.expect({ transaction: EXPECTED_START_SERVER_TRANSACTION })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
.start()
.completed();
});

test('useOperationNameForRootSpan works with single query operation without name', done => {
test('useOperationNameForRootSpan works with single query operation without name', async () => {
const EXPECTED_TRANSACTION = {
transaction: 'GET /test-graphql (query)',
spans: expect.arrayContaining([
Expand All @@ -97,13 +101,14 @@ describe('GraphQL/Apollo Tests > useOperationNameForRootSpan', () => {
]),
};

createRunner(__dirname, 'scenario-no-operation-name.js')
await createRunner(__dirname, 'scenario-no-operation-name.js')
.expect({ transaction: EXPECTED_START_SERVER_TRANSACTION })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
.start()
.completed();
});

test('useOperationNameForRootSpan works with multiple query operations', done => {
test('useOperationNameForRootSpan works with multiple query operations', async () => {
const EXPECTED_TRANSACTION = {
transaction: 'GET /test-graphql (query GetHello, query GetWorld)',
spans: expect.arrayContaining([
Expand Down Expand Up @@ -132,21 +137,23 @@ describe('GraphQL/Apollo Tests > useOperationNameForRootSpan', () => {
]),
};

createRunner(__dirname, 'scenario-multiple-operations.js')
await createRunner(__dirname, 'scenario-multiple-operations.js')
.expect({ transaction: EXPECTED_START_SERVER_TRANSACTION })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
.start()
.completed();
});

test('useOperationNameForRootSpan works with more than 5 query operations', done => {
test('useOperationNameForRootSpan works with more than 5 query operations', async () => {
const EXPECTED_TRANSACTION = {
transaction:
'GET /test-graphql (query GetHello1, query GetHello2, query GetHello3, query GetHello4, query GetHello5, +4)',
};

createRunner(__dirname, 'scenario-multiple-operations-many.js')
await createRunner(__dirname, 'scenario-multiple-operations-many.js')
.expect({ transaction: EXPECTED_START_SERVER_TRANSACTION })
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done);
.start()
.completed();
});
});
1 change: 1 addition & 0 deletions dev-packages/node-integration-tests/utils/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
SessionAggregates,
TransactionEvent,
} from '@sentry/core';
import { expect } from 'vitest';

/**
* Asserts against a Sentry Event ignoring non-deterministic properties
Expand Down
6 changes: 3 additions & 3 deletions dev-packages/node-integration-tests/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type * as http from 'http';
import { parseSemver } from '@sentry/core';
import type { EnvelopeItemType } from '@sentry/core';
import { describe } from 'vitest';

const NODE_VERSION = parseSemver(process.versions.node).major;

Expand Down Expand Up @@ -31,17 +32,16 @@ export type DataCollectorOptions = {
* Returns`describe` or `describe.skip` depending on allowed major versions of Node.
*
* @param {{ min?: number; max?: number }} allowedVersion
* @return {*} {jest.Describe}
*/
export const conditionalTest = (allowedVersion: { min?: number; max?: number }): jest.Describe => {
export function conditionalTest(allowedVersion: { min?: number; max?: number }): typeof describe | typeof describe.skip{
if (!NODE_VERSION) {
return describe.skip;
}

return NODE_VERSION < (allowedVersion.min || -Infinity) || NODE_VERSION > (allowedVersion.max || Infinity)
? describe.skip
: describe;
};
}

/**
* Parses response body containing an Envelope
Expand Down
2 changes: 2 additions & 0 deletions packages/angular/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export function getDefaultIntegrations(_options: BrowserOptions = {}): Integrati
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
// - https://github.com/getsentry/sentry-javascript/issues/2744
return [
// TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration(),
functionToStringIntegration(),
breadcrumbsIntegration(),
Expand Down
2 changes: 2 additions & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export {
graphqlIntegration,
hapiIntegration,
httpIntegration,
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration,
eventFiltersIntegration,
initOpenTelemetry,
isInitialized,
kafkaIntegration,
Expand Down
2 changes: 2 additions & 0 deletions packages/astro/test/server/index.server.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { describe, expect, it } from 'vitest';
import sentryAstro from '../../src/index.server';

describe('server SDK', () => {
it('exports the astro integration as a default export', () => {
const integration = sentryAstro();
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/server/sdk.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as SentryNode from '@sentry/node';
import { SDK_VERSION } from '@sentry/node';
import { vi } from 'vitest';
import { vi, describe, afterEach, expect, it } from 'vitest';

import { init } from '../../src/server/sdk';

Expand Down
2 changes: 2 additions & 0 deletions packages/aws-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export {
localVariablesIntegration,
requestDataIntegration,
functionToStringIntegration,
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration,
eventFiltersIntegration,
linkedErrorsIntegration,
setMeasurement,
getActiveSpan,
Expand Down
2 changes: 2 additions & 0 deletions packages/browser-utils/test/browser/browserMetrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
spanToJSON,
} from '@sentry/core';
import type { Span } from '@sentry/core';
import { describe, beforeEach, it, expect, beforeAll, afterAll } from 'vitest';

import { _addMeasureSpans, _addResourceSpans } from '../../src/metrics/browserMetrics';
import { WINDOW } from '../../src/types';
import { TestClient, getDefaultClientOptions } from '../utils/TestClient';
Expand Down
2 changes: 2 additions & 0 deletions packages/browser-utils/test/browser/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { SentrySpan, getCurrentScope, getIsolationScope, setCurrentClient, spanToJSON } from '@sentry/core';
import { describe, beforeEach, it, expect, test } from 'vitest';

import { extractNetworkProtocol, startAndEndSpan } from '../../src/metrics/utils';
import { TestClient, getDefaultClientOptions } from '../utils/TestClient';

Expand Down
2 changes: 2 additions & 0 deletions packages/browser-utils/test/instrument/dom.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

import { instrumentDOM } from '../../src/instrument/dom';
import { WINDOW } from '../../src/types';

Expand Down
2 changes: 2 additions & 0 deletions packages/browser-utils/test/instrument/xhr.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

import { instrumentXHR } from '../../src/instrument/xhr';
import { WINDOW } from '../../src/types';

Expand Down
2 changes: 2 additions & 0 deletions packages/browser/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export {
withScope,
withIsolationScope,
functionToStringIntegration,
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration,
eventFiltersIntegration,
dedupeIntegration,
parameterize,
startSession,
Expand Down
2 changes: 2 additions & 0 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
* `getDefaultIntegrations` but with an adjusted set of integrations.
*/
return [
// TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration(),
functionToStringIntegration(),
browserApiErrorsIntegration(),
Expand Down
6 changes: 3 additions & 3 deletions packages/browser/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

import {
SDK_VERSION,
eventFiltersIntegration,
getGlobalScope,
getIsolationScope,
getReportDialogEndpoint,
inboundFiltersIntegration,
lastEventId,
} from '@sentry/core';
import * as utils from '@sentry/core';
Expand Down Expand Up @@ -304,12 +304,12 @@ describe('SentryBrowser', () => {
expect(localBeforeSend).toHaveBeenCalledTimes(2);
});

it('should use inboundfilter rules of bound client', async () => {
it('should use eventFilters rules of bound client', async () => {
const localBeforeSend = vi.fn();
const options = getDefaultBrowserClientOptions({
beforeSend: localBeforeSend,
dsn,
integrations: [inboundFiltersIntegration({ ignoreErrors: ['capture'] })],
integrations: [eventFiltersIntegration({ ignoreErrors: ['capture'] })],
});
const client = new BrowserClient(options);
setCurrentClient(client);
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/* eslint-disable @typescript-eslint/unbound-method */
import type { Mock } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi, afterAll, test } from 'vitest';

import * as SentryCore from '@sentry/core';
import { createTransport } from '@sentry/core';
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/test/tracing/request.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MockInstance } from 'vitest';
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { beforeAll, beforeEach, describe, expect, it, vi, afterEach } from 'vitest';

import * as browserUtils from '@sentry-internal/browser-utils';
import * as utils from '@sentry/core';
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/test/transports/offline.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest';
import { describe, expect, it, beforeAll } from 'vitest';

import 'fake-indexeddb/auto';

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/test/utils/featureFlags.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FeatureFlag } from '@sentry/core';

import { getCurrentScope, logger } from '@sentry/core';
import { vi } from 'vitest';
import { vi, describe, it, afterEach, expect } from 'vitest';
import { insertFlagToScope, insertToFlagBuffer } from '../../src/utils/featureFlags';

describe('flags', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export {
requestDataIntegration,
fsIntegration,
functionToStringIntegration,
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration,
eventFiltersIntegration,
linkedErrorsIntegration,
setMeasurement,
getActiveSpan,
Expand Down
2 changes: 2 additions & 0 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
// We return a copy of the defaultIntegrations here to avoid mutating this
return [
// Common
// TODO(v10): Replace with eventFiltersIntegration once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration(),
functionToStringIntegration(),
linkedErrorsIntegration(),
Expand Down
Loading

0 comments on commit 565a6bc

Please sign in to comment.