Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Can I generate a list of tests that need to be performed? #139

Open
jeffsaremi opened this issue Mar 26, 2023 · 1 comment
Open

Comments

@jeffsaremi
Copy link

I don't want to run the actual tests using bundle exec crystalball
And where the tests are running, there is not git sandbox
Instead I'd like to run a command like bundle exec crystalball predict and then get a list of source files or rspec tests that need can be used to run bundle exec rspec ...

Is this possible currently?

@SamMolokanov
Copy link

@jeffsaremi

Hello there, one of the possible ways is to define your own runner class which will just send the prediction back to output and then exit. Here is some code:

# custom_runner.rb

class CustomRunner < ::Crystalball::RSpec::Runner

  class << self

    def run(args, err = $stderr, out = $stdout)
      return config["runner_class"].run(args, err, out) unless config["runner_class"] == self

      out.puts(build_prediction)
    end

  end

end

and then use this runner via config:

# crystalball.yml

requires:
  - './custom_runner.rb'

# Custom RSpec runner class to use. Default: 'Crystalball::RSpec::Runner'
runner_class_name: 'CustomRunner'

.....

or (if some flexibility needed) via ENV var:

$ CRYSTALBALL_RUNNER_CLASS_NAME=CustomRunner bundle exec crystalball

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants