Suppress JS warnings
I get a ton of JS warnings on the console, like:
JavaScript strict warning: http://localhost:57698/mocha.js, line 4811: anonymous function does not always return a value
JavaScript warning: http://localhost:57698/build.js, line 569: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead
This is very annoying. I will take a look into it.
I agree that there should be a way to suppress JS warnings. I rely on console output to determine the outcome of my tests and this would make it much easier to read.
Add this to your scripts, it will swallow page errors, allowing for clean output.
page.onError = function() { }; page.onResourceError = function() { };
I wonder which function deal with this kind of console.I want to filter this error message and when some specific error appears just exit and log
I change the page.onError page.onResourceError page.onConsoleMessage phantom.onError function.But the error stay still.