Skip to content

Commit

Permalink
test(nextjs): Check for import trace logs (#5034)
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef authored Jan 29, 2025
1 parent ad356bf commit fc43915
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changeset/nine-ears-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
9 changes: 9 additions & 0 deletions integration/tests/next-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ export default function RootLayout({ children }: { children: React.ReactNode })

expect(notFoundPageLine).toContain(staticIndicator);
});

/**
* Sometimes utilities from `/server` may use Node APIs even if `clerkMiddleware` does not consumes them.
* This happends because of code for node runtime and edge runtime is bundled together in the `/server/index.ts` barrel file.
* This test ensures that developers will not end up with warnings on `next build`.
*/
test('Avoid import traces logs indicating misuse of node apis inside middleware', () => {
expect(app.buildOutput).not.toMatch(/import trace/i);
});
});

test.describe('next build - dynamic options @nextjs', () => {
Expand Down

0 comments on commit fc43915

Please sign in to comment.