use explicit .then and .catch instead of .finally for node 8.x
This commit is contained in:
parent
62eaac4b08
commit
ce75f65347
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue