       atom.packages.unloadPackages()
 
     it "calls `deactivate` on the package's main module if activate was successful", ->
+      spyOn(atom, 'inSpecMode').andReturn(false)
       pack = null
       waitsForPromise ->
         atom.packages.activatePackage("package-with-deactivate").then (p) -> pack = p


  describe "::activate()", ->
    beforeEach ->
      jasmine.snapshotDeprecations()
      spyOn(console, 'warn')
      atom.packages.loadPackages()

      expect(pack.metadata.name).toBe "package-with-index"

    it "returns the package if it has an invalid keymap", ->
      spyOn(atom, 'inSpecMode').andReturn(false)
      pack = atom.packages.loadPackage("package-with-broken-keymap")
      expect(pack instanceof Package).toBe true
      expect(pack.metadata.name).toBe "package-with-broken-keymap"

    it "returns the package if it has an invalid stylesheet", ->
      spyOn(atom, 'inSpecMode').andReturn(false)
      pack = atom.packages.loadPackage("package-with-invalid-styles")
      expect(pack instanceof Package).toBe true
      expect(pack.metadata.name).toBe "package-with-invalid-styles"
