diff --git a/Gemfile b/Gemfile index 042c3c757..13b824733 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,7 @@ end # For running unit tests group :test do + gem 'simplecov', '~> 0.22' gem 'test-unit-full', '~> 0.0.5' gem 'rspec', '~> 3.13' gem 'rdoc', '~> 7.1' diff --git a/Gemfile.lock b/Gemfile.lock index 29f746606..2328f58b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,6 +58,7 @@ GEM daemons (1.4.1) date (3.5.1) diff-lcs (1.6.2) + docile (1.4.1) domain_name (0.6.20240107) drb (2.2.3) em-websocket (0.5.3) @@ -224,6 +225,7 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) + simplecov_json_formatter (0.1.4) sinatra (4.2.1) logger (>= 1.6.0) mustermann (~> 3.0) @@ -335,6 +337,7 @@ DEPENDENCIES rubyzip (~> 3.2) rushover (~> 0.3.0) selenium-webdriver (~> 4.40) + simplecov (~> 0.22) sinatra (~> 4.1) slack-notifier (~> 2.4) sqlite3 (~> 2.9) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ee4416be9..0ca259328 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,6 +3,17 @@ # Browser Exploitation Framework (BeEF) - https://beefproject.com # See the file 'doc/COPYING' for copying permission # + +# Coverage must start before loading application code. +require 'simplecov' +SimpleCov.start do + add_filter '/spec/' + add_group 'Core', 'core' + add_group 'Extensions', 'extensions' + add_group 'Modules', 'modules' + track_files '{core,extensions,modules}/**/*.rb' +end + # Set external and internal character encodings to UTF-8 Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8