-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into sig/astro-waitUntil
- Loading branch information
Showing
82 changed files
with
726 additions
and
3,746 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
...ges/browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/init.js
This file contains 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,18 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
window.fetchCallCount = 0; | ||
window.spanEnded = false; | ||
|
||
const originalWindowFetch = window.fetch; | ||
window.fetch = (...args) => { | ||
window.fetchCallCount++; | ||
return originalWindowFetch(...args); | ||
}; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
tracesSampleRate: 1.0, | ||
enabled: false, | ||
}); |
3 changes: 3 additions & 0 deletions
3
.../browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/subject.js
This file contains 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 @@ | ||
Sentry.startSpan({ name: 'standalone_segment_span', experimental: { standalone: true } }, () => {}); | ||
|
||
window.spanEnded = true; |
22 changes: 22 additions & 0 deletions
22
...ges/browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/test.ts
This file contains 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,22 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { shouldSkipTracingTest } from '../../../../utils/helpers'; | ||
|
||
sentryTest("doesn't send a standalone span envelope if SDK is disabled", async ({ getLocalTestPath, page }) => { | ||
if (shouldSkipTracingTest()) { | ||
sentryTest.skip(); | ||
} | ||
|
||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
await page.goto(url); | ||
|
||
// @ts-expect-error this exists in the test init/subject | ||
await page.waitForFunction(() => !!window.spanEnded); | ||
await page.waitForTimeout(2000); | ||
|
||
// @ts-expect-error this exists in the test init | ||
const fetchCallCount = await page.evaluate(() => window.fetchCallCount); | ||
// We expect no fetch calls because the SDK is disabled | ||
expect(fetchCallCount).toBe(0); | ||
}); |
This file contains 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
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/nextjs-13/sentry.client.config.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
Sentry.init({ | ||
|
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/nextjs-14/sentry.client.config.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
Sentry.init({ | ||
|
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/nextjs-15/sentry.client.config.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
Sentry.init({ | ||
|
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/nextjs-app-dir/sentry.client.config.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
Sentry.init({ | ||
|
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/nextjs-t3/sentry.client.config.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
Sentry.init({ | ||
|
7 changes: 6 additions & 1 deletion
7
dev-packages/e2e-tests/test-applications/nextjs-turbo/app/layout.tsx
This file contains 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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { HackComponentToRunSideEffectsInSentryClientConfig } from '../sentry.client.config'; | ||
|
||
export default function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<body>{children}</body> | ||
<body> | ||
<HackComponentToRunSideEffectsInSentryClientConfig /> | ||
{children} | ||
</body> | ||
</html> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
dev-packages/e2e-tests/test-applications/nextjs-turbo/next-env.d.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. |
10 changes: 10 additions & 0 deletions
10
...ts/test-applications/nextjs-turbo/pages/[param]/pages-router-client-trace-propagation.tsx
This file contains 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,10 @@ | ||
export default function Page() { | ||
<p>Hello World!</p>; | ||
} | ||
|
||
// getServerSideProps makes this page dynamic and allows tracing data to be inserted | ||
export async function getServerSideProps() { | ||
return { | ||
props: {}, | ||
}; | ||
} |
6 changes: 6 additions & 0 deletions
6
dev-packages/e2e-tests/test-applications/nextjs-turbo/pages/_app.tsx
This file contains 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,6 @@ | ||
import type { AppProps } from 'next/app'; | ||
import '../sentry.client.config'; | ||
|
||
export default function CustomApp({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} />; | ||
} |
22 changes: 15 additions & 7 deletions
22
dev-packages/e2e-tests/test-applications/nextjs-turbo/sentry.client.config.ts
This file contains 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 |
---|---|---|
@@ -1,9 +1,17 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
Sentry.init({ | ||
environment: 'qa', // dynamic sampling bias to keep transactions | ||
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, | ||
tunnel: `http://localhost:3031/`, // proxy server | ||
tracesSampleRate: 1.0, | ||
sendDefaultPii: true, | ||
}); | ||
if (typeof window !== 'undefined') { | ||
Sentry.init({ | ||
environment: 'qa', // dynamic sampling bias to keep transactions | ||
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, | ||
tunnel: `http://localhost:3031/`, // proxy server | ||
tracesSampleRate: 1.0, | ||
sendDefaultPii: true, | ||
}); | ||
} | ||
|
||
export function HackComponentToRunSideEffectsInSentryClientConfig() { | ||
return null; | ||
} |
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
...-tests/test-applications/nextjs-turbo/tests/pages-router/client-trace-propagation.test.ts
This file contains 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,20 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
||
test('Should propagate traces from server to client in pages router', async ({ page }) => { | ||
const serverTransactionPromise = waitForTransaction('nextjs-turbo', async transactionEvent => { | ||
return transactionEvent?.transaction === 'GET /[param]/pages-router-client-trace-propagation'; | ||
}); | ||
|
||
const pageloadTransactionPromise = waitForTransaction('nextjs-turbo', async transactionEvent => { | ||
return transactionEvent?.transaction === '/[param]/pages-router-client-trace-propagation'; | ||
}); | ||
|
||
await page.goto(`/123/pages-router-client-trace-propagation`); | ||
|
||
const serverTransaction = await serverTransactionPromise; | ||
const pageloadTransaction = await pageloadTransactionPromise; | ||
|
||
expect(serverTransaction.contexts?.trace?.trace_id).toBeDefined(); | ||
expect(pageloadTransaction.contexts?.trace?.trace_id).toBe(serverTransaction.contexts?.trace?.trace_id); | ||
}); |
This file contains 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
Oops, something went wrong.