chore: fix lingering jest and next-server processes in monorepo (#8320)

This commit is contained in:
Alessio Gravili
2024-09-19 21:15:20 -04:00
committed by GitHub
parent faaa1188f4
commit 79c117c664
3 changed files with 19 additions and 3 deletions

View File

@@ -50,8 +50,14 @@ if (args.o) {
await open(`http://localhost:3000${adminRoute}`)
}
// @ts-expect-error
await nextDev({ port: process.env.PORT || 3000, dirname: rootDir }, 'default', rootDir)
const port = process.env.PORT ? Number(process.env.PORT) : 3000
await nextDev({ port }, 'default', rootDir)
// fetch the admin url to force a render
void fetch(`http://localhost:${process.env.PORT || 3000}${adminRoute}`)
void fetch(`http://localhost:${port}${adminRoute}`)
// This ensures that the next-server process is killed when this process is killed and doesn't linger around.
process.on('SIGINT', function () {
process.exit(0)
})