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

Feature request: rake/capistrano-like -T option #1022

Closed
schnittchen opened this issue Jul 26, 2013 · 8 comments
Closed

Feature request: rake/capistrano-like -T option #1022

schnittchen opened this issue Jul 26, 2013 · 8 comments

Comments

@schnittchen
Copy link
Contributor

@schnittchen schnittchen commented Jul 26, 2013

This option would not exercise the examples, just run the formatters. It would allow me to "query" the entire suite for things like "is there an example with focus: true" without resorting to ugly grep hacks.

If this sounds interesting, I'd try to give it a shot...

@myronmarston
Copy link
Member

@myronmarston myronmarston commented Jul 26, 2013

Would '--dry-run' make more sense as an the option?

On Jul 26, 2013, at 8:20 AM, Schnittchen notifications@github.com wrote:

This option would not exercise the examples, just run the formatters. It would allow me to "query" the entire suite for things like "is there an example with focus: true" without resorting to ugly grep hacks.

If this sounds interesting, I'd try to give it a shot...


Reply to this email directly or view it on GitHub.

@schnittchen
Copy link
Contributor Author

@schnittchen schnittchen commented Jul 26, 2013

Thinking out loudly... --dry-run works on a lower semantical level, it implies "do everything except touching the real code (hooks + example meat code)". I want "give me what you know about the suite at the meta level", which is a higher level use case, and can be implemented using --dry-run together with a formatter that produces well parsable output (btw do Formatters have access to metadata? That would be important).

If you see any additional benefit in --dry-run beyond my use case, I would start with that.

@myronmarston
Copy link
Member

@myronmarston myronmarston commented Jul 26, 2013

The main reason I was thinking of --dry-run is that to me the output is orthogonal to the idea of "don't actually run anything", and it seems more flexible to allow folks to choose how the output for this feature is formatted using the formatter API, rather than imposing only one output format with -T and/or providing an alternate formatter API. Also, to me, the meaning of -T in capistrano and rake is "list all the tasks I can run", which doesn't really make sense for RSpec.

I want "give me what you know about the suite at the meta level"

Can you give me an idea of what output you want? I'm not totally sure what you are looking for...

@schnittchen
Copy link
Contributor Author

@schnittchen schnittchen commented Jul 26, 2013

Yes, orthogonality is the word I was searching for :)

Here's an oversimplified example with JSON as output, though the choice of formatting language is secondary.

describe "foo" do
  it "bar", focus: true do
    ...
  end
end

would produce something like

[
  {
    type: "group",
    name: "foo",
    children: [
      {
        type: "example",
        name: "bar",
        metadata: {
          focus: true
        }
      }
    ]
  }
]
@schnittchen
Copy link
Contributor Author

@schnittchen schnittchen commented Jul 27, 2013

I just found the JsonFormatter (horray for plain data!), but that wouldn't help with my problem. With --dry-run, I could do

rspec --dry-run -f progress | grep 'ignoring {:focus=>true}' || exit 1

in my CI run, that's a little ugly but does the job.

I will look into implementing a --dry-run option.

@alindeman
Copy link
Contributor

@alindeman alindeman commented Aug 13, 2013

Looks good to me.

@myronmarston
Copy link
Member

@myronmarston myronmarston commented Aug 22, 2013

Closing now that we have --dry-run.

@schnittchen
Copy link
Contributor Author

@schnittchen schnittchen commented Aug 22, 2013

Thank you!

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.