diff --git a/core-js/src/main/scala/coursier/core/Fetch.scala b/core-js/src/main/scala/coursier/core/Fetch.scala index 8a9728cc2..62828ef3e 100644 --- a/core-js/src/main/scala/coursier/core/Fetch.scala +++ b/core-js/src/main/scala/coursier/core/Fetch.scala @@ -19,13 +19,19 @@ object Fetch { lazy val jsonpAvailable = !js.isUndefined(g.jsonp) + val timeout = + if (jsonpAvailable) + 10000 // Browser - better to have it > 5000 for complex resolutions + else + 4000 // Node - tests crash if not < 5000 + /** Available if we're running on node, and package xhr2 is installed */ lazy val xhr = g.require("xhr2") def xhrReq() = js.Dynamic.newInstance(xhr)().asInstanceOf[XMLHttpRequest] def fetchTimeout(target: String, p: Promise[_]) = - setTimeout(5000) { + setTimeout(timeout) { if (!p.isCompleted) { p.failure(new Exception(s"Timeout when fetching $target")) }