Check that activations events are present

Having an empty array, object, or string will now be treated
as no activation events.

This was reported as being confusing since people were just clearing
the array generated by the package generator but their packages weren't
activating.
This commit is contained in:
Kevin Sawicki
2014-03-11 15:12:13 -07:00
parent 3a9584b840
commit 8cb66895f0
4 changed files with 30 additions and 2 deletions

View File

@@ -126,6 +126,16 @@ describe "the `atom` global", ->
expect(eventHandler.callCount).toBe 2
expect(mainModule.activate.callCount).toBe 1
it "activates the package immediately when the events are empty", ->
mainModule = require './fixtures/packages/package-with-empty-activation-events/index'
spyOn(mainModule, 'activate').andCallThrough()
waitsForPromise ->
atom.packages.activatePackage('package-with-empty-activation-events')
runs ->
expect(mainModule.activate.callCount).toBe 1
describe "when the package has no main module", ->
it "does not throw an exception", ->
spyOn(console, "error")

View File

@@ -0,0 +1 @@
module.exports = activate: ->

View File

@@ -0,0 +1,5 @@
{
"name": "no events",
"version": "0.1.0",
"activationEvents": []
}