process.env.NODE_ENV = 'test';

var
  chai       = require('chai'),
  should     = chai.should(),
  expect     = chai.expect,
  fs         = require('fs'),
  config     = require('../config'),
  installDir = config.componentInstallDir,
  buildDir   = config.componentBuildDir,
  utils      = require('../lib/utils'),
  clear      = require('./helpers/clear'),
  helper     = require('../lib/componentHelper');

var
  overdrive = require('../mocks/components/web-audio-components-overdrive/component.json'),
  delay     = require('../mocks/components/web-audio-components-delay/component.json');

describe('Component Helper', function () {

  before(clear);
  after(clear);

  describe('Install', function () {
    // Maybe a better way to test implementation rather than use mock?
    // Don't want to hammer components service
    it('should call install and fire the callback', function (done) {
      helper.install({ repo: 'what/ever', version: '*' }, function () {
        done();
      });
    });
  });

  describe('Build', function () {
    it('should build component to build directory', function (done) {
      helper.build(delay, function (err) {
        var build = utils.getBuildScriptPath(delay.repo);
        expect(err).to.not.be.ok;
        fs.stat(build, function (err, stats) {
          expect(stats.size).to.equal(3222);
          done();
        });
      });
    });
    it('returns an error if invalid repo', function (done) {
      helper.build({ repo: 'not/real', version: '*' }, function (err) {
        expect(err).to.be.ok;
        done();
      });
    });
  });
});

@@ -641,16 +641,20 @@
   before
+Each
 (clear);
@@ -661,16 +661,20 @@
 %0A  after
+Each
 (clear);
@@ -715,126 +715,8 @@
 ) %7B%0A
-    // Maybe a better way to test implementation rather than use mock?%0A    // Don't want to hammer components service%0A
     
@@ -990,32 +990,79 @@
 nction (done) %7B%0A
+      helper.install(delay, function (err) %7B%0A  
       helper.bui
@@ -1100,17 +1100,18 @@
     
+  
 var 
-build
+path
  = u
@@ -1147,32 +1147,34 @@
 .repo);%0A        
+  
 expect(err).to.n
@@ -1195,16 +1195,18 @@
     
+  
 fs.stat(
 buil
@@ -1201,21 +1201,20 @@
 fs.stat(
-build
+path
 , functi
@@ -1227,24 +1227,26 @@
 r, stats) %7B%0A
+  
           ex
@@ -1284,32 +1284,34 @@
 ;%0A          
+  
 done();%0A
         %7D);%0A
@@ -1294,24 +1294,38 @@
     done();%0A
+          %7D);%0A
         %7D);%0A

Install component before building in test