               should.exist err
               callback()
         ], (err) ->
-          done()
+          done err

            writer.on 'ready', ->
              callback()
          # Stop the nsqd process.
          (callback) ->
            nsqdProcess.kill()
            setTimeout callback, 10
          # Attempt to publish a message.
          (callback) ->

        should.not.exist err
        done()

describe 'failures', ->
  before (done) ->
    temp.mkdir '/nsq', (err, dirPath) =>
      startNSQD dirPath, {}, (err, process) =>
        @nsqdProcess = process
        done err

  after (done) ->
    @nsqdProcess.kill()
    # Give nsqd a chance to exit before it's data directory will be cleaned up.
    setTimeout done, 500

