forked from gristlabs/mocha-webdriver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support running mocha in parallel mode
This library doesn't work as is when mocha is configured to run parallel jobs. The biggest change is how hooks work; there are now separate processes coordinated by mocha that have their own life-cycle. The library can't even be imported correctly in parallel mode, since it attempts to use `before` and `after`, and there is now a context in which those are not defined. This commit makes it possible to import the library in contexts where `before` and `after` are not yet defined, and to access the needed methods for starting up and cleaning up without immediately invoking them. The user can then install the hooks in the way that parallel operation requires, see: https://mochajs.org/#defining-a-root-hook-plugin In parallel mode, the before/after hooks for the library will run at the beginning and end of each test file. This imposes a cost, since the browser has a non-trivial startup time. If the user is willing to clean up (or ignore) browser processes, they can set a flag to skip browser shutdowns at the end of each test file. Perhaps someday mocha will have hooks for the lifecycle of worker processes, and then a cleaner solution will be possible. Some debugging functionality of mocha-webdriver doesn't make sense in a multi-process scenario - I haven't touched this. Debugging will be best done without parallelism, this tweak is targetted at use in CI workflows.
- Loading branch information
Showing
4 changed files
with
75 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters