Skip to content

Commit

Permalink
Merge pull request #2269 from tailwindlabs/fix-promise-finally
Browse files Browse the repository at this point in the history
use explicit .then and .catch instead of .finally for node 8.x
  • Loading branch information
RobinMalfait committed Aug 28, 2020
2 parents 62eaac4 + ce75f65 commit 681e4d8
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 681e4d8

Please sign in to comment.