You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/04/14 10:47:57 UTC

[cordova-lib] branch master updated: Prevent masking of errors during testing (#771)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new a1c31de  Prevent masking of errors during testing (#771)
a1c31de is described below

commit a1c31de59f201ab889ceb6f377e7aac82752078a
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Sun Apr 14 12:47:53 2019 +0200

    Prevent masking of errors during testing (#771)
    
    Node.js throws an Error if the error event is emitted on a EventEmitter instance that has no handlers attached for it. This is usually the case during testing and often masks the actual error that is causing the issue.
    
    So we attach a listener to just log error events to console. During passing tests runs, no additional output is generated.
---
 spec/helper.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/spec/helper.js b/spec/helper.js
index f1a1782..b60cfcd 100644
--- a/spec/helper.js
+++ b/spec/helper.js
@@ -16,9 +16,16 @@
     specific language governing permissions and limitations
     under the License.
 */
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
 
-const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
+const { events } = require('cordova-common');
+const { SpecReporter } = require('jasmine-spec-reporter');
+
+// Node.js throws an Error if the `error` event is emitted on a EventEmitter
+// instance that has no handlers attached for it. This often masks the actual
+// error that was causing the issue. So we attach a listener here.
+events.on('error', console.error);
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
 
 jasmine.getEnv().clearReporters();
 jasmine.getEnv().addReporter(new SpecReporter({


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org