NodeJS/Testacular on Jenkins CI

I'm using Testacular which is a Node.js test runner for Angular/Jasmine. I can run it fine from the command line, but every time I try to run it from Jenkins build steps, it bombs out with all sorts of errors regarding environment variables. I tried the Nodejs plugin for Jenkins, but that's just to run node code snippets. Anyone know of a way to have node apps (eg. Testacular) running test under Jenkins?

You will need to:

  1. have "testacular" as a dependency in your package.json file.
  2. install your dependencies with npm install (do this as a build step)
  3. call it as ./node_modules/.bin/testacular start --single-run

Assuming you have configured testacular to use PhantomJs browsers = ['PhantomJS'];, you just need to have the phantomjs binary in your path or tell testacular where it is located with an environment variable set in your shell:

export PHANTOMJS_BIN=$HOME/local/bin/phantomjs

good news!

" I tried the Nodejs plugin for Jenkins, but that's just to run node code snippets. "

nope!

install the nodejs plugin see instructions here -> NodeJS jenkins plugin broken?

then tick "Provide Node/npm bin folder to PATH" and when running a "execute shell" build task, you can use nodejs, here's a example using grui

npm update grunt grunt --force reporting