@@ -71,5 +71,77 @@ describe('React Router server SDK', () => {
71
71
72
72
expect ( filterIntegration ) . toBeDefined ( ) ;
73
73
} ) ;
74
+
75
+ it ( 'adds reactRouterServer integration for Node.js 20.18' , ( ) => {
76
+ vi . spyOn ( SentryNode , 'NODE_VERSION' , 'get' ) . mockReturnValue ( { major : 20 , minor : 18 , patch : 0 } ) ;
77
+
78
+ reactRouterInit ( {
79
+ dsn :
'https://[email protected] /1337' ,
80
+ } ) ;
81
+
82
+ expect ( nodeInit ) . toHaveBeenCalledTimes ( 1 ) ;
83
+ const initOptions = nodeInit . mock . calls [ 0 ] ?. [ 0 ] ;
84
+ const defaultIntegrations = initOptions ?. defaultIntegrations as Integration [ ] ;
85
+
86
+ const reactRouterServerIntegration = defaultIntegrations . find (
87
+ integration => integration . name === 'ReactRouterServer' ,
88
+ ) ;
89
+
90
+ expect ( reactRouterServerIntegration ) . toBeDefined ( ) ;
91
+ } ) ;
92
+
93
+ it ( 'adds reactRouterServer integration for Node.js 22.11' , ( ) => {
94
+ vi . spyOn ( SentryNode , 'NODE_VERSION' , 'get' ) . mockReturnValue ( { major : 22 , minor : 11 , patch : 0 } ) ;
95
+
96
+ reactRouterInit ( {
97
+ dsn :
'https://[email protected] /1337' ,
98
+ } ) ;
99
+
100
+ expect ( nodeInit ) . toHaveBeenCalledTimes ( 1 ) ;
101
+ const initOptions = nodeInit . mock . calls [ 0 ] ?. [ 0 ] ;
102
+ const defaultIntegrations = initOptions ?. defaultIntegrations as Integration [ ] ;
103
+
104
+ const reactRouterServerIntegration = defaultIntegrations . find (
105
+ integration => integration . name === 'ReactRouterServer' ,
106
+ ) ;
107
+
108
+ expect ( reactRouterServerIntegration ) . toBeDefined ( ) ;
109
+ } ) ;
110
+
111
+ it ( 'does not add reactRouterServer integration for Node.js 20.19' , ( ) => {
112
+ vi . spyOn ( SentryNode , 'NODE_VERSION' , 'get' ) . mockReturnValue ( { major : 20 , minor : 19 , patch : 0 } ) ;
113
+
114
+ reactRouterInit ( {
115
+ dsn :
'https://[email protected] /1337' ,
116
+ } ) ;
117
+
118
+ expect ( nodeInit ) . toHaveBeenCalledTimes ( 1 ) ;
119
+ const initOptions = nodeInit . mock . calls [ 0 ] ?. [ 0 ] ;
120
+ const defaultIntegrations = initOptions ?. defaultIntegrations as Integration [ ] ;
121
+
122
+ const reactRouterServerIntegration = defaultIntegrations . find (
123
+ integration => integration . name === 'ReactRouterServer' ,
124
+ ) ;
125
+
126
+ expect ( reactRouterServerIntegration ) . toBeUndefined ( ) ;
127
+ } ) ;
128
+
129
+ it ( 'does not add reactRouterServer integration for Node.js 22.12' , ( ) => {
130
+ vi . spyOn ( SentryNode , 'NODE_VERSION' , 'get' ) . mockReturnValue ( { major : 22 , minor : 12 , patch : 0 } ) ;
131
+
132
+ reactRouterInit ( {
133
+ dsn :
'https://[email protected] /1337' ,
134
+ } ) ;
135
+
136
+ expect ( nodeInit ) . toHaveBeenCalledTimes ( 1 ) ;
137
+ const initOptions = nodeInit . mock . calls [ 0 ] ?. [ 0 ] ;
138
+ const defaultIntegrations = initOptions ?. defaultIntegrations as Integration [ ] ;
139
+
140
+ const reactRouterServerIntegration = defaultIntegrations . find (
141
+ integration => integration . name === 'ReactRouterServer' ,
142
+ ) ;
143
+
144
+ expect ( reactRouterServerIntegration ) . toBeUndefined ( ) ;
145
+ } ) ;
74
146
} ) ;
75
147
} ) ;
0 commit comments