mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement --order flag to match RSpec
This commit is contained in:
parent
b6453d135a
commit
7b1b65f553
2 changed files with 11 additions and 1 deletions
|
@ -125,7 +125,7 @@ In no particular order, features that have been implemented and are planned:
|
||||||
- [X] Fail fast
|
- [X] Fail fast
|
||||||
- [ ] Test filtering - by name, context, and tags
|
- [ ] Test filtering - by name, context, and tags
|
||||||
- [X] Fail on no tests
|
- [X] Fail on no tests
|
||||||
- [ ] Randomize test order
|
- [X] Randomize test order
|
||||||
- [X] Dry run - for validation and checking formatted output
|
- [X] Dry run - for validation and checking formatted output
|
||||||
- [X] Config block in `spec_helper.cr`
|
- [X] Config block in `spec_helper.cr`
|
||||||
- [X] Config file - `.spectator`
|
- [X] Config file - `.spectator`
|
||||||
|
|
|
@ -23,6 +23,16 @@ module Spectator
|
||||||
parser.on("-p", "--profile", "Display the 10 slowest specs") { raise NotImplementedError.new("-p") }
|
parser.on("-p", "--profile", "Display the 10 slowest specs") { raise NotImplementedError.new("-p") }
|
||||||
parser.on("-r", "--rand", "Randomize the execution order of tests") { builder.randomize }
|
parser.on("-r", "--rand", "Randomize the execution order of tests") { builder.randomize }
|
||||||
parser.on("--seed INTEGER", "Set the seed for the random number generator (implies -r)") { |seed| builder.randomize; builder.seed = seed.to_i }
|
parser.on("--seed INTEGER", "Set the seed for the random number generator (implies -r)") { |seed| builder.randomize; builder.seed = seed.to_i }
|
||||||
|
parser.on("--order ORDER", "Set the test execution order. ORDER should be one of: defined, rand, or rand:SEED") do |method|
|
||||||
|
case method.downcase
|
||||||
|
when "defined"
|
||||||
|
builder.randomize = false
|
||||||
|
when /^rand/
|
||||||
|
builder.randomize
|
||||||
|
parts = method.split(':', 2)
|
||||||
|
builder.seed = parts[1].to_i if parts.size > 1
|
||||||
|
end
|
||||||
|
end
|
||||||
parser.on("--location FILE:LINE", "Run the example at line 'LINE' in the file 'FILE', multiple allowed") { |location| raise NotImplementedError.new("--location") }
|
parser.on("--location FILE:LINE", "Run the example at line 'LINE' in the file 'FILE', multiple allowed") { |location| raise NotImplementedError.new("--location") }
|
||||||
parser.on("--json", "Generate JSON output") { builder.formatter = Formatting::JsonFormatter.new }
|
parser.on("--json", "Generate JSON output") { builder.formatter = Formatting::JsonFormatter.new }
|
||||||
parser.on("--junit_output OUTPUT_DIR", "Generate JUnit XML output") { |output_dir| builder.add_formatter(Formatting::JUnitFormatter.new(output_dir)) }
|
parser.on("--junit_output OUTPUT_DIR", "Generate JUnit XML output") { |output_dir| builder.add_formatter(Formatting::JUnitFormatter.new(output_dir)) }
|
||||||
|
|
Loading…
Reference in a new issue