File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 11import { configureScope } from '@sentry/core' ;
22import type { NodeOptions } from '@sentry/node' ;
3- import { init as initNodeSdk } from '@sentry/node' ;
3+ import { init as initNodeSdk , Integrations } from '@sentry/node' ;
4+ import { addOrUpdateIntegration } from '@sentry/utils' ;
45
56import { applySdkMetadata } from '../common/metadata' ;
67
@@ -11,9 +12,15 @@ import { applySdkMetadata } from '../common/metadata';
1112export function init ( options : NodeOptions ) : void {
1213 applySdkMetadata ( options , [ 'sveltekit' , 'node' ] ) ;
1314
15+ addServerIntegrations ( options ) ;
16+
1417 initNodeSdk ( options ) ;
1518
1619 configureScope ( scope => {
1720 scope . setTag ( 'runtime' , 'node' ) ;
1821 } ) ;
1922}
23+
24+ function addServerIntegrations ( options : NodeOptions ) : void {
25+ options . integrations = addOrUpdateIntegration ( new Integrations . Undici ( ) , options . integrations || [ ] ) ;
26+ }
Original file line number Diff line number Diff line change @@ -47,5 +47,20 @@ describe('Sentry server SDK', () => {
4747 // @ts -ignore need access to protected _tags attribute
4848 expect ( currentScope . _tags ) . toEqual ( { runtime : 'node' } ) ;
4949 } ) ;
50+
51+ it ( 'adds the Undici integration' , ( ) => {
52+ init ( { } ) ;
53+
54+ expect ( nodeInit ) . toHaveBeenCalledTimes ( 1 ) ;
55+ expect ( nodeInit ) . toHaveBeenCalledWith (
56+ expect . objectContaining ( {
57+ integrations : expect . arrayContaining ( [
58+ expect . objectContaining ( {
59+ name : 'Undici' ,
60+ } ) ,
61+ ] ) ,
62+ } ) ,
63+ ) ;
64+ } ) ;
5065 } ) ;
5166} ) ;
You can’t perform that action at this time.
0 commit comments