rspec-watchdog 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4919c874fad5a5da7beba8c708ed31a33b25415fcb84321560eeead42b4ffc9a
4
- data.tar.gz: 4d2e0c47abd4b43eaf9e9b39dda3c555f962ef954e7d128083b6227d6d8c3ceb
3
+ metadata.gz: 3a2d7cf470c00b52f49425017a7389d2afb84f07bbcd16f582fe7a5455364a3c
4
+ data.tar.gz: 219af50dd343f4e4a0d4a19d379b541a163679c829647810a1a49578b27d79a4
5
5
  SHA512:
6
- metadata.gz: 5feabdda9b4ad87a113811da7c6803c81ec73b0e1d9c53a90e70ce31ca18552c24f40ad99d22ad5b71bd49f5bf7c3c399af1b373a5e43ad1b4a363d0e671d8ff
7
- data.tar.gz: 1318cd1bdad2f21429d19fccaa790b910651a153769725ff0b087e649447c5b9849886b0267a94490dd2ecdb8f06aa006f8150cf5d34dff5965503bf93879268
6
+ metadata.gz: d9a53957da45639d5655cbc66c61a2bb3e9b9746ed5d518a89bdc1423a4e46f15cf686a4ca100c5ecb4dd7238c3505314a4fa6314581ff1ab2ba8819d9376870
7
+ data.tar.gz: be22c22d007e291bfe749611d3dce8e76b4f7298364b4a871f0cb88638d90476906d5b455875a39c201f293f027c568f00d58bfbb71968aa0d4048bf503413a0
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## [0.1.5] - 2025-04-18
2
+ ### Added
3
+ - Added `fast_specs_threshold` to filter out unflaky fast specs
4
+
5
+
6
+ ### Fixed
7
+ - How show logs is handled
data/README.md CHANGED
@@ -47,6 +47,7 @@ Rspec::Watchdog.configure do |config|
47
47
  # Set these only if using the dashboard integration
48
48
  # config.watchdog_api_url = "http://your-app.com/watchdog/analytics"
49
49
  # config.watchdog_api_token = "your_secret_token"
50
+ # config.fast_specs_threshold = 1.0 # in seconds to filter unflaky fast specs
50
51
  end
51
52
 
52
53
  RSpec.configure do |config|
@@ -84,6 +85,11 @@ This token is used to validate that the request being sent to the API is legitim
84
85
  - If you're running tests in a CI/CD environment (e.g., GitHub Actions or CircleCI)
85
86
  - Should match the token configured in your dashboard instance
86
87
 
88
+ #### `fast_specs_threshold` (Optional)
89
+
90
+ This threshold is used to filter out unflaky fast specs.
91
+ The idea is to focus on slow and flaky specs.
92
+
87
93
  ## Usage
88
94
 
89
95
  After installation, RspecWatchdog automatically hooks into your RSpec test suite. You can start tracking your tests immediately without any additional configuration.
@@ -138,3 +144,7 @@ We welcome contributions to RspecWatchdog! If you have ideas, suggestions, or fi
138
144
  ## License
139
145
 
140
146
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
147
+
148
+ ## Credits
149
+
150
+ RspecWatchdog is maintained by [Windmotion](https://windmotion.io) with the help of our [contributors](https://github.com/windmotion-io/rspec-watchdog/graphs/contributors).
@@ -11,12 +11,13 @@ class SlowSpecFormatter
11
11
  @flaky_spec_detection = RSpec.configuration.flaky_spec_detection
12
12
  @watchdog_api_url = Rspec::Watchdog.config.watchdog_api_url
13
13
  @watchdog_api_token = Rspec::Watchdog.config.watchdog_api_token
14
+ @fast_specs_threshold = RSpec.configuration.fast_specs_threshold
14
15
  end
15
16
 
16
17
  def dump_summary(summary)
17
- return unless @show_logs
18
-
19
- puts "\nAll examples sorted by run time (most durable to fastest):"
18
+ if @show_logs
19
+ puts "\nAll examples sorted by run time (most durable to fastest):"
20
+ end
20
21
 
21
22
  all_examples = summary.examples.map do |example|
22
23
  {
@@ -30,24 +31,30 @@ class SlowSpecFormatter
30
31
  }
31
32
  end
32
33
 
34
+ if @fast_specs_threshold
35
+ all_examples = all_examples.select { |ex| ex[:run_time] > @fast_specs_threshold && !ex[:flaky] }
36
+ end
37
+
33
38
  sorted_examples = all_examples.sort_by { |ex| -ex[:run_time] }
34
39
 
35
40
  sorted_examples.each do |ex|
36
41
  puts "#{ex[:description]} (#{ex[:file_path]}) - #{ex[:run_time]} seconds - #{ex[:location]}"
37
42
  end
38
43
 
39
- calculate_average_time(summary)
40
- fastest_test(sorted_examples)
41
- slowest_test(sorted_examples)
42
- percentiles(sorted_examples)
43
- failed_tests(summary)
44
- tests_grouped_by_file(sorted_examples)
45
- tests_that_tooked_longer_than(sorted_examples, 2.0)
46
- time_distribution_analysis(sorted_examples)
47
- test_stability_analysis(summary)
48
- execution_time_variance(sorted_examples)
49
- temporal_complexity_analysis(sorted_examples)
50
- test_dependency_analysis(sorted_examples)
44
+ if @show_logs
45
+ calculate_average_time(summary)
46
+ fastest_test(sorted_examples)
47
+ slowest_test(sorted_examples)
48
+ percentiles(sorted_examples)
49
+ failed_tests(summary)
50
+ tests_grouped_by_file(sorted_examples)
51
+ tests_that_tooked_longer_than(sorted_examples, 2.0)
52
+ time_distribution_analysis(sorted_examples)
53
+ test_stability_analysis(summary)
54
+ execution_time_variance(sorted_examples)
55
+ temporal_complexity_analysis(sorted_examples)
56
+ test_dependency_analysis(sorted_examples)
57
+ end
51
58
 
52
59
  return unless @watchdog_api_url && @watchdog_api_token
53
60
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rspec
4
4
  module Watchdog
5
- VERSION = "0.1.3"
5
+ VERSION = '0.1.5'
6
6
  end
7
7
  end
@@ -17,7 +17,7 @@ module Rspec
17
17
  end
18
18
 
19
19
  class Configuration
20
- attr_accessor :show_logs, :watchdog_api_url, :watchdog_api_token
20
+ attr_accessor :show_logs, :watchdog_api_url, :watchdog_api_token, :fast_specs_threshold
21
21
  end
22
22
  end
23
23
  end
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-watchdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Aldunate
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-04-10 00:00:00.000000000 Z
12
+ date: 2025-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -46,6 +46,7 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - CHANGELOG.md
49
50
  - README.md
50
51
  - Rakefile
51
52
  - dashboard_1.png
@@ -55,6 +56,8 @@ files:
55
56
  - rspec-watchdog-0.1.0.gem
56
57
  - rspec-watchdog-0.1.1.gem
57
58
  - rspec-watchdog-0.1.2.gem
59
+ - rspec-watchdog-0.1.3.gem
60
+ - rspec-watchdog-0.1.4.gem
58
61
  - sig/rspec/watchdog.rbs
59
62
  homepage: https://github.com/windmotion-io/rspec-watchdog
60
63
  licenses:
@@ -78,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
81
  - !ruby/object:Gem::Version
79
82
  version: '0'
80
83
  requirements: []
81
- rubygems_version: 3.3.7
84
+ rubygems_version: 3.5.11
82
85
  signing_key:
83
86
  specification_version: 4
84
87
  summary: RSpec performance tracking and metrics