Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
mydea committed Jan 17, 2023
commit 9a81100921160696acb6d6a8ca976623e8731375
7 changes: 6 additions & 1 deletion packages/tracing/src/index.bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export {
export { SDK_VERSION } from '@sentry/browser';

import { Integrations as BrowserIntegrations } from '@sentry/browser';
import type { Integration } from '@sentry/types';
import { GLOBAL_OBJ } from '@sentry/utils';

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

const INTEGRATIONS: Record<string, unknown> = {
// For whatever reason, it does not recognize BrowserTracing or some of the BrowserIntegrations as Integration
const INTEGRATIONS: Record<
string,
Integration | typeof BrowserTracing | typeof BrowserIntegrations[keyof typeof BrowserIntegrations]
> = {
...windowIntegrations,
...BrowserIntegrations,
BrowserTracing,
Expand Down
19 changes: 19 additions & 0 deletions packages/tracing/test/index.bundle.replay.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Sentry from '../src/index.bundle.replay';

// Because of the way how we re-export stuff for the replay bundle, we only have a single default export
const { Integrations } = Sentry;

describe('Integrations export', () => {
it('is exported correctly', () => {
Object.keys(Integrations).forEach(key => {
// Skip BrowserTracing because it doesn't have a static id field.
if (key === 'BrowserTracing') {
return;
}

expect((Integrations[key] as any).id).toStrictEqual(expect.any(String));
});

expect(Integrations.Replay).toBeDefined();
});
});
6 changes: 3 additions & 3 deletions packages/tracing/test/index.bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe('Integrations export', () => {
return;
}

expect(Integrations[key as keyof Omit<typeof Integrations, 'BrowserTracing'>].id).toStrictEqual(
expect.any(String),
);
expect((Integrations[key] as any).id).toStrictEqual(expect.any(String));
});
});

expect(Integrations.Replay).toBeUndefined();
});
2 changes: 1 addition & 1 deletion packages/tracing/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// the fact that it introduces a dependency on `@sentry/browser` which doesn't exist anywhere else in the SDK, which
// then prevents us from building that and this at the same time when doing a parallellized build from the repo root
// level.
"exclude": ["src/index.bundle.ts"],
"exclude": ["src/index.bundle.ts", "src/index.bundle.replay.ts"],

"compilerOptions": {
"declaration": true,
Expand Down