Running tests using mocha and requiring atom?


#1

Is there a way to write our specs using mocha? What I am missing is a way to require 'atom' properly.

Any ideas?


#2

I don’t know of one, but you may want to look at spec-suite.coffee and spec-helper.coffee for info on the infrastructure used to create a headless Atom environment for the Jasmine specs.


Run electron apps on Linux VPS
#3

I still can’t find where the global variable atom came from in these files, it just appear out of thin air.


#4

https://github.com/atom/atom/blob/master/spec/spec-bootstrap.coffee#L9


#5

Thanks!

Atom = require '../src/atom'
window.atom = Atom.loadOrCreate('spec')

Now I need to get hold of the Atom class. I’ve attempted to require the whole Atom project, but then I got a bunch of build errors, not sure if this is the right thing to do.

  "devDependencies": {
    "atom": "atom/atom"
  }

But then I found this thread

They spawned a headless Electron child process to run some tests, and even created a test-framework to do this. Can I do the same thing to Atom?