Skip to content

Commit f030305

Browse files
authored
test(nextjs): ensure orchestrion stays out of client bundles (#22777)
We are already restricting orchestrion channel injections to only be active in the server bundle, but this test ensures that never slips. Webpack, Vite, and Nuxt are already covered by tests, so Turbopack was the last remaining gap.
1 parent 1a87b00 commit f030305

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

packages/nextjs/test/config/turbopack/constructTurbopackConfig.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,19 @@ describe('orchestrion diagnostics-channel injection', () => {
13371337
expect(JSON.parse(JSON.stringify(firestore!.module.filePath))).not.toEqual({});
13381338
});
13391339

1340+
it('restricts the orchestrion rule to the node environment', () => {
1341+
const result = constructTurbopackConfig({
1342+
userNextConfig: {},
1343+
userSentryOptions: { _experimental: { useDiagnosticsChannelInjection: true } },
1344+
nextJsVersion: '16.0.0',
1345+
});
1346+
1347+
// `condition: 'node'` is what keeps the transform off client code — orchestrion
1348+
// splices `node:diagnostics_channel` calls that throw `X is not a function` in the browser.
1349+
const rule = result.rules!['*.{js,mjs,cjs}'] as { condition?: unknown };
1350+
expect(rule.condition).toBe('node');
1351+
});
1352+
13401353
it('does not add the orchestrion rule when injection is not opted in', () => {
13411354
const result = constructTurbopackConfig({
13421355
userNextConfig: {},

0 commit comments

Comments
 (0)