gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Istanbul file permission problem: coverage/lcov-report cannot be created #852

Open ORESoftware opened 6 years ago

ORESoftware commented 6 years ago

i see this:

/Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/node_modules/mkdirp/index.js:90
                    throw err0;
                    ^

Error: EACCES: permission denied, mkdir '/Users/alexamil/WebstormProjects/oresoftware/poolio/coverage/lcov-report'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:923:18)
    at Function.sync (/Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/node_modules/mkdirp/index.js:71:13)
    at FileWriter.copyFile (/Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/lib/util/file-writer.js:143:16)
    at /Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/lib/report/html.js:552:32
    at Array.forEach (native)
    at copyAssets (/Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/lib/report/html.js:543:40)
    at /Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/lib/report/html.js:562:13
    at Array.forEach (native)
    at HtmlReport.writeReport (/Users/alexamil/.nvm/versions/node/v6.10.2/lib/node_modules/istanbul/lib/report/html.js:561:26)
 [suman] Error: Test coverage process exitted with non-zero exit code => "1". 

it looks like Istanbul creates the coverage directory but it doesn't have the right permissions, so then it fails to be able to write the lcov-report directory out.

ORESoftware commented 6 years ago

Even if I create the coverage directory myself and then do

mkdir coverage
chmod -R 777 coverage

and then run Istanbul, Istanbul will experience the above error, and then the coverage directory will have the wrong permissions again. Damn.

ORESoftware commented 6 years ago

should I just use the nyc executable instead?