Do you have questions ? We got the answers!

Ask a question:

0
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test. while using grunt-loop-mocha

Open 1 Answers 44 Views

I am using grunt-loop-mocha to execute tests for selenium webdriver. I am getting below exception:

  1) [email protected]@@@_Wrapper-Final "before all" hook:
     Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
      at Timeout.<anonymous> (C:\Users\@@@@\Documents\oa-automation-suite\oa
-automation-suite\node_modules\mocha\lib\runnable.js:226:19)

Given below is my grunt file:


module.exports = function(grunt) {
  grunt.initConfig({
        loopmocha: {
            src: ["./tests/**/*-specs.js"],
            options: {
                mocha: {
                    reporter : 'spec'
                },
                iterations: [
                    {
                        "description": "Executing tests on Chrome",
                        "DESIRED": '{"browserName": "chrome","os":"Windows","os_version":"7","browser_version":"54"}'
                    },
                    {
                        "description": "Executing tests on Firefox",
                        "DESIRED": '{"browserName": "firefox","os":"Windows","os_version":"7","browser_version":"54"}'
                    }
                ]
            }
        }
    });
    grunt.loadNpmTasks('grunt-loop-mocha');
	grunt.registerTask('test', 'loopmocha');
};

 

1 Answer

0

You need to define timeout time for mocha:

                options: {
                    mocha: {
                        reporter : 'spec',
                        timeout : 30000
                    },

It should resolve your issue.

If you  do not want to specify  timeout time in your grunt file, you can even pass argument with your command as

grunt test --timeout <timeout_time_here>

e.g.

grunt test --timeout 3000

 

answered Jul 15 by stbadmin (4,970 points)

Top Contributors

  • 4970 pointsstbadmin

    34 questions 454 answers218 comments

  • 430 pointsSunilBhaskar

    40 questions 14 answers26 comments

  • 425 pointsMehedi

    36 questions 3 answers14 comments

  • 354 pointsSoft Tester

    43 questions 0 answers4 comments

  • 342 pointssumitkumarwatts

    0 questions 12 answers0 comments

  • 327 pointsKeeshaGolden

    0 questions 17 answers2 comments

  • 322 pointsVipul Sharma

    44 questions 0 answers24 comments

  • 310 pointsvysh.sharma

    25 questions 0 answers0 comments

  • 267 pointsOnkar_Nimje

    33 questions 15 answers15 comments

  • 258 pointsVanitha

    26 questions 0 answers6 comments

...