3

I am trying to get test code coverage reports using Istanbul. However, I keep getting the error:

Error: cannot resolve path (or pattern) 'test'

Steps to reproduce:

1) install istanbul

sudo npm install istanbul -g

2) Change directory into the folder with my tests

3) Run istanbul cover _mocha

That gives me the output:

No coverage information was collected, exit without writing coverage information
/usr/local/lib/node_modules/mocha/lib/utils.js:634
        throw new Error("cannot resolve path (or pattern) '" + path + "'");
        ^

Error: cannot resolve path (or pattern) 'test'
    at Object.lookupFiles (/usr/local/lib/node_modules/mocha/lib/utils.js:634:15)
    at /usr/local/lib/node_modules/mocha/bin/_mocha:327:30
    at Array.forEach (native)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:326:6)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Object.Module._extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/istanbul/lib/hook.js:109:37)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at runFn (/usr/local/lib/node_modules/istanbul/lib/command/common/run-with-cover.js:122:16)
    at /usr/local/lib/node_modules/istanbul/lib/command/common/run-with-cover.js:251:17
    at /usr/local/lib/node_modules/istanbul/lib/util/file-matcher.js:68:16
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:52:16
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:361:13
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:52:16
    at done (/usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:246:17)
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:44:16
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:358:17
    at LOOP (fs.js:1534:14)
    at doNTCallback0 (node.js:419:9)
    at process._tickCallback (node.js:348:13)

Does anyone know what might be wrong?

Thanks in advance!

Trung Tran
  • 13,141
  • 42
  • 113
  • 200

0 Answers0