Skip to content

Instantly share code, notes, and snippets.

@gurdiga
Created October 8, 2013 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gurdiga/6882900 to your computer and use it in GitHub Desktop.
Save gurdiga/6882900 to your computer and use it in GitHub Desktop.
Grunt task to run jasmine-node without PhantomJS when you don’t need it.

Grunt task to run jasmine-node without PhantomJS

I’m working on a project where I write a webservice on Node.js and I find that grunt-contrib-jasmine is a bit slow to start. I couldn’t find amy module on npm that would do that, so I wrote my own task:

grunt.registerTask('jasmine', [], function() {
  var exec = require('child_process').exec,
      done = this.async();

  var child = exec('jasmine-node --matchall test', function(error, stdout, stderr) {
    if (error) grunt.warn(error);

    done();
  });

  child.stdout.on('data', function (data) {
    process.stdout.write(data);
  });

  child.stderr.on('data', function (data) {
    process.stdout.write(data);
  });

});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment