
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
RspecWatchdog is a gem designed to track the performance and reliability of your RSpec tests. It provides useful metrics like execution times, test failures, and flaky tests. With seamless integration into your existing RSpec setup, you can monitor test performance and diagnose flaky tests, improving both test suite efficiency and reliability.
Testing is a crucial part of the development process, but it can be challenging to track and maintain an efficient test suite. RspecWatchdog offers a simple way to monitor test performance, identify slow tests, and spot flaky tests—helping you improve test reliability and speed. By integrating with rspec-rebound, this gem gives you insights into tests that frequently fail, allowing you to address instability in your suite.
Add rspec_watchdog to your Gemfile:
gem 'rspec-watchdog'
Then, run:
bundle install
Configure rspec_watchdog in your spec_helper.rb or rails_helper.rb.
In your spec/spec_helper.rb, add the following:
require "rspec/watchdog"
Rspec::Watchdog.configure do |config|
config.show_logs = true
# Set these only if using the dashboard integration
# config.watchdog_api_url = "http://your-app.com/watchdog/analytics"
# config.watchdog_api_token = "your_secret_token"
end
RSpec.configure do |config|
config.add_formatter(:progress)
config.add_formatter(SlowSpecFormatter)
# To enable flaky test detection, add the following:
config.flaky_spec_detection = true
config.flaky_test_callback = proc do |example|
example.metadata[:flaky] = true
end
end
show_logs
When set to true
, this option enables additional logging for RSpec tests:
watchdog_api_url
(Optional)This is the endpoint where test execution data will be sent after each RSpec test finishes:
watchdog_api_token
(Optional)This token is used to validate that the request being sent to the API is legitimate:
After installation, RspecWatchdog automatically hooks into your RSpec test suite. You can start tracking your tests immediately without any additional configuration.
Simply run your tests as usual with RSpec:
bundle exec rspec
RspecWatchdog will capture metrics about your test runs and display them according to your configuration.
RspecWatchdog will output information about your test runs directly to the console:
SlowTest: "MyClass#method_1" - 2.31 seconds
SlowTest: "MyClass#method_2" - 1.45 seconds
...
For a more comprehensive visualization of your test metrics, RspecWatchdog can send data to Watchdog::Dashboard, a separate Rails engine that provides a visual interface.
To use this integration:
RspecWatchdog.configure do |config|
config.show_logs = true
config.watchdog_api_url = "http://localhost:3000/watchdog/analytics"
config.watchdog_api_token = "your_secret_token" # Must match the dashboard token
end
RspecWatchdog integrates with rspec-rebound(see the rspec-rebound README) to track flaky tests. By enabling both gems in your project, you can easily spot tests that fail inconsistently, making it easier to identify root causes and improve the stability of your test suite.
We welcome contributions to RspecWatchdog! If you have ideas, suggestions, or find a bug, please open an issue or submit a pull request on GitHub.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that rspec-watchdog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.