Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating test groups with grunt-mocha-test

I'm using grunt-mocha-test to run node server side tests. My Gruntfile.js looks like this

module.exports = function(grunt) {

  // Add the grunt-mocha-test tasks.
  grunt.loadNpmTasks('grunt-mocha-test');

  grunt.initConfig({
    // Configure a mochaTest task
    mochaTest: {
      test: {
        options: {
          reporter: 'dot'
        },
        src: [ 'test/setup.js', 'test/*.test.js' ]
      }
    },

  });

  grunt.registerTask('default', 'mochaTest');
};

What I want to do is this, I want to be able to run different test groups with different commands as follows

grunt will run all tests

grunt test1 runs a subset of tests in the test folder, and

grunt test2 runs another subset of tests

I don't know if this is possible, and I haven't been able to find anything about this in the documentation for grunt-mocha-test

I could sure use some help here. Thanks

like image 612
SamAko Avatar asked Mar 11 '14 16:03

SamAko


1 Answers

At the moment you have one group called test. Just add another object inside mochaTest and call grunt mochaTest:test2.

like image 60
Krasimir Avatar answered Oct 04 '22 17:10

Krasimir