Closed kawwong closed 5 years ago
Wouldn't this swallow all warnings from console.warn()
, even the ones that are unexpected?
I think Jest has its own closure per describe, so it would only swallow within the describes in which the spies are active. We could change it so that the console.warn spy is only active in the relevant tests.
If we really want to be certain, I think you're right. We'd only set up the spy per relevant test, but I don't think it's worth doing at the moment, especially given the fact that I expect us to refactor the action validation, which are pure functions, out of the listener. I think we can capture this concern as an issue and explore it in the upcoming weeks.
I captured the open question in the new issue. I like keeping our Jest test output clean. Approving.
When the tests run, we swallow the console warnings that we're expecting to be called so any warnings we see are more meaningful, preventing something like this: