javascriptangularjstestingplato

Plato software error


I am getting this error while using plato for one of my project to find maintainability index for angular.js application:

plato -r -d report "angular" angular-master
C:\Users\pritesh\AppData\Roaming\npm\node_modules\plato\lib\util.js:15
  var lastSlash = files[0].lastIndexOf(path.sep);
                          ^

TypeError: Cannot read property 'lastIndexOf' of undefined
    at Object.exports.findCommonBase (C:\Users\pritesh\AppData\Roaming\npm\node_modules\plato\lib\util.js:15:27)
    at Object.exports.inspect (C:\Users\pritesh\AppData\Roaming\npm\node_modules\plato\lib\plato.js:86:29)
    at Object.exports.exec (C:\Users\pritesh\AppData\Roaming\npm\node_modules\plato\lib\cli.js:53:9)
    at Object. (C:\Users\pritesh\AppData\Roaming\npm\node_modules\plato\bin\plato:19:5)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)

Solution

  • You did not specify the target files correctly. I don't know your project structure so it is hard to say, but try

    plato -r -d report -t "angular" angular-master/*.js
    

    The documentation is requesting input files, not a directory, so you have to use a pattern.