-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require arguments to beforeEach, it, etc, to be actual functions #1222
Conversation
Thanks for taking a shot at this. Unfortunately, you have introduced a breaking change that we don't want. An Please update this PR so that an Thanks for using Jasmine! |
@@ -288,6 +288,13 @@ getJasmineRequireObj().Env = function(j$) { | |||
return spyRegistry.spyOn.apply(spyRegistry, arguments); | |||
}; | |||
|
|||
var ensureIsFunction = function(fn, caller) { | |||
var fnType = Object.prototype.toString.call(fn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to just use j$.isFunction_
here instead of writing it again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks. I think it'd be valuable to include the type of the (invalid) argument, so I extract the Object.prototype.toString call out to a helper, j$.getType_.
Thanks for the review! I modified it to allow an |
@slackersoft Do you have any more feedback on this PR? Anything I should change? |
cef1f74
to
fa9154a
Compare
@slackersoft Friendly ping? |
This looks pretty good now, but I just ran the specs in IE (they don't run for pull requests on travis due to secure environment variables) and I'm seeing a bunch of errors for IE8 that look like:
So it looks like IE (at least in version 8) isn't getting the type information we expect. |
c3f5bf7
to
fa9154a
Compare
fa9154a
to
b59ac96
Compare
I took a look, and indeed, it seems like IE8 returns I modified the specs to also accept |
This fixes #1004. Let me know if there are any concerns or ideas for improvement! Note that this does change the public API in a few ways, namely:
describe
,beforeEach
, et al, without providing a function argument will now throw an error instead of silently skipping tests (this is the goal).xdescribe
andxit
(since the suite/spec isn't actually ran), I chose to disallow non-function arguments if they are given (that is, pending specs that omit the fn argument completely, likeit('foo')
, still work as intended).JSHint is green, tests pass in Node and browser environments (haven't tested IE yet).