MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / setup

Function setup

packages/server-utils/test/tracing-channel.test.ts:255–268  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

253 describe('auto lifecycle ending strategy', () => {
254 // Returns a channel whose span we can observe, plus spies for `span.end` and `captureException`.
255 function setup(name: string): {
256 channel: ReturnType<typeof bindTracingChannelToSpan>['channel'];
257 span: Span;
258 endSpy: ReturnType<typeof vi.spyOn>;
259 captureExceptionSpy: ReturnType<typeof vi.spyOn>;
260 } {
261 installTestAsyncContextStrategy();
262 initTestClient();
263 const span = startInactiveSpan({ name: 'channel-span' });
264 const endSpy = vi.spyOn(span, 'end');
265 const captureExceptionSpy = vi.spyOn(SentryCore, 'captureException').mockReturnValue('event-id');
266 const { channel } = bindTracingChannelToSpan(tracingChannel<{ operation: string }>(name), () => span);
267 return { channel, span, endSpy, captureExceptionSpy };
268 }
269
270 it('traceSync success: ends the span once on `end`', () => {
271 const { channel, span, endSpy, captureExceptionSpy } = setup('test:lifecycle:sync-ok');

Callers 1

Calls 4

startInactiveSpanFunction · 0.90
bindTracingChannelToSpanFunction · 0.90
initTestClientFunction · 0.70

Tested by

no test coverage detected