The basic version is pretty simple. This is for packages that do not have
activationCommands defined in their
describe 'Package Activation', -> beforeEach -> waitsForPromise -> atom.packages.activatePackage('package-name')
If your package does have
activationCommands, it is only slightly more complex:
describe 'Package Activation', -> [activationPromise, workspaceElement] =  executeCommand = (callback) -> atom.commands.dispatch(workspaceElement, 'package-name:some-command') waitsForPromise -> activationPromise runs(callback) beforeEach -> workspaceElement = atom.views.getView(atom.workspace) activationPromise = atom.packages.activatePackage('package-name') it 'executes a command', -> executeCommand -> expect(something).toEqual somethingElse
The way this works is that it tells Atom to activate the package but does not wait on it to finish activating. Then the test executes the command, whereupon Atom actually activates the package, so when you wait on the promise it is resolved and the test can continue.
(You can find sample code for this in my right-case package.)