Feature request: Allow customization/confguration of the mocha start timeout
Closed this issue · 5 comments
- Operating System: Ubuntu 16.04
- Node Version: 8.9.3
- NPM Version: 5.5.1
- mocha Version: 2.5.3
- mocha-chrome Version: 1.0.2
- This is a feature request
- This is a bug
For Features; What is the motivation and/or use-case for the feature?
Our Continuous Integration machine often needs to run several CI tasks (builds) in parallel, causing slowdown in responses from headless chrome process. This causes the tasks to fail with an error message "Mocha-Chrome Failed: mocha.run() was not called within 1000ms of the page loading."
If the loadTimeout MochaChrome constructor option would be exposed as a CLI switch, we could increase the default timeout to allow for increased load and decreased responsiveness of the chrome.
We've tried using --timeout switch, but it had no effect, so I assume that switch sets the default timeout for each separate unit test.
@ivrtaric I don't understand the request. mocha-chrome doesn't enforce the timeouts, that's up to your individual describe
or it
function scopes. see https://mochajs.org/#test-level
True, but I'm not asking about individual-test-level timeouts. I'm asking about the mocha-chrome's timeout when waiting for mocha to be started (index.js, line 109: async run() { ... }).
The run() method uses setTimeout() to check if window.mocha is available after the options.loadTimeout ms. The feature request is to make this loadTimeout option configurable.
That's actually a bug. loadTimeout
is never added to the options passed to the MochaChrome
instance, as can be seen here.
Lines 70 to 78 in 0f596aa
I'll get around to fixing it, but if you'd like to submit a PR I'd be happy to review.
Hi, ivrtaric is a good colleague of mine, so I took the liberty of submitting a PR. Hopefully that's ok?
@mcekol totally 😄