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

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

Comments

Projects
None yet
3 participants
@schnittchen
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@myronmarston

myronmarston Jul 26, 2013

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@schnittchen

schnittchen Jul 26, 2013

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@myronmarston

myronmarston Jul 26, 2013

Member

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...

Member

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

This comment has been minimized.

Show comment
Hide comment
@schnittchen

schnittchen Jul 26, 2013

Contributor

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
        }
      }
    ]
  }
]
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@schnittchen

schnittchen Jul 27, 2013

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@alindeman

alindeman Aug 13, 2013

Contributor

Looks good to me.

Contributor

alindeman commented Aug 13, 2013

Looks good to me.

@myronmarston

This comment has been minimized.

Show comment
Hide comment
@myronmarston

myronmarston Aug 22, 2013

Member

Closing now that we have --dry-run.

Member

myronmarston commented Aug 22, 2013

Closing now that we have --dry-run.

@schnittchen

This comment has been minimized.

Show comment
Hide comment
@schnittchen

schnittchen Aug 22, 2013

Contributor

Thank you!

Contributor

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