lundi 25 janvier 2016

How to prevent img src 404 error when unit testing using PhantomJS

I have a test that checks that the src attribute of an <img/> is set correctly.
PhantomJS rightly warns about a 404 error trying to retrieve a non-existent file.

How can I get around this? Silent the warning for this particular test for example.

Note that specifying an image URL that exists is not something I am considering. I want to test that a function sets the image src to a passed-in value, don't care if that value exists for the purpose of this unit test.

Aucun commentaire:

Enregistrer un commentaire