Skip to content

Commit 0ed4f87

Browse files
authored
build(cdn): Move tracing CDN bundle generation to @sentry/browser (#7617)
1 parent 0fab403 commit 0ed4f87

File tree

55 files changed

+296
-247
lines changed

Some content is hidden

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

55 files changed

+296
-247
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ jobs:
371371
path: |
372372
${{ github.workspace }}/packages/browser/build/bundles/**
373373
${{ github.workspace }}/packages/integrations/build/bundles/**
374-
${{ github.workspace }}/packages/tracing/build/bundles/**
375374
${{ github.workspace }}/packages/replay/build/bundles/**
376375
${{ github.workspace }}/packages/**/*.tgz
377376
@@ -482,7 +481,7 @@ jobs:
482481
yarn test:integration
483482
484483
job_browser_playwright_tests:
485-
name: Playwright (${{ matrix.bundle }})${{ (matrix.tracing_only && ' tracing only') || '' }} Tests
484+
name: Playwright (${{ matrix.bundle }}) Tests
486485
needs: [job_get_metadata, job_build]
487486
if: needs.job_get_metadata.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
488487
runs-on: ubuntu-20.04
@@ -499,16 +498,13 @@ jobs:
499498
- bundle_es6_min
500499
- bundle_replay_es6
501500
- bundle_replay_es6_min
502-
tracing_only:
503-
- true
504-
- false
505-
exclude:
506-
# `tracing_only` only makes a difference for bundles - tests of the esm and cjs builds always include the
507-
# tracing tests
508-
- bundle: esm
509-
tracing_only: false
510-
- bundle: cjs
511-
tracing_only: false
501+
- bundle_tracing_es5
502+
- bundle_tracing_es5_min
503+
- bundle_tracing_es6
504+
- bundle_tracing_es6_min
505+
- bundle_tracing_replay_es6
506+
- bundle_tracing_replay_es6_min
507+
512508
steps:
513509
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
514510
uses: actions/checkout@v3
@@ -543,7 +539,6 @@ jobs:
543539
- name: Run Playwright tests
544540
env:
545541
PW_BUNDLE: ${{ matrix.bundle }}
546-
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
547542
run: |
548543
cd packages/browser-integration-tests
549544
yarn test:ci

.size-limit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ module.exports = [
5353
},
5454
{
5555
name: '@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified)',
56-
path: 'packages/tracing/build/bundles/bundle.tracing.es5.min.js',
56+
path: 'packages/browser/build/bundles/bundle.tracing.es5.min.js',
5757
gzip: true,
5858
limit: '37 KB',
5959
},
6060
{
6161
name: '@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified)',
62-
path: 'packages/tracing/build/bundles/bundle.tracing.min.js',
62+
path: 'packages/browser/build/bundles/bundle.tracing.min.js',
6363
gzip: true,
6464
limit: '35 KB',
6565
},
@@ -80,7 +80,7 @@ module.exports = [
8080
},
8181
{
8282
name: '@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified)',
83-
path: 'packages/tracing/build/bundles/bundle.tracing.replay.min.js',
83+
path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js',
8484
gzip: true,
8585
limit: '80 KB',
8686
},

packages/browser-integration-tests/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"test:bundle:es6:min": "PW_BUNDLE=bundle_es6_min yarn test",
2626
"test:bundle:replay:es6": "PW_BUNDLE=bundle_replay_es6 yarn test",
2727
"test:bundle:replay:es6:min": "PW_BUNDLE=bundle_replay_es6_min yarn test",
28+
"test:bundle:tracing:es5": "PW_BUNDLE=bundle_tracing_es5 yarn test",
29+
"test:bundle:tracing:es5:min": "PW_BUNDLE=bundle_tracing_es5_min yarn test",
30+
"test:bundle:tracing:es6": "PW_BUNDLE=bundle_tracing_es6 yarn test",
31+
"test:bundle:tracing:es6:min": "PW_BUNDLE=bundle_tracing_es6_min yarn test",
32+
"test:bundle:tracing:replay:es6": "PW_BUNDLE=bundle_tracing_replay_es6 yarn test",
33+
"test:bundle:tracing:replay:es6:min": "PW_BUNDLE=bundle_tracing_replay_es6_min yarn test",
2834
"test:cjs": "PW_BUNDLE=cjs yarn test",
2935
"test:esm": "PW_BUNDLE=esm yarn test",
3036
"test:ci": "playwright test ./suites --browser='all' --reporter='line'",

packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
sentryTest('should report a transaction in an envelope', async ({ getLocalTestPath, page }) => {
8+
if (shouldSkipTracingTest()) {
9+
sentryTest.skip();
10+
}
11+
812
const url = await getLocalTestPath({ testDir: __dirname });
913
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
1014

@@ -13,6 +17,10 @@ sentryTest('should report a transaction in an envelope', async ({ getLocalTestPa
1317
});
1418

1519
sentryTest('should report finished spans as children of the root transaction', async ({ getLocalTestPath, page }) => {
20+
if (shouldSkipTracingTest()) {
21+
sentryTest.skip();
22+
}
23+
1624
const url = await getLocalTestPath({ testDir: __dirname });
1725
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
1826

packages/browser-integration-tests/suites/public-api/startTransaction/circular_data/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
sentryTest('should be able to handle circular data', async ({ getLocalTestPath, page }) => {
8+
if (shouldSkipTracingTest()) {
9+
sentryTest.skip();
10+
}
11+
812
const url = await getLocalTestPath({ testDir: __dirname });
913
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
1014

packages/browser-integration-tests/suites/public-api/startTransaction/setMeasurement/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
sentryTest('should attach measurement to transaction', async ({ getLocalTestPath, page }) => {
8+
if (shouldSkipTracingTest()) {
9+
sentryTest.skip();
10+
}
11+
812
const url = await getLocalTestPath({ testDir: __dirname });
913
const event = await getFirstSentryEnvelopeRequest<Event>(page, url);
1014

packages/browser-integration-tests/suites/replay/dsc/test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ import { expect } from '@playwright/test';
22
import type { EventEnvelopeHeaders } from '@sentry/types';
33

44
import { sentryTest } from '../../../utils/fixtures';
5-
import { envelopeHeaderRequestParser, getFirstSentryEnvelopeRequest } from '../../../utils/helpers';
5+
import {
6+
envelopeHeaderRequestParser,
7+
getFirstSentryEnvelopeRequest,
8+
shouldSkipTracingTest,
9+
} from '../../../utils/helpers';
610
import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRunning } from '../../../utils/replayHelpers';
711

812
sentryTest('should add replay_id to dsc of transactions', async ({ getLocalTestPath, page, browserName }) => {
913
// This is flaky on webkit, so skipping there...
10-
if (shouldSkipReplayTest() || browserName === 'webkit') {
14+
if (shouldSkipReplayTest() || shouldSkipTracingTest() || browserName === 'webkit') {
1115
sentryTest.skip();
1216
}
1317

packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { expect } from '@playwright/test';
22

33
import { sentryTest } from '../../../utils/fixtures';
4+
import { shouldSkipTracingTest } from '../../../utils/helpers';
45

56
sentryTest(
67
'exports a shim Integrations.BrowserTracing integration for non-tracing bundles',
78
async ({ getLocalTestPath, page }) => {
8-
const bundle = process.env.PW_BUNDLE;
9-
const tracingOnly = Boolean(process.env.PW_TRACING_ONLY);
10-
11-
if (!bundle || !bundle.startsWith('bundle_') || tracingOnly) {
9+
// Skip in tracing tests
10+
if (!shouldSkipTracingTest()) {
1211
sentryTest.skip();
1312
}
1413

packages/browser-integration-tests/suites/tracing/browserTracingShim/test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { expect } from '@playwright/test';
22

33
import { sentryTest } from '../../../utils/fixtures';
4+
import { shouldSkipTracingTest } from '../../../utils/helpers';
45

56
sentryTest('exports a shim BrowserTracing integration for non-tracing bundles', async ({ getLocalTestPath, page }) => {
6-
const bundle = process.env.PW_BUNDLE;
7-
const tracingOnly = Boolean(process.env.PW_TRACING_ONLY);
8-
9-
if (!bundle || !bundle.startsWith('bundle_') || tracingOnly) {
7+
// Skip in tracing tests
8+
if (!shouldSkipTracingTest()) {
109
sentryTest.skip();
1110
}
1211

packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-custom/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { expect } from '@playwright/test';
33
import type { Event } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
6-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
77

88
async function getPropertyValue(handle: JSHandle, prop: string) {
99
return (await handle.getProperty(prop))?.jsonValue();
1010
}
1111

1212
sentryTest('should finish a custom transaction when the page goes background', async ({ getLocalTestPath, page }) => {
13+
if (shouldSkipTracingTest()) {
14+
sentryTest.skip();
15+
}
16+
1317
const url = await getLocalTestPath({ testDir: __dirname });
1418

1519
const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page, url);

packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
sentryTest(
88
'should finish pageload transaction when the page goes background',
99
async ({ browserName, getLocalTestPath, page }) => {
1010
// TODO: This is flakey on firefox... trace.status is sometimes undefined
11-
if (['firefox'].includes(browserName)) {
11+
if (shouldSkipTracingTest() || ['firefox'].includes(browserName)) {
1212
sentryTest.skip();
1313
}
1414
const url = await getLocalTestPath({ testDir: __dirname });

packages/browser-integration-tests/suites/tracing/browsertracing/interactions/test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { expect } from '@playwright/test';
33
import type { Event, Span, SpanContext, Transaction } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
6-
import { getFirstSentryEnvelopeRequest, getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers';
6+
import {
7+
getFirstSentryEnvelopeRequest,
8+
getMultipleSentryEnvelopeRequests,
9+
shouldSkipTracingTest,
10+
} from '../../../../utils/helpers';
711

812
type TransactionJSON = ReturnType<Transaction['toJSON']> & {
913
spans: ReturnType<Span['toJSON']>[];
@@ -17,7 +21,7 @@ const wait = (time: number) => new Promise(res => setTimeout(res, time));
1721
sentryTest('should capture interaction transaction.', async ({ browserName, getLocalTestPath, page }) => {
1822
const supportedBrowsers = ['chromium', 'firefox'];
1923

20-
if (!supportedBrowsers.includes(browserName)) {
24+
if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) {
2125
sentryTest.skip();
2226
}
2327

@@ -54,7 +58,7 @@ sentryTest('should capture interaction transaction.', async ({ browserName, getL
5458
sentryTest('should create only one transaction per interaction', async ({ browserName, getLocalTestPath, page }) => {
5559
const supportedBrowsers = ['chromium', 'firefox'];
5660

57-
if (!supportedBrowsers.includes(browserName)) {
61+
if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) {
5862
sentryTest.skip();
5963
}
6064

packages/browser-integration-tests/suites/tracing/browsertracing/long-tasks-disabled/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { expect } from '@playwright/test';
33
import type { Event } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
6-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
77

88
sentryTest('should not capture long task when flag is disabled.', async ({ browserName, getLocalTestPath, page }) => {
99
// Long tasks only work on chrome
10-
if (browserName !== 'chromium') {
10+
if (shouldSkipTracingTest() || browserName !== 'chromium') {
1111
sentryTest.skip();
1212
}
1313

packages/browser-integration-tests/suites/tracing/browsertracing/long-tasks-enabled/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { expect } from '@playwright/test';
33
import type { Event } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
6-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
77

88
sentryTest('should capture long task.', async ({ browserName, getLocalTestPath, page }) => {
99
// Long tasks only work on chrome
10-
if (browserName !== 'chromium') {
10+
if (shouldSkipTracingTest() || browserName !== 'chromium') {
1111
sentryTest.skip();
1212
}
1313

packages/browser-integration-tests/suites/tracing/browsertracing/meta/test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@ import { expect } from '@playwright/test';
22
import type { Event, EventEnvelopeHeaders } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { envelopeHeaderRequestParser, getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import {
6+
envelopeHeaderRequestParser,
7+
getFirstSentryEnvelopeRequest,
8+
shouldSkipTracingTest,
9+
} from '../../../../utils/helpers';
610

711
sentryTest(
812
'should create a pageload transaction based on `sentry-trace` <meta>',
913
async ({ getLocalTestPath, page }) => {
14+
if (shouldSkipTracingTest()) {
15+
sentryTest.skip();
16+
}
17+
1018
const url = await getLocalTestPath({ testDir: __dirname });
1119

1220
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
@@ -24,6 +32,10 @@ sentryTest(
2432
sentryTest(
2533
'should pick up `baggage` <meta> tag, propagate the content in transaction and not add own data',
2634
async ({ getLocalTestPath, page }) => {
35+
if (shouldSkipTracingTest()) {
36+
sentryTest.skip();
37+
}
38+
2739
const url = await getLocalTestPath({ testDir: __dirname });
2840

2941
const envHeader = await getFirstSentryEnvelopeRequest<EventEnvelopeHeaders>(page, url, envelopeHeaderRequestParser);
@@ -41,6 +53,10 @@ sentryTest(
4153
sentryTest(
4254
"should create a navigation that's not influenced by `sentry-trace` <meta>",
4355
async ({ getLocalTestPath, page }) => {
56+
if (shouldSkipTracingTest()) {
57+
sentryTest.skip();
58+
}
59+
4460
const url = await getLocalTestPath({ testDir: __dirname });
4561

4662
const pageloadRequest = await getFirstSentryEnvelopeRequest<Event>(page, url);

packages/browser-integration-tests/suites/tracing/browsertracing/navigation/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
sentryTest('should create a navigation transaction on page navigation', async ({ getLocalTestPath, page }) => {
8+
if (shouldSkipTracingTest()) {
9+
sentryTest.skip();
10+
}
11+
812
const url = await getLocalTestPath({ testDir: __dirname });
913

1014
const pageloadRequest = await getFirstSentryEnvelopeRequest<Event>(page, url);

packages/browser-integration-tests/suites/tracing/browsertracing/pageload/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
5+
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
66

77
sentryTest('should create a pageload transaction', async ({ getLocalTestPath, page }) => {
8+
if (shouldSkipTracingTest()) {
9+
sentryTest.skip();
10+
}
11+
812
const url = await getLocalTestPath({ testDir: __dirname });
913

1014
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);

packages/browser-integration-tests/suites/tracing/browsertracing/tracePropagationTargets/customTargets/test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ import type { Request } from '@playwright/test';
22
import { expect } from '@playwright/test';
33

44
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { shouldSkipTracingTest } from '../../../../../utils/helpers';
56

67
sentryTest(
78
'should attach `sentry-trace` and `baggage` header to request matching tracePropagationTargets',
89
async ({ getLocalTestPath, page }) => {
10+
if (shouldSkipTracingTest()) {
11+
sentryTest.skip();
12+
}
13+
914
const url = await getLocalTestPath({ testDir: __dirname });
1015

1116
const requests = (

packages/browser-integration-tests/suites/tracing/browsertracing/tracePropagationTargets/customTargetsAndOrigins/test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ import type { Request } from '@playwright/test';
22
import { expect } from '@playwright/test';
33

44
import { sentryTest } from '../../../../../utils/fixtures';
5+
import { shouldSkipTracingTest } from '../../../../../utils/helpers';
56

67
sentryTest(
78
'[pre-v8] should prefer custom tracePropagationTargets over tracingOrigins',
89
async ({ getLocalTestPath, page }) => {
10+
if (shouldSkipTracingTest()) {
11+
sentryTest.skip();
12+
}
13+
914
const url = await getLocalTestPath({ testDir: __dirname });
1015

1116
const requests = (

0 commit comments

Comments
 (0)