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

Use doc formatter when running a single spec file #1309

Merged
merged 1 commit into from
Jan 15, 2021

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Jan 14, 2021

By default, rspec uses the "progress formatter" to output the status
of running our test suite -- this is the one that outputs a single
character for each executed test: ./F/*. This is the correct default
to avoid a deluge of text whenever we run the test suite.

But when developing some specific component, it's common that you run
rspec only for a single spec file. In that case, there's not a lot of
tests so it's nice to switch to the documentation formatter that
prints a nice looking description for each test.

So there's a nice trick that rspec itself adds to the spec_helper.rb
when you initialize it on a new project with rspec --init, which is
to switch to the documentation formatter only when there's a single
spec file to run.

I claim this gives us the best of both worlds :)

By default, rspec uses the "progress formatter" to output the status
of running our test suite -- this is the one that outputs a single
character for each executed test: ./F/*. This is the correct default
to avoid a deluge of text whenever we run the test suite.

But when developing some specific component, it's common that you run
rspec only for a single spec file. In that case, there's not a lot of
tests so it's nice to switch to the documentation formatter that
prints a nice looking description for each test.

So there's a nice trick that rspec itself adds to the `spec_helper.rb`
when you initialize it on a new project with `rspec --init`, which is
to switch to the documentation formatter only when there's a single
spec file to run.

I claim this gives us the best of both worlds :)
@ivoanjo ivoanjo requested a review from a team January 14, 2021 16:42
@codecov-io
Copy link

Codecov Report

Merging #1309 (7497a3d) into master (a770176) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1309   +/-   ##
=======================================
  Coverage   98.13%   98.13%           
=======================================
  Files         752      752           
  Lines       35783    35783           
=======================================
  Hits        35117    35117           
  Misses        666      666           
Impacted Files Coverage Δ
lib/ddtrace/ext/git.rb 100.00% <ø> (ø)
lib/ddtrace/ext/ci.rb 98.33% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf36eef...7497a3d. Read the comment docs.

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@marcotc marcotc added the dev/testing Involves testing processes (e.g. RSpec) label Jan 14, 2021
@ivoanjo ivoanjo merged commit dba4c21 into master Jan 15, 2021
@ivoanjo ivoanjo deleted the ivoanjo/nicer-rspec-output-during-development branch January 15, 2021 15:33
@github-actions github-actions bot added this to the 0.45.0 milestone Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/testing Involves testing processes (e.g. RSpec)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants