Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
419 views
by Expert (572 points)

I am getting below error while executing mocha tests through Grunt

My grunt file:

// Gruntfile.js
module.exports = function(grunt){
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    // Mocha
    mocha: {
      all: {
        src: ['./tests/**/*-specs.js'],
      },
      options: {
        run: true
      }
    }
  });

  // Load grunt mocha task
  grunt.loadNpmTasks('mocha');

  grunt.registerTask('default', ['mocha']);
};


When I run command grunt, I get below exception:

>> Local Npm module "mocha" not found. Is it installed?
Warning: Task "mocha" not found. Use --force to continue.

Aborted due to warnings.

 

1 Answer

1 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer
You need to install grunt-mocha module:

 

npm install grunt-mocha --save-dev
by Expert (572 points)
That worked!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...