@@ -40,12 +40,20 @@ export function getDefaultIntegrations(options: Options): Integration[] {
40
40
* Initialize Sentry for Node.
41
41
*/
42
42
export function init ( options : NodeOptions | undefined = { } ) : NodeClient | undefined {
43
- const nodeDefaultIntegrations = getDefaultIntegrations ( options ) ;
43
+ return _init ( options , getDefaultIntegrations ) ;
44
+ }
44
45
46
+ /**
47
+ * Internal initialization function.
48
+ */
49
+ function _init (
50
+ options : NodeOptions | undefined = { } ,
51
+ getDefaultIntegrationsImpl : ( options : Options ) => Integration [ ] ,
52
+ ) : NodeClient | undefined {
45
53
const client = initNodeCore ( {
46
54
...options ,
47
55
// Only use Node SDK defaults if none provided
48
- defaultIntegrations : options . defaultIntegrations ?? nodeDefaultIntegrations ,
56
+ defaultIntegrations : options . defaultIntegrations ?? getDefaultIntegrationsImpl ( options ) ,
49
57
} ) ;
50
58
51
59
// Add Node SDK specific OpenTelemetry setup
@@ -63,19 +71,5 @@ export function init(options: NodeOptions | undefined = {}): NodeClient | undefi
63
71
* Initialize Sentry for Node, without any integrations added by default.
64
72
*/
65
73
export function initWithoutDefaultIntegrations ( options : NodeOptions | undefined = { } ) : NodeClient | undefined {
66
- const client = initNodeCore ( {
67
- ...options ,
68
- // Only use empty array if none provided
69
- defaultIntegrations : options . defaultIntegrations ?? [ ] ,
70
- } ) ;
71
-
72
- // Add Node SDK specific OpenTelemetry setup
73
- if ( client && ! options . skipOpenTelemetrySetup ) {
74
- initOpenTelemetry ( client , {
75
- spanProcessors : options . openTelemetrySpanProcessors ,
76
- } ) ;
77
- validateOpenTelemetrySetup ( ) ;
78
- }
79
-
80
- return client ;
74
+ return _init ( options , ( ) => [ ] ) ;
81
75
}
0 commit comments