// Sloppy mock for component.install in tests

var
  utils   = require('../lib/utils'),
  fs      = require('fs-extra'),
  Emitter = require('events').EventEmitter;

function Package (repo, version, options) {
  this.repo = repo;
  this.version = version;
  this.options = options;
}

Package.prototype.__proto__ = Emitter.prototype;

Package.prototype.install = function () {
  var
    src  = __dirname + '/components/' + this.repo.replace('/', '-'),
    dest = utils.getInstallDir(this.repo);

  fs.copy(src, dest, function (err) {
    this.emit('end');
  });
}

module.exports = {
  install : function (repo, version, options) {
    return new Package(repo, version, options);
  }
};

@@ -114,16 +114,47 @@
 xtra'),%0A
+  mkdirp  = require('mkdirp'),%0A
   Emitte
@@ -407,16 +407,33 @@
 %7B%0A  var%0A
+    that = this,%0A
     src 
@@ -537,16 +537,50 @@
 repo);%0A%0A
+  mkdirp(dest, function (err) %7B%0A  
   fs.cop
@@ -613,20 +613,22 @@
 ) %7B%0A    
-this
+  that
 .emit('e
@@ -633,16 +633,24 @@
 'end');%0A
+    %7D);%0A
   %7D);%0A%7D%0A

Use mkdirp when copying components in mock