From a5e55e28f1ad4fd60328f47527298c3090b8961c Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 28 Jul 2020 00:24:12 -0400 Subject: [PATCH] test: improve unexpected warning output --- scripts/setupJestEnv.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/setupJestEnv.ts b/scripts/setupJestEnv.ts index 95f12615..381a404f 100644 --- a/scripts/setupJestEnv.ts +++ b/scripts/setupJestEnv.ts @@ -80,9 +80,10 @@ afterEach(() => { }) warn.mockRestore() if (nonAssertedWarnings.length) { - nonAssertedWarnings.forEach(warning => { - console.warn(warning) - }) - throw new Error(`test case threw unexpected warnings.`) + throw new Error( + `test case threw unexpected warnings:\n - ${nonAssertedWarnings.join( + '\n - ' + )}` + ) } })