Skip to content
Permalink
Browse files

fix: use apply for console error args when proxying (#454)

* fix: spread console error args when proxying

Without this the proxied errors are logged as an array, which is not very helpful.

* Update act-compat.js

* Update old-act.js


Co-authored-by: Kent C. Dodds <kent+github@doddsfamily.us>
  • Loading branch information
eventualbuddha and kentcdodds committed Aug 16, 2019
1 parent 2bbfff3 commit f4f3ea566eef3f61090ef93d7da0229d2e67a160
Showing with 2 additions and 4 deletions.
  1. +1 −3 src/__tests__/old-act.js
  2. +1 −1 src/act-compat.js
@@ -34,9 +34,7 @@ test('async act works even when the act is an old one', async () => {
expect(console.error.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
Array [
"sigil",
],
"sigil",
],
Array [
"It looks like you're using a version of react-dom that supports the \\"act\\" function, but not an awaitable version of \\"act\\" which you will need. Please upgrade to at least react-dom@16.9.0 to remove this warning.",
@@ -42,7 +42,7 @@ function asyncAct(cb) {
) {
// no-op
} else {
originalConsoleError.call(console, args)
originalConsoleError.apply(console, args)
}
}
let cbReturn, result

0 comments on commit f4f3ea5

Please sign in to comment.
You can’t perform that action at this time.