erisu commented on code in PR #285:
URL: https://github.com/apache/cordova-paramedic/pull/285#discussion_r2611479652


##########
lib/paramedic.js:
##########
@@ -81,15 +79,21 @@ class ParamedicRunner {
                     logger.normal('Start building app and running tests at ' + 
(new Date()).toLocaleTimeString());
                 }
                 // run tests
-                return this.runTests();
+                return Promise.race([
+                    this.runTests(),
+                    new Promise((resolve, reject) =>
+                        setTimeout(() => reject(
+                            new Error(`[paramedic] Tests failed to complete in 
${this.config.getTimeout()} ms.`)
+                        ), this.config.getTimeout())
+                    )
+                ]);
             })
-            .timeout(this.config.getTimeout(), 'Timed out after waiting for ' 
+ this.config.getTimeout() + ' ms.')
             .catch((error) => {
                 logger.error(error);
                 console.log(error.stack);
-                throw new Error(error);
+                throw error;
             })
-            .fin((result) => {
+            .then((result) => {

Review Comment:
   I believe 
[`Promise.prototype.finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally)
 is not the correct function to use.
   
   In this case, we are expecting results to be passed in and then later we 
continue to pass it up the chain.
   
   The 
[`onFinally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally#onfinally)
 function takes in no arguments.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to