From c77a1c622f64b74482ce6c2285863d2d1d519f6c Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Fri, 1 Mar 2024 13:09:23 +0100 Subject: [PATCH] refactor(test): improve build error message (#53946) --- api/jest.utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/jest.utils.ts b/api/jest.utils.ts index 25aeee4b1db..6f8dd4282bd 100644 --- a/api/jest.utils.ts +++ b/api/jest.utils.ts @@ -118,6 +118,9 @@ export function setupServer(): void { }, 10000); afterAll(async () => { + if (!global.fastifyTestInstance) + throw Error(`fastifyTestInstance was not created. Typically this means that something went wrong when building the fastify instance. +If you are seeing this error, the root cause is likely an error thrown in the beforeAll hook.`); await fastifyTestInstance.prisma.$runCommandRaw({ dropDatabase: 1 }); // Due to a prisma bug, this is not enough, we need to --force-exit jest: