-
-
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
Deferred execution (2014) #1124
Conversation
This function signals mocha to pause processing files while tests are generated asynchronously. For this to work, a few changes were required in the Mocha and Runner classes: - In the Mocha class, the 'loadFiles' method was refactored to work asynchonously. - In the Runner class, the globals initialization was moved out of the constructor into a new method: 'initDefaultGlobals'. This method needs to be invoked prior to running the tests, so the runner will take a 'snapshot' of the global properties. This commit should also solve issue mochajs#362
Conflicts: lib/mocha.js lib/runner.js
looks good mostly, i'm not so sure about having the wait fn on global |
👍 This will help address some compatibility issues in Blanket as well. The wait fn does get removed from global, fwiw - https://github.com/visionmedia/mocha/pull/1124/files#diff-aa849a970cef551664c12f04a4209f6fR188. |
Bump? |
This would be nice to have. On my team, we basically have a rule to never generate tests asynchronously because it isn't supported. |
Bump |
Also, bump. |
The PR doesn't seem too big. Is there something holding the merge, @visionmedia ? |
@travisjeffery any objections to merging? |
i'd rather add an option to Mocha and then use the existing run api. same with tj |
@travisjeffery How would we set this "async" Mocha option on a per-test basis (or browser usage)? By "existing run api" I assume you mean |
35c1580
to
64dfc0b
Compare
bump |
It's really very usefull feature when you need to do some async stuff (e.g. get test data from db which will be used at |
this won't get merged; see #1439 |
This is @tarruda's #719 pull request from last year updated to cleanly merge. All tests pass.
From the original request:
@travisjeffery This pull request implements TJ's suggestion for fixing #362 and includes a test. Can this be included in Mocha? Deferred execution has inspired Mocha forks and prevents test runners like Yeti from running async-defined Mocha tests. Thank you!
/cc @alex-seville