mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement dry-run mode
This commit is contained in:
parent
435f971c87
commit
ba0453c5ea
2 changed files with 15 additions and 4 deletions
|
@ -126,7 +126,7 @@ In no particular order, features that have been implemented and are planned:
|
|||
- [ ] Test filtering - by name, context, and tags
|
||||
- [X] Fail on no tests
|
||||
- [ ] Randomize test order
|
||||
- [ ] 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 file - `.spectator`
|
||||
- [ ] Reporter and formatting
|
||||
|
|
|
@ -42,9 +42,20 @@ module Spectator
|
|||
# The formatter is given the example and result information.
|
||||
private def run_example(example)
|
||||
@config.formatter.start_example(example)
|
||||
Internals::Harness.run(example).tap do |result|
|
||||
@config.formatter.end_example(result)
|
||||
end
|
||||
result = if @config.dry_run? && example.is_a?(RunnableExample)
|
||||
dry_run_result(example)
|
||||
else
|
||||
Internals::Harness.run(example)
|
||||
end
|
||||
@config.formatter.end_example(result)
|
||||
result
|
||||
end
|
||||
|
||||
# Creates a fake result for an example.
|
||||
private def dry_run_result(example)
|
||||
expectations = [] of Expectations::Expectation
|
||||
example_expectations = Expectations::ExampleExpectations.new(expectations)
|
||||
SuccessfulResult.new(example, Time::Span.zero, example_expectations)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue