-
-
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
test.only is not working if code is loading after mocha.run() #2077
Comments
using globals is kind of heavy-handed to fix this, but if it works for you, then that's good. would accept a PR to fix this. |
Rather than having *This isn't strictly private, but marked as intended to be private by the underscore variable name convention, which other Mocha internal variables already are too. |
@ScottFreeCode Sounds reasonable |
I am a bot that watches issues for inactivity. |
This is a duplicate of #1838, right? |
Looks like it! This issue also hasn't been interacted with in quite a while. |
Hi, I am a newbie to use Mocha and I think it is a really really cool tool to test my javascript code. Thanks for creating such great tool.
However, I met some problem to test my AMD module code. See the following. Please let me know if it is worked as designed.
Currently, I am using mocha delay method to test AMD modules. However, I just found the test.only is not working. My way is:
It works well until I found test.only won't work, while test.only works well in browser mode.
After some investigation, I found probably it is a design issue. The runner instance is started when mocha.run() is fired, and the options.grep is stored in runner immediately. See the following code I grabbed from mocha.js. As a result, whiling loading AMD modules after mocha.run() is fired and before run() is issued, the test.only will change the mocha.options.grep, but it won't change the runner's grep. As a result, when the run() and then runner.runTests() is issued, the grep is not working.
I just think it would be better to let runner to read mocha.options.grep rather than reading a temp value stored.
My current workaround is to rewrite the _mocha file and:
Please let me know I am doing towards the right direction. Thanks :)
The text was updated successfully, but these errors were encountered: