     pack = null
     beforeEach ->
       atom.config.set('core.themes', ["theme-with-index-less"])
-      atom.themes.activateThemes()
-      pack = atom.themes.getActiveThemes()[0]
-      uiWatcher = new UIWatcher()
+      waitsForPromise ->
+        atom.themes.activateThemes()
+      runs ->
+        uiWatcher = new UIWatcher()
+        pack = atom.themes.getActiveThemes()[0]
 
     afterEach ->
       uiWatcher.destroy()

  describe "when a package global file changes", ->
    beforeEach ->
      atom.config.set('core.themes', ["theme-with-ui-variables", "theme-with-multiple-imported-files"])
      atom.themes.activateThemes()
      uiWatcher = new UIWatcher()

    afterEach ->
      uiWatcher.destroy()


  describe "when a package does not have a stylesheet", ->
    beforeEach ->
      waitsForPromise ->
        atom.packages.activatePackage("package-with-index")
      runs ->
        uiWatcher = new UIWatcher()

    afterEach ->
      uiWatcher.destroy()
