Skip to content

Commit

Permalink
use explicit .then and .catch instead of .finally for node 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Aug 28, 2020
1 parent 62eaac4 commit ce75f65
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions __tests__/purgeUnusedStyles.test.js
Expand Up @@ -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
}
}

Expand Down

0 comments on commit ce75f65

Please sign in to comment.