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

0 like 0 dislike
405 views
by The go-to Tester (222 points)

I have setup grunt-loop-mocha. I am getting below error while executing tests:

 

Reading C:\Users\@@@@\Documents\oa-automation-suite\oa-automation-suite\node
_modules\grunt-loop-mocha\package.json...OK
Parsing C:\Users\@@@@\Documents\oa-automation-suite\oa-automation-suite\node
_modules\grunt-loop-mocha\package.json...OK
Loading "loop-mocha.js" tasks...OK
+ loopmocha
Loading "process-loop.js" tasks...OK
>> No tasks were registered or unregistered.
Loading "Gruntfile.js" tasks...OK
+ test

Running tasks: test

Running "test" task

Running "loopmocha" task

Running "loopmocha:src" (loopmocha) task
Verifying property loopmocha.src exists in config...OK
Files: ./test/0001_Int_@@@@_Wrapper-specs.js -> src
Options: mocha={"reporter":"spec","timeout_ms":30000,"ignoreLeaks":false,"logErr
ors":true,"fullTrace":true,"bail":true,"grep":".*"}, iterations=[{"description":
"Executing tests on Chrome","DESIRED":"{\"browserName\": \"chrome\"}"}]
adding key DESIRED value {"browserName": "chrome"}
[grunt-loop-mocha] setting ENV var  DESIRED with value {"browserName": "chrome"}

loopOptions {}
[grunt-loop-mocha] iteration:  1500093389564-Executing tests on Chrome
[grunt-loop-mocha] mocha argv:  --reporter,spec,--timeout_ms,30000,--ignoreLeaks
,--logErrors,true,--fullTrace,true,--bail,true,--grep,.*,./test/0001_Int_@@@@_W
rapper-specs.js
C:\Users\@@@@\Documents\oa-automation-suite\oa-automation-suite\node_modules
\mocha\lib\utils.js:634
        throw new Error("cannot resolve path (or pattern) '" + path + "'");
        ^

Error: cannot resolve path (or pattern) 'true'
    at Object.lookupFiles (C:\Users\@@@@\Documents\oa-automation-suite\oa-au
tomation-suite\node_modules\mocha\lib\utils.js:634:15)
    at C:\Users\@@@@\Documents\oa-automation-suite\oa-automation-suite\node_
modules\mocha\bin\_mocha:327:30
    at Array.forEach (native)
    at Object.<anonymous> (C:\Users\@@@@\Documents\oa-automation-suite\oa-au
tomation-suite\node_modules\mocha\bin\_mocha:326:6)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:504:3
[grunt-loop-mocha] Total Runtime 0s
Warning: [grunt-loop-mocha] error, please check erroneous iteration(s):
{
    "1500093389564-Executing tests on Chrome": 1
}
 Use --force to continue.

Aborted due to warnings.

C:\Users\@@@@\Documents\oa-automation-suite\oa-automation-suite>

Here is my grunt file content:

module.exports = function(grunt) {

    grunt.initConfig({
        loopmocha: {
            src: ["./test/*-specs.js"],
            options: {
                mocha: {
                    reporter : 'spec',
                    timeout_ms : 30000,
                    ignoreLeaks : false,
                    logErrors : true,
                    fullTrace : true,
                    bail : true,
                    grep : ".*"
                },
                //loop: {
                //    reportLocation: "test/report"
                //},
                iterations: [
                    {
                        "description": "Executing tests on Chrome",
                        "DESIRED": '{"browserName": "chrome"}'
                    }
                ]
            }
        }
    });
    grunt.loadNpmTasks('grunt-loop-mocha');
	grunt.registerTask('test', 'loopmocha');
	
};

 

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

It looks like loopmocha does not have below mocha options.

Removing below options did the trick.

ignoreLeaks : false,
logErrors : true,
fullTrace : true,
bail : true,
grep : ".*"


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

...