     it "should register all add events for a git clone (#{i})", (done) ->
         @timeout 5000
         watcher = new Inotifyr 'test/fixtures', recursive: yes
-        count = 0
         files = []
         watcher.on 'add', (filename, stats) ->
           files.push filename
-          count++
           console.log filename unless stats
 
         args = ['clone', 'https://github.com/codio/node-demo.git']
-        collect 'git', args, {cwd: './test/fixtures'}, 'test/fixtures/node-demo', (total) ->
-          console.log diff _.uniq(files), files
-          expect(_.uniq(files).length).to.be.eql total
+        collect 'git', args, {cwd: './test/fixtures'}, 'test/fixtures/node-demo', (realFiles) ->
+          console.log diff realFiles, files
+          expect(_.uniq(files).length).to.be.eql realFiles.length
           done()
 
   [1..5].forEach (i) =>
     it "should register all add events for an unzip action (#{i})", (done) ->
         watcher = new Inotifyr 'test/fixtures', recursive: yes
-        count = 0
         files = []
         watcher.on 'add', (filename, stats) ->
           files.push filename
-          count++
           console.log filename unless stats
 
         args = ['-zxf', 'zipFile.tar.gz', '-C', 'fixtures']
-        collect 'tar', args, {cwd: './test'}, 'test/fixtures/zipDir', (total) ->
-          console.log diff _.uniq(files), files
-          expect(_.uniq(files).length).to.be.eql total
+        collect 'tar', args, {cwd: './test'}, 'test/fixtures/zipDir', (realFiles) ->
+          console.log diff realFiles, files
+          expect(_.uniq(files).length).to.be.eql realFiles.length
           done()
 

path = require 'path'
{spawn, exec} = require 'child_process'
_ = require 'lodash'
diff = require('diff-merge-patch').orderedList.diff

Inotifyr = require '../'


  child.stderr.on 'data', (data) -> console.log data.toString()
  child.on 'close', (code) ->
    throw new Error("Exited with non zero error code: #{code}") if code isnt 0
    fs.listAll dir, {recursive: yes}, (err, list) ->
      list = _.map(list, (item) -> path.resolve path.join dir, item)
      list.push path.resolve dir
      cb list



