teampoltergeist / poltergeist

A PhantomJS driver for Capybara
MIT License
2.5k stars 415 forks source link

How to ignore console.error and still use js_errors: true #877

Closed vemv closed 7 years ago

vemv commented 7 years ago

Hi!

Let's say a JS library outside of my control likes to console.error on warnings. They don't break my app in any way.

In that case, the js_errors: true option would cause my build to fail. So I have to set it to false, which is quite undesirable.

Is there a way to observe only actual errors, disregarding console.error output?

Cheers - Victor

twalpole commented 7 years ago

Nope, ask the library to stop outputting non-errors to console.error or check if the library has a production mode that doesn't output non-errors to console.error

vemv commented 7 years ago

Alright, mind to clarify why is this not possible? Phantomjs thing or poltergeist implementation detail?

twalpole commented 7 years ago

Poltergeist relies on the PhantomJS onError callback which is called when console.error is called - The name console.error is pretty self explanatory, not sure why "some" libraries choose to use it for warnings.

vemv commented 7 years ago

Thanks so much for the explanation!