Spec "timed out after 5000 msec waiting for something to happen"


#1

For some reason, spec fails to run asynchronous on waitsForPromise with “timed out after 5000 msec waiting for something to happen” message. Here is the code:

describe "MODX grammar", ->
  grammar = null

  beforeEach ->
    waitsForPromise ->
      atom.packages.activatePackage("modx-revolution")

    runs ->
      grammar = atom.grammars.grammarForScopeName("text.html.modx")

  it "parses the grammar", ->
    expect(grammar).toBeTruthy()
    expect(grammar.scopeName).toBe "text.html.modx"

When running it with apm test, there is 0 tests shown. Grammar itself working as expected. Whats the problem here?
Btw, running on Arch Linux x64.

Thanks in advance.


#2

See the new FAQ on how to activate a package for specs, specifically the section on a package with activationCommands (like yours):


#3

Thanks! It worked.

Just one more thing: Will dispatching a package commands slow down the tests? Or in opposite way: Will removing activationCommands from package.json slow down the editor?


#4
  1. No, dispatching package commands won’t slow down the tests (besides, it is the only way to do it really)
  2. Yes, removing activationCommands can slow down the editor

Basically, packages shouldn’t load anything before it is needed. activationCommands is a simple way to do that. There are other advanced ways too … but they’re not necessarily any better.


#5

Ok, I’ve got it. Thanks again for your helpful responses!