Skip to content

Commit 681e4d8

Browse files
authored
Merge pull request #2269 from tailwindlabs/fix-promise-finally
use explicit .then and .catch instead of .finally for node 8.x
2 parents 62eaac4 + ce75f65 commit 681e4d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

__tests__/purgeUnusedStyles.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ function suppressConsoleLogs(cb, type = 'warn') {
88
return () => {
99
const spy = jest.spyOn(global.console, type).mockImplementation(jest.fn())
1010

11-
return new Promise((resolve, reject) => {
11+
const promise = new Promise((resolve, reject) => {
1212
Promise.resolve(cb()).then(resolve, reject)
13-
}).finally(() => spy.mockRestore())
13+
})
14+
15+
promise.then(spy.mockRestor, spy.mockRestore)
16+
17+
return promise
1418
}
1519
}
1620

0 commit comments

Comments
 (0)