You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { clerkMiddleware } from '@clerk/nextjs/server';
9
36
export default clerkMiddleware();
@@ -61,6 +88,9 @@ test.describe('next start - invalid middleware at root on src/ @quickstart', ()
61
88
page,
62
89
context,
63
90
})=>{
91
+
const{ version }=awaitdetectNext(app);
92
+
constmajor=parseSemverMajor(version)??0;
93
+
test.skip(major>=16,'Middleware detection is smarter in Next 16+.');
64
94
constu=createTestUtils({ app, page, context });
65
95
awaitu.page.goToAppHome();
66
96
@@ -69,6 +99,15 @@ test.describe('next start - invalid middleware at root on src/ @quickstart', ()
69
99
'Clerk: clerkMiddleware() was not run, your middleware file might be misplaced. Move your middleware file to ./src/middleware.ts. Currently located at ./middleware.ts',
70
100
);
71
101
});
102
+
103
+
test('Does not display misplaced middleware error on Next 16+',async({ page, context })=>{
104
+
const{ version }=awaitdetectNext(app);
105
+
constmajor=parseSemverMajor(version)??0;
106
+
test.skip(major<16,'Only applicable on Next 16+');
107
+
constu=createTestUtils({ app, page, context });
108
+
awaitu.page.goToAppHome();
109
+
expect(app.serveOutput).not.toContain('Clerk: clerkMiddleware() was not run');
110
+
});
72
111
});
73
112
74
113
test.describe('next start - invalid middleware inside app on src/ @quickstart',()=>{
0 commit comments