Skip to content

Commit cda8270

Browse files
committed
add node 22 support
1 parent 5433c10 commit cda8270

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

packages/react-router/src/server/sdk.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import { reactRouterServerIntegration } from './integration/reactRouterServer';
1515
export function getDefaultReactRouterServerIntegrations(options: NodeOptions): Integration[] {
1616
const integrations = [...getNodeDefaultIntegrations(options), lowQualityTransactionsFilterIntegration(options)];
1717

18-
if (NODE_VERSION.major === 20 && NODE_VERSION.minor < 19) {
18+
if (
19+
(NODE_VERSION.major === 20 && NODE_VERSION.minor < 19) || // https://nodejs.org/en/blog/release/v20.19.0
20+
(NODE_VERSION.major === 22 && NODE_VERSION.minor < 12) // https://nodejs.org/en/blog/release/v22.12.0
21+
) {
1922
integrations.push(reactRouterServerIntegration());
2023
}
2124

packages/react-router/test/server/sdk.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@ describe('React Router server SDK', () => {
9090
expect(reactRouterServerIntegration).toBeDefined();
9191
});
9292

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+
93111
it('does not add reactRouterServer integration for Node.js 20.19', () => {
94112
vi.spyOn(SentryNode, 'NODE_VERSION', 'get').mockReturnValue({ major: 20, minor: 19, patch: 0 });
95113

@@ -107,5 +125,23 @@ describe('React Router server SDK', () => {
107125

108126
expect(reactRouterServerIntegration).toBeUndefined();
109127
});
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+
});
110146
});
111147
});

0 commit comments

Comments
 (0)