-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: do not wait for unstable_after callbacks in dev
- Loading branch information
1 parent
328a840
commit 585c54d
Showing
5 changed files
with
45 additions
and
24 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
test/e2e/app-dir/graceful-shutdown-next-after/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { retry } from 'next-test-utils' | ||
|
||
describe('unstable_after during server shutdown', () => { | ||
const { next, skipped, isNextDev } = nextTestSetup({ | ||
files: __dirname, | ||
skipDeployment: true, // the tests use cli logs | ||
skipStart: true, | ||
}) | ||
if (skipped) { | ||
return | ||
} | ||
|
||
beforeEach(async () => { | ||
await next.start() | ||
}) | ||
|
||
if (isNextDev) { | ||
it.each(['SIGINT', 'SIGTERM'] as const)( | ||
'does not wait for unstable_after callbacks when the server receives %s', | ||
async (signal) => { | ||
await next.browser('/') | ||
await retry(async () => { | ||
expect(next.cliOutput).toInclude('[after] starting sleep') | ||
}) | ||
await next.stop(signal) | ||
expect(next.cliOutput).not.toInclude('[after] finished sleep') | ||
} | ||
) | ||
} | ||
|
||
if (!isNextDev) { | ||
it.each(['SIGINT', 'SIGTERM'] as const)( | ||
'waits for unstable_after callbacks when the server receives %s', | ||
async (signal) => { | ||
await next.browser('/') | ||
await retry(async () => { | ||
expect(next.cliOutput).toInclude('[after] starting sleep') | ||
}) | ||
await next.stop(signal) | ||
expect(next.cliOutput).toInclude('[after] finished sleep') | ||
} | ||
) | ||
} | ||
}) |
File renamed without changes.
24 changes: 0 additions & 24 deletions
24
test/production/app-dir/graceful-shutdown-next-after/index.test.ts
This file was deleted.
Oops, something went wrong.