-
Notifications
You must be signed in to change notification settings - Fork 176
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
mocha.run not re-added if testReadyCallback provided #377
Comments
Most of that code is a hacky workaround to the fact that the Mocha runner can't be deferred initialized (as with RequireJS). Having mocha accept this PR would help (mochajs/mocha#1124). |
So will this just need to wait on the result of that then? |
The current https://github.com/alex-seville/blanket/blob/master/src/adapters/mocha-blanket.js#L62 Basically, the mocha.run gets reset either way, BUT if requirejs ISN'T being used it will also apply the callback passed to mocha.run originally (I forget why requirejs is special in this regard). |
You know, I did actually miss that it was always getting reset -- read it more of and if/else. That does actually present another problem, though. When blanket finishes loading, it immediately executes mocha.run. In some cases (in our case) we would prefer to choose when that runs (we have to wait on another load to finish). Where you replace the mocha.run, you are catching calls to mocha.run, but you aren't checking whether it was ever run. It would probably make sense to conditional execute the mocha.run if that was override was called rather than just executing it every time. |
Edit: well, I upgraded
|
In the Mocha adapter, there is a block that hijacks the mocha.run
Later, in the beforeStartTestRunner function, it checks if a testReadyCallback was provided. If so, it executes that callback, otherwise it calls the default callback, which can replace mocha.run, but only if existingRequireJS is true.
I'll admit that I'm not entirely sure why the existingRequireJS is relevant to whether or not mocha.run is un-hijacked, but it seems like it should be added back at some point regardless. Is there something I'm misunderstanding?
The text was updated successfully, but these errors were encountered: