             expect(mainModule.activate.callCount).toBe 1
 
         it "adds a notification when the activation commands are invalid", ->
+          spyOn(atom, 'inSpecMode').andReturn(false)
           addErrorHandler = jasmine.createSpy()
           atom.notifications.onDidAddNotification(addErrorHandler)
           expect(-> atom.packages.activatePackage('package-with-invalid-activation-commands')).not.toThrow()


  describe "::serialize", ->
    it "does not serialize packages that threw an error during activation", ->
      spyOn(console, 'warn')
      badPack = null
      waitsForPromise ->

      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"
