How do I make Phantom work on CircleCI?

I’m having some weird problems with testing a Meteor app. I use CircleCI to automate testing and the config is pretty simple:

    YARN_VERSION: 0.18.1
    PATH: "${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"

    - |
      if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
        curl -o- -L | bash -s -- --version $YARN_VERSION
    - ~/.meteor
    - ~/.yarn
    - ~/.cache/yarn
    - meteor || curl | /bin/sh
    - yarn install
    - mocha || npm install -g mocha
    - spacejam || npm install -g spacejam

    - npm run "test:ci"

I follow Mantra conventions and put all the tests into **/meteor_tests/ folders. Finally, I use spacejam and practicalmeteor:mocha:

spacejam test --once --driver-package=practicalmeteor:mocha

For some reason, it seems to only be working locally. I can see it from the output of this command: if I put a test that fails, I can see it, just as I can see when all the tests pass.

Now, the problem with CircleCI is that, looks like, it cannot install Phantom properly, as it exits with code 6:

> spacejam test --once --driver-package=practicalmeteor:mocha

spacejam: spawning meteor
[[[[[ Tests ]]]]]

=> Started proxy.
=> Meteor is available. Update this project with 'meteor update'.
=> Started MongoDB.
spacejam: meteor mongodb is ready
=> Started your app.

=> App running at: http://localhost:4096/
spacejam: meteor is ready
spacejam: spawning phantomjs
phantomjs: Running tests at http://localhost:4096/local using test-in-console
phantomjs: There is no route for the path: /local
    http://localhost:4096/packages/kadira_flow-router.js?hash=5c81da2c1311a60595a8b977d2b3c02eab0f5cde: 519
spacejam: phantomjs exited with code: 6
spacejam: killing meteor
spacejam: meteor killed with signal: SIGTERM
spacejam: Unhandled error in meteor client side code. Exiting.

I also tried dispatch:mocha as a driver, but it didn’t work even on my local machine, giving me errors and “0 tests passed (0ms)” kind of messages.

Am I missing something here? Did I miss a certain configuration or package maybe?

1 Like