mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
Serialize package upon deactivation
This commit is contained in:
@@ -445,11 +445,12 @@ describe "PackageManager", ->
|
||||
expect(console.warn).not.toHaveBeenCalled()
|
||||
|
||||
it "passes the activate method the package's previously serialized state if it exists", ->
|
||||
pack = atom.packages.loadPackage("package-with-serialization")
|
||||
pack = null
|
||||
waitsForPromise ->
|
||||
pack.activate() # require main module
|
||||
atom.packages.activatePackage("package-with-serialization").then (p) -> pack = p
|
||||
runs ->
|
||||
atom.packages.setPackageState("package-with-serialization", {someNumber: 77})
|
||||
expect(pack.mainModule.someNumber).not.toBe 77
|
||||
pack.mainModule.someNumber = 77
|
||||
atom.packages.deactivatePackage("package-with-serialization")
|
||||
spyOn(pack.mainModule, 'activate').andCallThrough()
|
||||
waitsForPromise ->
|
||||
|
||||
@@ -487,6 +487,7 @@ class PackageManager
|
||||
# Deactivate the package with the given name
|
||||
deactivatePackage: (name) ->
|
||||
pack = @getLoadedPackage(name)
|
||||
@serializePackage(pack)
|
||||
pack.deactivate()
|
||||
delete @activePackages[pack.name]
|
||||
delete @activatingPackages[pack.name]
|
||||
|
||||
Reference in New Issue
Block a user