From 181e3efbfd98b23ba4ae8e68f194c036b3fc661f Mon Sep 17 00:00:00 2001 From: Matt Hernandez Date: Fri, 4 Sep 2015 10:47:13 -0400 Subject: [PATCH] fixes tests for build Reworks the build module to be more testable (specifically the spawn). --- lib/build.js | 6 +++--- lib/exec.js | 1 + test/build.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 lib/exec.js diff --git a/lib/build.js b/lib/build.js index 3ad8628..f6386b4 100644 --- a/lib/build.js +++ b/lib/build.js @@ -1,8 +1,8 @@ -const Spawn = require('win-spawn'); - const Hoek = require('hoek'); const Util = require('util'); +const Exec = require('./exec'); + const defaults = { server: 'localhost', directory: '.demeteorized' @@ -29,7 +29,7 @@ module.exports = function (options, done) { if (options.debug) args.push('--debug'); - var build = Spawn('meteor', args, { cwd: options.input, stdio: 'inherit' }); + var build = Exec.spawn('meteor', args, { cwd: options.input, stdio: 'inherit' }); build.on('error', function (err) { done(err); diff --git a/lib/exec.js b/lib/exec.js new file mode 100644 index 0000000..bc75e8e --- /dev/null +++ b/lib/exec.js @@ -0,0 +1 @@ +exports.spawn = require('win-spawn'); diff --git a/test/build.js b/test/build.js index aaf6658..f44f4f3 100644 --- a/test/build.js +++ b/test/build.js @@ -7,7 +7,7 @@ const Sinon = require('sinon'); var cpStub = {}; var Build = Proxyquire('../lib/build', { - 'child_process': cpStub + './exec': cpStub }); var lab = exports.lab = Lab.script();