casper.js 638 B

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