You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`match` is either a regular expression, a string, or a predicate function:
107
107
@@ -110,6 +110,7 @@ Each rule has three options, `match`, `group` and (optionally) `keep`.
110
110
- A predicate function that's called with `match(message, level)` where
111
111
-`message` is the full console message
112
112
-`level` is the log level (error, warning, log etc..).
113
+
-`origin` is the stack trace string for this error. Useful if you want to ignore all errors from a certain library, for example. Note that this string can contain newlines, so any regexes used to match it should use the `/g` flag.
113
114
- To match this message, the predicate may return any truthy value.
114
115
115
116
Rules are matched in order, from top down. A message that is not matched by any rule will be displayed in the Jest test output as normal.
@@ -215,6 +216,21 @@ You can use the grouping function, where the original matcher is provided as a t
215
216
}
216
217
```
217
218
219
+
### Can I ignore random `console.error`s from a specific library?
220
+
221
+
Yes, `console.error` comes with an `origin` property that contains the full stack trace
222
+
at the time of logging, which you should be able to use to filter per library, or even per file and line!
223
+
224
+
The origin may not be available for other log types, so check it before you use it.
0 commit comments