simplecov-ruby/simplecov-html

Fails with `Errno::EACCES: Permission denied @ rb_sysopen` if vendor files are read-only

Closed this issue · 1 comments

h3xx commented

I think this issue stems from the fact this library does not clear out the coverage directory before it runs. If it simply removed the coverage directory before starting, it should fix this error.

Related issue: #134 -- when this one is fixed, that one will also likely be fixed.

Steps to repro:

rails new --skip-bootsnap temp
cd temp
bundle config set --local path 'vendor'
bundle add simplecov
printf 'require "simplecov"\nSimpleCov.start "rails"\n' >>test/test_helper.rb
chmod -R a-w vendor
bin/rails test
# Run tests again to produce the error
bin/rails test

The second rails test fails with the following error message:

Running 0 tests in a single process (parallelization threshold is 50)
Run options: --seed 46566

# Running:

Formatter SimpleCov::Formatter::HTMLFormatter failed with Errno::EACCES: Permission denied @ rb_sysopen - /tmp/ndz.eFIwFv/temp/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png (/home/h3xx/.rbenv/versions/3.3.0/lib/ruby/3.3.0/fileutils.rb:2279:in `initialize')

Version info

  • Ruby version: 3.3.0
  • Rails version: 7.1.3.2