File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
test/e2e/app-dir/typed-routes Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -395,8 +395,10 @@ program
395395 ) } `
396396 )
397397 . action ( ( directory : string , options : NextTypegenOptions ) =>
398+ // ensure process exits after typegen completes so open handles/connections
399+ // don't cause process to hang
398400 import ( '../cli/next-typegen.js' ) . then ( ( mod ) =>
399- mod . nextTypegen ( options , directory )
401+ mod . nextTypegen ( options , directory ) . then ( ( ) => process . exit ( 0 ) )
400402 )
401403 )
402404 . usage ( '[directory] [options]' )
Original file line number Diff line number Diff line change 1+ // intervals/open connections shouldn't block typegen from exiting
2+ setInterval ( ( ) => { } , 250 )
3+
14/**
25 * @type {import('next').NextConfig }
36 */
Original file line number Diff line number Diff line change 11import { nextTestSetup } from 'e2e-utils'
2+ import { runNextCommand } from 'next-test-utils'
23
34const expectedDts = `
45type AppRoutes = "/" | "/_shop/[[...category]]" | "/dashboard" | "/dashboard/settings" | "/docs/[...slug]" | "/gallery/photo/[id]" | "/project/[slug]"
@@ -90,4 +91,12 @@ type InvalidRoute = RouteContext<'/api/users/invalid'>`
9091 )
9192 } )
9293 }
94+
95+ it ( 'should exit typegen successfully' , async ( ) => {
96+ const { code } = await runNextCommand ( [ 'typegen' ] , {
97+ cwd : next . testDir ,
98+ } )
99+
100+ expect ( code ) . toBe ( 0 )
101+ } )
93102} )
You can’t perform that action at this time.
0 commit comments