From: Nicolas Coden Date: Mon, 2 Apr 2018 19:46:24 +0000 (+0200) Subject: fix: prevent push/commit with falling tests with Husky X-Git-Tag: v6.6.0~3^2~252^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47da3c06468f186aa2f4817c5c43f85d2c6b8edc;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: prevent push/commit with falling tests with Husky --- diff --git a/script/husky-precommit.js b/script/husky-precommit.js index facf88661..b7944ff7a 100644 --- a/script/husky-precommit.js +++ b/script/husky-precommit.js @@ -9,14 +9,15 @@ child.stdout.on('data', function (data) { process.stdout.write(data) }) +child.on('error', function (err) { + console.log(chalk.red(err)) +}) + child.on('exit', function (code) { if(code === 0){ console.log(chalk.yellow('🐶 ✓ Tests run well, we can commit...')) } else { console.log(chalk.yellow('🐶 ✗ Tests are failing, please fix them before committing.')) + process.exit(code); } }) - -child.on('error', function (err) { - console.log(chalk.red(err)) -}) \ No newline at end of file diff --git a/script/husky-prepush.js b/script/husky-prepush.js index 22ad2a610..1594b13ee 100644 --- a/script/husky-prepush.js +++ b/script/husky-prepush.js @@ -9,14 +9,15 @@ child.stdout.on('data', function (data) { process.stdout.write(data) }) +child.on('error', function (err) { + console.log(chalk.red(err)) +}) + child.on('exit', function (code) { if(code === 0){ console.log(chalk.yellow('🐶 ✓ Tests run well, we can push...')) } else { console.log(chalk.yellow('🐶 ✗ Tests are failing, please fix them before pushing.')) + process.exit(code); } }) - -child.on('error', function (err) { - console.log(chalk.red(err)) -}) \ No newline at end of file