Atom.project.getPath() in specs


I am trying to write some specs for (I apologise for releasing a package with no specs) and I’m hitting a brick wall around using atom.project.getPath()

It is used to set the cwd of the child_process when someone starts the server.

When I try to run my specs I get the error "TypeError: Cannot read property 'getPath' of null at /Users/arcath/.atom/packages/jekyll/lib/ which is saying to me that atom.project is null during the specs. How can I set it before running the tests?


Most Atom specs that need the path to be set to something just set it to a temp directory in the beforeEach of the outermost describe block:

Also, the whitespace package was at one point designed to be the “example for how to write package specs” package. I always refer to it first whenever I have a question for how to write specs.


Thanks I will look at that now!


Also, atom.project.getPath is deprecated, so I recommend using atom.project.getPaths instead.