serpapi / turbo_tests

Run RSpec tests on multiple cores. Like parallel_tests but with incremental summarized output. Originally extracted from the Discourse and Rubygems source code.
https://rubygems.org/gems/turbo_tests
MIT License
172 stars 26 forks source link

Documentation formatter is missing nesting/context lines #3

Closed swrobel closed 3 years ago

swrobel commented 3 years ago

Interestingly, I had to run the entire spec/models folder because running a single file didn't work, unlike using parallel_tests directly.

$ rake parallel:spec['spec/models/user_spec']
Using recorded test runtime
1 processes for 1 specs, ~ 1 specs per process

Randomized with seed 3971

User
  #max_pending_project_status
    is nil with no projects
    when a freelancer with projects
      is farthest pending status
      is pending even with projects in a non-pending status
  #local_time
    handles a user without a time_zone
    handles a user with a time_zone
  defaults
    sets a random password when provided value is nil
    does not override a provided password
    sets a random password when provided value is blank
  .invite
    does not send invitation email

Finished in 4.9 seconds (files took 11.38 seconds to load)
9 examples, 0 failures
$ be turbo_tests spec/models/user_spec.rb -f d
Using recorded test runtime
Using recorded test runtime
1 processes for 1 specs, ~ 1 specs per process

Finished in 12.11 seconds (files took 0 seconds to load)
0 examples, 0 failures
$ be turbo_tests spec/models/ -n 2 -f d
2 processes for 10 specs, ~ 5 specs per process
does not send invitation email
handles a user with a time_zone
handles a user without a time_zone
is nil with no projects
is farthest pending status
is pending even with projects in a non-pending status
sets a random password when provided value is nil
sets a random password when provided value is blank
does not override a provided password
<snipped output from other files>

Finished in 27.3 seconds (files took 0 seconds to load)
28 examples, 0 failures
ilyazub commented 3 years ago

@swrobel Thanks for the bug report! I'll fix it in the next month.

ilyazub commented 3 years ago

@swrobel Can you share a minimal reproducible example? It works on a single file in a project I'm working on.

$ bundle exec turbo_tests -f d spec/search/google_jobs/job_id_spec.rb
1 processes for 1 specs, ~ 1 specs per process
has htidocid extracted
is extracted

Finished in 5.08 seconds (files took 0 seconds to load)
2 examples, 0 failures

Duplicated Using recorded test runtime is the other bug.

swrobel commented 3 years ago
RSpec.describe "Top-level context" do
  describe "#instance_method" do
    it "does what it's supposed to" do
      expect(true).to be_truthy
    end

    it "doesn't do what it isn't supposed to" do
      expect(false).not_to be_truthy
    end
  end
end

Example runs:

$ rspec spec/test_spec.rb --format documentation

Randomized with seed 55944

Top-level context
  #instance_method
    does what it's supposed to
    doesn't do what it isn't supposed to

Finished in 0.00685 seconds (files took 0.27799 seconds to load)
2 examples, 0 failures

Randomized with seed 55944

$ bundle exec turbo_tests spec/test_spec.rb -f d
1 processes for 1 specs, ~ 1 specs per process
does what it's supposed to
doesn't do what it isn't supposed to

Finished in 0.83558 seconds (files took 0 seconds to load)
2 examples, 0 failures
ilyazub commented 3 years ago
$ bundle exec turbo_tests spec/test_spec.rb -f d
1 processes for 1 specs, ~ 1 specs per process
does what it's supposed to
doesn't do what it isn't supposed to

Finished in 0.83558 seconds (files took 0 seconds to load)
2 examples, 0 failures

@swrobel So it works with the single spec file or do I miss something?

swrobel commented 3 years ago

Please note the difference in output between the two runs. These context lines are missing:

Top-level context
  #instance_method
ilyazub commented 3 years ago

Please note the difference in output between the two runs. These context lines are missing:

Top-level context
  #instance_method

Thanks, I've missed that. I'll take a look and try to fix it.

smileart commented 3 years ago

@ilyazub @swrobel it seems this one might be closed now cause of https://github.com/serpapi/turbo_tests/pull/7

ilyazub commented 3 years ago

@ilyazub @swrobel it seems this one might be closed now cause of #7

Yes, this should be fixed now.