From 31a8335412b9081f470b0a5a4a4244c0c5109392 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 21 Mar 2022 08:40:50 -0500 Subject: [PATCH] Use check on prerender test assertion --- test/e2e/prerender.test.ts | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/test/e2e/prerender.test.ts b/test/e2e/prerender.test.ts index 0eeb864ed47b..6675da61aa66 100644 --- a/test/e2e/prerender.test.ts +++ b/test/e2e/prerender.test.ts @@ -1922,11 +1922,15 @@ describe('Prerender', () => { expect(res.status).toBe(200) } await next.deleteFile('error.txt') - expect( - next.cliOutput.match( - /throwing error for \/blocking-fallback\/test-errors-1/ - ).length - ).toBe(1) + await check( + () => + next.cliOutput.match( + /throwing error for \/blocking-fallback\/test-errors-1/ + ).length === 1 + ? 'success' + : next.cliOutput, + 'success' + ) }) it('should automatically reset cache TTL when an error occurs and runtime cache was available', async () => { @@ -1947,11 +1951,16 @@ describe('Prerender', () => { expect(res.status).toBe(200) } await next.deleteFile('error.txt') - expect( - next.cliOutput.match( - /throwing error for \/blocking-fallback\/test-errors-2/ - ).length - ).toBe(1) + + await check( + () => + next.cliOutput.match( + /throwing error for \/blocking-fallback\/test-errors-2/ + ).length === 1 + ? 'success' + : next.cliOutput, + 'success' + ) }) it('should handle manual revalidate for fallback: blocking', async () => {