I was getting the error Testing script failed with code: 1. when attempting to create the reference images with npm run reference. I'm on a win32 platform and finally figured out the real issue by adding the following code to the test.js file.
casperChild.stderr.on('data', function (data){ console.log("CasperJS:" + data.toString()); });
Turns out that CasperJS requires Python.exe to be on the machine. Once I loaded that dependency everything worked great.