tests: monkey-patch exec to get coverage reports
Closes Homebrew/homebrew#48923. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
parent
4ce99fa010
commit
115e6b49bc
@ -6,4 +6,12 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def exec(*args)
|
||||||
|
if ENV["HOMEBREW_TESTS_COVERAGE"] && ENV["HOMEBREW_INTEGRATION_TEST"]
|
||||||
|
# Ensure we get coverage results before replacing the current process.
|
||||||
|
SimpleCov.result
|
||||||
|
end
|
||||||
|
Kernel.exec(*args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,7 +28,6 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
-W0
|
-W0
|
||||||
-I#{HOMEBREW_LIBRARY_PATH}/test/lib
|
-I#{HOMEBREW_LIBRARY_PATH}/test/lib
|
||||||
-rconfig
|
-rconfig
|
||||||
-rintegration_mocks
|
|
||||||
]
|
]
|
||||||
if ENV["HOMEBREW_TESTS_COVERAGE"]
|
if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||||
# This is needed only because we currently use a patched version of
|
# This is needed only because we currently use a patched version of
|
||||||
@ -38,6 +37,7 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
cmd_args << "-rbundler/setup"
|
cmd_args << "-rbundler/setup"
|
||||||
cmd_args << "-rsimplecov"
|
cmd_args << "-rsimplecov"
|
||||||
end
|
end
|
||||||
|
cmd_args << "-rintegration_mocks"
|
||||||
cmd_args << (HOMEBREW_LIBRARY_PATH/"../brew.rb").resolved_path.to_s
|
cmd_args << (HOMEBREW_LIBRARY_PATH/"../brew.rb").resolved_path.to_s
|
||||||
cmd_args += args
|
cmd_args += args
|
||||||
Bundler.with_original_env do
|
Bundler.with_original_env do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user