Skip to content

Commit f9bd33c

Browse files
committed
fix tests
1 parent 87dbc06 commit f9bd33c

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

packages/tracing/src/index.bundle.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export {
5353
export { SDK_VERSION } from '@sentry/browser';
5454

5555
import { Integrations as BrowserIntegrations } from '@sentry/browser';
56+
import type { Integration } from '@sentry/types';
5657
import { GLOBAL_OBJ } from '@sentry/utils';
5758

5859
import { BrowserTracing } from './browser';
@@ -67,7 +68,11 @@ if (GLOBAL_OBJ.Sentry && GLOBAL_OBJ.Sentry.Integrations) {
6768
windowIntegrations = GLOBAL_OBJ.Sentry.Integrations;
6869
}
6970

70-
const INTEGRATIONS: Record<string, unknown> = {
71+
// For whatever reason, it does not recognize BrowserTracing or some of the BrowserIntegrations as Integration
72+
const INTEGRATIONS: Record<
73+
string,
74+
Integration | typeof BrowserTracing | typeof BrowserIntegrations[keyof typeof BrowserIntegrations]
75+
> = {
7176
...windowIntegrations,
7277
...BrowserIntegrations,
7378
BrowserTracing,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Sentry from '../src/index.bundle.replay';
2+
3+
// Because of the way how we re-export stuff for the replay bundle, we only have a single default export
4+
const { Integrations } = Sentry;
5+
6+
describe('Integrations export', () => {
7+
it('is exported correctly', () => {
8+
Object.keys(Integrations).forEach(key => {
9+
// Skip BrowserTracing because it doesn't have a static id field.
10+
if (key === 'BrowserTracing') {
11+
return;
12+
}
13+
14+
expect((Integrations[key] as any).id).toStrictEqual(expect.any(String));
15+
});
16+
17+
expect(Integrations.Replay).toBeDefined();
18+
});
19+
});

packages/tracing/test/index.bundle.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ describe('Integrations export', () => {
88
return;
99
}
1010

11-
expect(Integrations[key as keyof Omit<typeof Integrations, 'BrowserTracing'>].id).toStrictEqual(
12-
expect.any(String),
13-
);
11+
expect((Integrations[key] as any).id).toStrictEqual(expect.any(String));
1412
});
1513
});
14+
15+
expect(Integrations.Replay).toBeUndefined();
1616
});

packages/tracing/tsconfig.types.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// the fact that it introduces a dependency on `@sentry/browser` which doesn't exist anywhere else in the SDK, which
66
// then prevents us from building that and this at the same time when doing a parallellized build from the repo root
77
// level.
8-
"exclude": ["src/index.bundle.ts"],
8+
"exclude": ["src/index.bundle.ts", "src/index.bundle.replay.ts"],
99

1010
"compilerOptions": {
1111
"declaration": true,

0 commit comments

Comments
 (0)