How to pass in arguments to mutant-rspec?

152 views Asked by At

I'm trying to use the mutant-rspec library on a project that has the following directory structure

app
  backend
    spec
      someclass_spec.rb
    src
      someclass.rb
  frontend

I want to see how good my test coverage is on someclass_spec.rb, but can't seem to figure out what to pass in. I am fairly certain (based on reading, that i need the --include src, but I can't figure out for the life of me what goes into the --require argument.

From the backend folder, I've tried ...

bundle exec mutant --use rspec
bundle exec mutant --include src --use rspec 
bundle exec mutant --include src --require someclass --use rspec
bundle exec mutant --include src --require src/someclass --use rspec
bundle exec mutant --include src --require src/someclass.rb --use rspec
bundle exec mutant --include src --require someclass.rb --use rspec
bundle exec mutant --include src --require Someclass --use rspec

But I never manage to get any active subjects

Active subjects: 0
Mutant configuration:
Matcher:         #<Mutant::Matcher::Config empty>
Integration:     Mutant::Integration::Rspec
Jobs:            4
Includes:        []
Requires:        []
Subjects:        0
Mutations:       0
Results:         0
Kills:           0
Alive:           0
Runtime:         0.06s
Killtime:        0.00s
Overhead:        Inf%
Mutations/s:     0.00
Coverage:        100.00%

What can I pass into the flags to get it to run on my someclass.rb file? The docs unfortunately don't seem super clear on this front.

1

There are 1 answers

0
Pawel Pacana On BEST ANSWER

From what I see above in Matcher: #<Mutant::Matcher::Config empty> you might be missing mutation subject as a last argument. Provided your subject is Someclass, that would be:

bundle exec mutant --include src --require someclass --use rspec Someclass