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
I have a situation where are tests are sometimes run under phantom 1.x and sometimes under 2.x. I have to check for a specific exception message being thrown but the exact message depends on which version of phantom, e.g.:
(def phantom-1.x-undef-err-msg "'undefined' is not a function (evaluating 'window.foo()')")
(def phantom-2.x-undef-err-msg "undefined is not a constructor (evaluating 'window.foo()')")
It would be great to be able to pass a regex instead of a string to should-throw then I could just definte one regex something like .*undefined.*is not a .* evaluating ('window.foo()').
I've also run into cases in the past where the exceptions thrown by a library outside of my control would use messages that included details like IP addresses or other values that could vary from environment to environment. Previously I just skipped checking the messages for these exceptions but that was not ideal.
I would be happy to take a shot at a PR if it would be welcomed.
Let me know what you think. Thanks.
The text was updated successfully, but these errors were encountered:
lgastako
changed the title
Add support regex's with should-throw?
Add support for regex's with should-throw?
Oct 8, 2015
Hi,
I have a situation where are tests are sometimes run under phantom 1.x and sometimes under 2.x. I have to check for a specific exception message being thrown but the exact message depends on which version of phantom, e.g.:
It would be great to be able to pass a regex instead of a string to
should-throw
then I could just definte one regex something like.*undefined.*is not a .* evaluating ('window.foo()')
.I've also run into cases in the past where the exceptions thrown by a library outside of my control would use messages that included details like IP addresses or other values that could vary from environment to environment. Previously I just skipped checking the messages for these exceptions but that was not ideal.
I would be happy to take a shot at a PR if it would be welcomed.
Let me know what you think. Thanks.
The text was updated successfully, but these errors were encountered: