Skip to content

Instantly share code, notes, and snippets.

@urbanautomaton
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urbanautomaton/089df056dbe0b5575200 to your computer and use it in GitHub Desktop.
Save urbanautomaton/089df056dbe0b5575200 to your computer and use it in GitHub Desktop.
RSpec recursive bisect formatter
$ rspec blah_spec.rb --order defined --bisect
Bisect started using options: "blah_spec.rb --order defined"
Running suite to find failures... (0.51091 seconds)
Starting bisect with 1 failing example and 19 non-failing examples.
Checking that failures are order-dependent... failure is order-dependent
Bisecting over non-failing examples 1-19 ..
Bisecting over non-failing examples 1-10 ..
Bisecting over non-failing examples 1-5 .. ignoring examples 4-5
Bisecting over non-failing examples 1-3 .. ignoring example 3
Bisecting over non-failing examples 1-2 .. ignoring example 2
Bisecting over non-failing examples 6-10 .. ignoring examples 9-10
Bisecting over non-failing examples 6-8 . ignoring examples 6-7
Bisecting over non-failing examples 11-19 ..
Bisecting over non-failing examples 11-15 ..
Bisecting over non-failing examples 11-13 . ignoring examples 11-12
Bisecting over non-failing examples 14-15 . ignoring example 14
Bisecting over non-failing examples 16-19 ..
Bisecting over non-failing examples 16-17 . ignoring example 16
Bisecting over non-failing examples 18-19 . ignoring example 18
Bisect complete! Reduced necessary non-failing examples from 19 to 6 in 12.13 seconds.
The minimal reproduction command is:
rspec ./blah_spec.rb[1:1,1:8,1:13,1:15,1:17,1:19,1:20] --order defined
RSpec.describe "order stuff" do
module Thing
class << self
attr_writer :thing
def thing
@thing ||= 0
end
end
end
it("increments the thing") { Thing.thing += 1 }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("increments the thing") { Thing.thing += 1 }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("increments the thing") { Thing.thing += 1 }
it("does nothing") { }
it("increments the thing") { Thing.thing += 1 }
it("does nothing") { }
it("increments the thing") { Thing.thing += 1 }
it("does nothing") { }
it("increments the thing") { Thing.thing += 1 }
it("doesn't expect six") { expect(Thing.thing < 6).to be_truthy }
end
$ rspec norm_spec.rb --order defined --bisect
Bisect started using options: "norm_spec.rb --order defined"
Running suite to find failures... (0.52203 seconds)
Starting bisect with 1 failing example and 13 non-failing examples.
Checking that failures are order-dependent... failure is order-dependent
Bisecting over non-failing examples 1-13 .. ignoring examples 8-13
Bisecting over non-failing examples 1-7 . ignoring examples 1-4
Bisecting over non-failing examples 5-7 .. ignoring example 7
Bisecting over non-failing examples 5-6 . ignoring example 5
Bisect complete! Reduced necessary non-failing examples from 13 to 1 in 3.63 seconds.
The minimal reproduction command is:
rspec ./norm_spec.rb[1:6,1:14] --order defined
$ rspec norm_spec.rb --order defined --bisect=verbose
Bisect started using options: "norm_spec.rb --order defined"
Running suite to find failures... (0.53207 seconds)
- Failing examples (1):
- ./norm_spec.rb[1:14]
- Non-failing examples (13):
- ./norm_spec.rb[1:1,1:2,1:3,1:4,1:5,1:6,1:7,1:8,1:9,1:10,1:11,1:12,1:13]
Checking that failures are order-dependent..
- Running: rspec ./norm_spec.rb[1:14] --order defined (0.5044 seconds) failure is order-dependent
Bisecting over non-failing examples 1-13
- Running: rspec ./norm_spec.rb[1:8,1:9,1:10,1:11,1:12,1:13,1:14] --order defined (0.50778 seconds)
- Running: rspec ./norm_spec.rb[1:1,1:2,1:3,1:4,1:5,1:6,1:7,1:14] --order defined (0.51631 seconds)
- Examples we can safely ignore (6):
- ./norm_spec.rb[1:8,1:9,1:10,1:11,1:12,1:13]
- Remaining non-failing examples (7):
- ./norm_spec.rb[1:1,1:2,1:3,1:4,1:5,1:6,1:7]
Bisecting over non-failing examples 1-7
- Running: rspec ./norm_spec.rb[1:5,1:6,1:7,1:14] --order defined (0.51806 seconds)
- Examples we can safely ignore (4):
- ./norm_spec.rb[1:1,1:2,1:3,1:4]
- Remaining non-failing examples (3):
- ./norm_spec.rb[1:5,1:6,1:7]
Bisecting over non-failing examples 5-7
- Running: rspec ./norm_spec.rb[1:7,1:14] --order defined (0.50091 seconds)
- Running: rspec ./norm_spec.rb[1:5,1:6,1:14] --order defined (0.51466 seconds)
- Examples we can safely ignore (1):
- ./norm_spec.rb[1:7]
- Remaining non-failing examples (2):
- ./norm_spec.rb[1:5,1:6]
Bisecting over non-failing examples 5-6
- Running: rspec ./norm_spec.rb[1:6,1:14] --order defined (0.51604 seconds)
- Examples we can safely ignore (1):
- ./norm_spec.rb[1:5]
- Remaining non-failing examples (1):
- ./norm_spec.rb[1:6]
Bisect complete! Reduced necessary non-failing examples from 13 to 1 in 3.58 seconds.
The minimal reproduction command is:
rspec ./norm_spec.rb[1:6,1:14] --order defined
RSpec.describe "simple order stuff" do
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("messes with the env") { ENV["thing"] = "hello" }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("does nothing") { }
it("doesn't expect things") { expect(ENV["thing"]).to be_nil }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment