-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix delay option in browser #1800
Conversation
@@ -119,6 +119,9 @@ mocha.ui = function(ui){ | |||
|
|||
mocha.setup = function(opts){ | |||
if ('string' == typeof opts) opts = { ui: opts }; | |||
if (Object.prototype.hasOwnProperty.call(opts, 'delay')) { |
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.
maybe just if ('delay' in opts)
?
Thanks for the PR, and appreciate the specs! :) While it might be odd to have a special case, it's pretty understandable that some order could be implied in these invocations. That |
it('should have no effect if attempted twice in the same suite', function() { | ||
assert(true); | ||
run(); | ||
assert(true); |
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.
Maybe this spec could be updated? Rather than the two assert(true)
, we could have another assertion on the time, ensuring that some number less than delay has elapsed since (start + delay)
7376e76
to
96111b7
Compare
Cool. Made those changes. Do the browser tests get run as part of |
Not right now. I've got a local branch I started that will run them with phantomjs, so what you have is perfect! |
@jRiest is it possible that the test file broke after the change? I'm getting
|
Hmm, that's strange. It seems to still be working for me when I just open up delay.html in my browser. I did have to run I assumed I wasn't supposed to commit updates to the built file, is that correct? |
Although I guess your comment raises a concern that if the delay functionality did break, the tests may just never be run and we may never know it broke. I suppose if I move the "should have waited..." test outside of the setTimeout that would catch that error. I'll update the PR. |
96111b7
to
f54a73a
Compare
That's right. My mistake - I must have checked out HEAD after rebuilding mocha.js without paying attention.
That would be perfect :) It would be great if the test failed when the delay didn't work as expected. That's what I was trying to test. |
@jRiest what's the status of updating this PR? We also need this fix. I can look into it too, if needed. |
f54a73a
to
58b114d
Compare
Sorry for dropping this. We ended up not needing it so it slipped my mind. Just pushed a change that should make the tests fail without this fix. It's a little strange since the original issue was that the |
@danielstjules, is this mergeable now? |
This is a valid issue. @natlibfi-arlehiko, @jRiest - closing this for now due to age, added pr-please to #1799 so this can be updated. |
@hollomancer I think this PR has addressed all of the comments. Is there something else that needs to be done before it can be merged? |
@jRiest Thanks. It wasn't your fault this was closed; sorry about that. I have some comments if you are willing to work on this further:
A good test for this would actually run Mocha (via karma-mocha) with a So I think, perhaps, if you're unable or unwilling to embark on that, then modifying the code in |
I am a bot that watches issues for inactivity. |
Tests in |
I am a bot that watches issues for inactivity. |
This PR addresses #1799. It feels a bit weird to special-case the delay option like this, but it looks like that's the only option that's read from
mocha.options
prior tomocha.run()
being called.Totally open to better suggestions though.