casper.js 588 B

1234567891011121314151617181920212223
  1. /**
  2. * Run e2e tests with CasperJS.
  3. */
  4. module.exports = function (grunt) {
  5. grunt.registerTask( 'casper', function (id) {
  6. var path = require('path')
  7. var done = this.async()
  8. var file = id ? id + '.js' : ''
  9. grunt.util.spawn({
  10. cmd: 'casperjs',
  11. args: ['test', '--concise', './' + file],
  12. opts: {
  13. stdio: ['ignore', process.stdout, 'ignore'],
  14. cwd: path.resolve('test/e2e')
  15. }
  16. }, function (err, res) {
  17. if (err) grunt.fail.fatal(res.stdout || 'CasperJS test failed')
  18. grunt.log.writeln(res.stdout)
  19. done()
  20. })
  21. })
  22. }