From ce75f65347784925ab8db7c2b3592fcb00f0b78d Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 28 Aug 2020 15:32:42 +0200 Subject: [PATCH] use explicit .then and .catch instead of .finally for node 8.x --- __tests__/purgeUnusedStyles.test.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/__tests__/purgeUnusedStyles.test.js b/__tests__/purgeUnusedStyles.test.js index 73cee87fc..45aaf662e 100644 --- a/__tests__/purgeUnusedStyles.test.js +++ b/__tests__/purgeUnusedStyles.test.js @@ -8,9 +8,13 @@ function suppressConsoleLogs(cb, type = 'warn') { return () => { const spy = jest.spyOn(global.console, type).mockImplementation(jest.fn()) - return new Promise((resolve, reject) => { + const promise = new Promise((resolve, reject) => { Promise.resolve(cb()).then(resolve, reject) - }).finally(() => spy.mockRestore()) + }) + + promise.then(spy.mockRestor, spy.mockRestore) + + return promise } }