How do you determine if your code is running under `apm test`?


#1

There appears to be an API (AtomWindow::isSpecWindow()) that would tell me. It is one of the few places where options.test appears to be stored from atom-applications.coffee. Unfortunately, I can’t figure out how to get access to AtomWindow.

I don’t see any information about a better way to determine this on https://atom.io/docs/v0.186.0/writing-specs.


#2

You can call atom.inSpecMode().

Though it doesn’t have the answer you’re looking for, the latest version of the documentation you linked to is here:

https://atom.io/docs/latest/hacking-atom-writing-specs