mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
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:
@@ -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")
|
||||
|
||||
1
spec/fixtures/packages/package-with-empty-activation-events/index.coffee
vendored
Normal file
1
spec/fixtures/packages/package-with-empty-activation-events/index.coffee
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = activate: ->
|
||||
5
spec/fixtures/packages/package-with-empty-activation-events/package.json
vendored
Normal file
5
spec/fixtures/packages/package-with-empty-activation-events/package.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "no events",
|
||||
"version": "0.1.0",
|
||||
"activationEvents": []
|
||||
}
|
||||
Reference in New Issue
Block a user