From ede4926069918bb66b7a4e1232a62ac01d2ea665 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 8 Jun 2018 06:14:46 -0400 Subject: [PATCH] don't continue testing file if there was deploy errors; avoids unrelated errors for each 'it' --- lib/tests/run_tests.js | 4 ++-- lib/tests/test.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/tests/run_tests.js b/lib/tests/run_tests.js index eb31209ae..0ed32c7c6 100644 --- a/lib/tests/run_tests.js +++ b/lib/tests/run_tests.js @@ -83,8 +83,8 @@ module.exports = { mocha.suite.timeout(0); mocha.suite.beforeAll('Wait for deploy', (done) => { - global.embark.onReady(() => { - done(); + global.embark.onReady((err) => { + done(err); }); }); diff --git a/lib/tests/test.js b/lib/tests/test.js index 4f9d10755..bc9b5abe0 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -117,6 +117,9 @@ class Test { this.events.once('ready', () => { callback(); }); + this.events.once('deployError', (err) => { + callback(err); + }); } config(options, callback) { @@ -175,12 +178,12 @@ class Test { }, function deploy(next) { self._deploy(options, (err, accounts) => { - self.ready = true; - self.events.emit('ready'); if (err) { - console.error(err.red); + self.events.emit('deployError', err); return next(err); } + self.ready = true; + self.events.emit('ready'); next(null, accounts); }); }