       stats.tests = 1
 
     beforeEach () ->
+      sinon.stub fsStub, 'writeFile', (path, data, callback) ->
+        callback()
 
     afterEach () ->
+      fsStub.writeFile.restore()
 
     it 'should write the file', (done) ->
       reporter = new HtmlReporter(emitter, {}, {}, "test.html")

        title: 'Failed Test'

    it 'should call the fail event', (done) ->
      emitter.emit 'test start', test
      emitter.emit 'test fail', test
      done()

  describe 'when test errors', () ->

        title: 'Passing Test'

    it 'should call the pass event', (done) ->
      reporter = new HtmlReporter(emitter, {}, {}, "test.html")
      emitter.emit 'test start', test
      emitter.emit 'test pass', test
      assert.ok ~reporter.buf.indexOf 'Pass'
      done()

    describe 'when details=true', () ->

      it 'should write details for passing tests', (done) ->
        reporter = new HtmlReporter(emitter, {}, {}, "test.html")
        reporter.details = true
        emitter.emit 'test pass', test
        assert.ok ~reporter.buf.indexOf 'Request'
        done()

  describe 'when test is skipped', () ->
