Skip to content

Commit 7ec84be

Browse files
committed
add unit test for excludeServerRoutes
1 parent 931ae71 commit 7ec84be

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts

+25
Original file line numberDiff line numberDiff line change
@@ -241,5 +241,30 @@ describe('constructWebpackConfigFunction()', () => {
241241
simulatorBundle: './src/simulator/index.ts',
242242
});
243243
});
244+
245+
it('does not inject into routes included in `excludeServerRoutes`', async () => {
246+
const nextConfigWithExcludedRoutes = {
247+
...exportedNextConfig,
248+
sentry: {
249+
excludeServerRoutes: [/simulator/],
250+
},
251+
};
252+
const finalWebpackConfig = await materializeFinalWebpackConfig({
253+
exportedNextConfig: nextConfigWithExcludedRoutes,
254+
incomingWebpackConfig: serverWebpackConfig,
255+
incomingWebpackBuildContext: serverBuildContext,
256+
});
257+
258+
expect(finalWebpackConfig.entry).toEqual(
259+
expect.objectContaining({
260+
'pages/simulator/leaderboard': {
261+
import: expect.not.arrayContaining([serverConfigFilePath]),
262+
},
263+
'pages/api/simulator/dogStats/[name]': {
264+
import: expect.not.arrayContaining([serverConfigFilePath]),
265+
},
266+
}),
267+
);
268+
});
244269
});
245270
});

0 commit comments

Comments
 (0)