         gotMessages = messages
       waitsForPromise ->
         linterRegistry.lint({onChange: false, editorLinter}).then ->
-          setTimeout ->
+          nextAnimationFrame().then() ->
             expect(gotMessages).toBeDefined()
             expect(gotMessages.length).toBe(1)
             linterRegistry.deactivate()
             messageRegistry.deactivate()
-          , 1000
 
   describe '::deleteEditorMessages', ->
     it 'removes messages for that editor', ->

        messageRegistry.deleteEditorMessages(editor)
      waitsForPromise ->
        linterRegistry.lint({onChange: false, editorLinter}).then ->
          setTimeout ->
            expect(gotMessages).toBeDefined()
            expect(gotMessages.length).toBe(0)
            linterRegistry.deactivate()
            messageRegistry.deactivate()
          , 1000

  MessageRegistry = require('../lib/message-registry')
  EditorLinter = require('../lib/editor-linter')
  LinterRegistry = require('../lib/linter-registry')
  nextAnimationFrame = ->
    return new Promise (resolve) -> requestAnimationFrame(resolve)
  getLinterRegistry = ->
    linterRegistry = new LinterRegistry
    editorLinter = new EditorLinter(atom.workspace.getActiveTextEditor())
