Repository: bustlelabs/shep (js)

Issue:
Dont deploy when webpack fails
If webpack has an error we should log it and stop what we're doing, this goes for builds and deploys.

Pull request description:
Ensure webpack failures are detected
We'll fail with output if webpack fails

![screen shot 2016-11-14 at 5 16 08 pm](https://cloud.githubusercontent.com/assets/25966/20285093/148296d4-aa8e-11e6-92ae-319000da3965.png)

Closes #112 

I wish I knew how to test this in the CI. Happy to add any kind of tests with some guidance.

Patch:
diff --git a/src/util/build-functions.js b/src/util/build-functions.js
index f1d8e01..7aeb533 100644
--- a/src/util/build-functions.js
+++ b/src/util/build-functions.js
@@ -1,5 +1,5 @@
 import exec from './modules/exec'
 
 export default function (PATTERN, NODE_ENV) {
-  return exec('webpack', [], { env: { PATTERN, NODE_ENV } })
+  return exec('webpack', ['--bail'], { env: { PATTERN, NODE_ENV } })
 }


Test patch:
diff --git a/test/build/index.js b/test/build/index.js
index ae97167..66405f1 100644
--- a/test/build/index.js
+++ b/test/build/index.js
@@ -6,4 +6,4 @@ test.before(() => {
   return shep.build({ quiet: true })
 })
 
-test(didExec, 'webpack')
+test(didExec, 'webpack', ['--bail'])
diff --git a/test/helpers/exec.js b/test/helpers/exec.js
index 06b9778..70c9da9 100644
--- a/test/helpers/exec.js
+++ b/test/helpers/exec.js
@@ -3,8 +3,7 @@ import td from 'testdouble'
 const exec = td.replace('../../src/util/modules/exec')
 
 function didExec (t, cmd, args, options = {}) {
-  const secondArg = args ? td.matchers.contains(args) : []
-  td.verify(exec(td.matchers.contains(cmd), secondArg, td.matchers.contains(options)))
+  td.verify(exec(cmd, args, td.matchers.contains(options)))
 }
 
 didExec.title = (providedTitle, cmd, subcmd) => `Executed ${cmd} ${subcmd || ''}`
diff --git a/test/new/index.js b/test/new/index.js
index e3c8a75..03d92a4 100644
--- a/test/new/index.js
+++ b/test/new/index.js
@@ -27,5 +27,5 @@ test(wroteFile, `${path}/.gitignore`)
 test(wroteFile, `${path}/README.md`)
 test(wroteFile, `${path}/webpack.config.js`)
 
-test(didExec, 'npm', 'install')
+test(didExec, 'npm', ['install'])