Skip to content

Commit

Permalink
Merge pull request tailwindlabs#2269 from tailwindlabs/fix-promise-fi…
Browse files Browse the repository at this point in the history
…nally

use explicit .then and .catch instead of .finally for node 8.x
  • Loading branch information
RobinMalfait authored 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
Original file line number Diff line number Diff line change
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.