Klas Mellbourn
Klas Mellbourn

Reputation: 44377

Grunt concurrent task outputting nothing

I want my Grunt based setup to run both "test" (i.e. the unit tests) and "server" (i.e. the web server) at the same time, so that I can just do grunt testAndServer to run both (and update both when any file is changed) in the same terminal.

Code (much of it is based on the yo angular scaffold):

// in initConfig:
concurrent: {
  testAndWebServer: [
    'karma',
    'watch'
  ]
},

and later

grunt.registerTask('testAndServer', function (target) {
  if (target === 'dist') {
    return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
  }

  grunt.task.run([
    'clean:server',
    'concurrent:server',
    'autoprefixer',
    'compass',
    'connect:livereload',
    'open',
    'concurrent:testAndWebServer'
  ]);
});

This actually works, but I don't get any output in the terminal (PowerShell) window. I would like the karma task to show the results of the tests. How can I acheive that?

I am running Node.js v0.10.20 on Windows 7, on a quadcore machine.

Upvotes: 4

Views: 1206

Answers (1)

Klas Mellbourn
Klas Mellbourn

Reputation: 44377

I just realized that I missed the logConcurrentOutput option.

This makes it work:

  testAndWebServer: {
    tasks: ['watch', 'karma'],
    options: { logConcurrentOutput: true }
  },

Upvotes: 6

Related Questions