Skip to content

Commit

Permalink
Merge dry-run into mode
Browse files Browse the repository at this point in the history
  • Loading branch information
icy-arctic-fox committed Aug 27, 2024
1 parent 671d857 commit b2d6463
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/spectator/core/cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module Spectator::Core
end

parser.on("--dry-run", "Pass all tests without execution") do
configuration.dry_run = true
configuration.mode = :dry_run
end
end
end
Expand Down
9 changes: 4 additions & 5 deletions src/spectator/core/runner.cr
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module Spectator::Core
skip_message = skip_tag_value.to_s unless skip_tag_value.is_a?(Bool)
error = ExampleSkipped.new(skip_message, example.location)
Result.new(:skip, Time::Span.zero, error)
elsif @configuration.dry_run?
elsif @configuration.mode.dry_run?
Result.new(:pass, Time::Span.zero)
else
example.run
Expand Down Expand Up @@ -130,6 +130,9 @@ module Spectator::Core
# Run all examples and report results.
Normal

# Report all examples as passed without running them.
DryRun

# Produce a list of tags used in the examples without running them.
ListTags
end
Expand All @@ -138,10 +141,6 @@ module Spectator::Core
# The default is to run all examples and report results.
Spectator.config_property mode = Mode::Normal

# When true, examples will not be run, but act as if they did.
# All examples will be reported as passed.
Spectator.config_property? dry_run = false

# Specifies that the application should exit after the number of failures.
Spectator.config_numeric_property fail_fast = 0, truthy: 1

Expand Down

0 comments on commit b2d6463

Please sign in to comment.