mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix for default logger being cleaned up before Spectator runs
Resolves https://github.com/icy-arctic-fox/spectator/issues/27
This commit is contained in:
parent
55398709de
commit
edb18dcf95
1 changed files with 13 additions and 0 deletions
|
@ -98,8 +98,21 @@ module Spectator
|
||||||
config.random
|
config.random
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Trick for detecting if a constant is defined.
|
||||||
|
# Includes the block of code if the *constant* is defined.
|
||||||
|
private macro on_defined(constant)
|
||||||
|
{% if constant.resolve? %}
|
||||||
|
{{yield}}
|
||||||
|
{% end %}
|
||||||
|
end
|
||||||
|
|
||||||
# Builds the tests and runs the framework.
|
# Builds the tests and runs the framework.
|
||||||
private def run
|
private def run
|
||||||
|
# Silence default logger, only if it's used somewhere in the program.
|
||||||
|
on_defined(::Log) do
|
||||||
|
::Log.setup_from_env(default_level: :none)
|
||||||
|
end
|
||||||
|
|
||||||
# Build the test suite and run it.
|
# Build the test suite and run it.
|
||||||
suite = ::Spectator::SpecBuilder.build(config.example_filter)
|
suite = ::Spectator::SpecBuilder.build(config.example_filter)
|
||||||
Runner.new(suite, config).run
|
Runner.new(suite, config).run
|
||||||
|
|
Loading…
Reference in a new issue