Skip to content

Commit f1ffb35

Browse files
committed
add profiling integration in test
1 parent e905ec4 commit f1ffb35

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

dev-packages/browser-integration-tests/suites/profiling/legacyMode/subject.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as Sentry from '@sentry/browser';
2+
import { browserProfilingIntegration } from '@sentry/browser';
23

34
window.Sentry = Sentry;
45

56
Sentry.init({
67
dsn: 'https://[email protected]/1337',
7-
integrations: [Sentry.browserProfilingIntegration()],
8+
integrations: [browserProfilingIntegration()],
89
tracesSampleRate: 1,
910
profilesSampleRate: 1,
1011
});

dev-packages/browser-integration-tests/suites/profiling/legacyMode/test.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,22 @@ sentryTest('sends profile envelope in legacy mode', async ({ page, getLocalTestU
8383

8484
const functionNames = profile.frames.map(frame => frame.function).filter(name => name !== '');
8585

86-
expect(functionNames).toEqual(
87-
expect.arrayContaining([
88-
'_startRootSpan',
89-
'withScope',
90-
'createChildOrRootSpan',
91-
'startSpanManual',
92-
'startProfileForSpan',
93-
'startJSSelfProfile',
94-
]),
95-
);
86+
if (!(process.env.PW_BUNDLE || '').startsWith('bundle')) {
87+
// In bundled mode, function names are minified
88+
expect(functionNames.length).toBeGreaterThan(0);
89+
expect((functionNames as string[]).every(name => name?.length > 0)).toBe(true); // Just make sure they're not empty strings
90+
} else {
91+
expect(functionNames).toEqual(
92+
expect.arrayContaining([
93+
'_startRootSpan',
94+
'withScope',
95+
'createChildOrRootSpan',
96+
'startSpanManual',
97+
'startProfileForSpan',
98+
'startJSSelfProfile',
99+
]),
100+
);
101+
}
96102

97103
expect(profile.thread_metadata).toHaveProperty('0');
98104
expect(profile.thread_metadata['0']).toHaveProperty('name');

dev-packages/browser-integration-tests/utils/generatePlugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const IMPORTED_INTEGRATION_CDN_BUNDLE_PATHS: Record<string, string> = {
3636
feedbackIntegration: 'feedback',
3737
moduleMetadataIntegration: 'modulemetadata',
3838
graphqlClientIntegration: 'graphqlclient',
39+
browserProfilingIntegration: 'browserprofiling',
3940
// technically, this is not an integration, but let's add it anyway for simplicity
4041
makeMultiplexedTransport: 'multiplexedtransport',
4142
};

0 commit comments

Comments
 (0)