rspec-time-guard 0.2.0 → 0.2.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +5 -6
- data/lib/rspec_time_guard/railtie.rb +0 -4
- data/lib/rspec_time_guard/version.rb +1 -1
- data/lib/rspec_time_guard.rb +5 -9
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d69f2e3a7c72240510df20aa4d415f38ef214b875e3e5158767b60f578e024f5
|
|
4
|
+
data.tar.gz: 79ed632e66858a540b9a73b3616477f43877f6a395e022a64de7959362a283d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9dad05a04963ee2ca7bbb561cd219a99e03869fb42d5e77af3045e3ce4affccd8c606802682c48c2f30b925417ae80dc0cb65c0c8dc27246c8973887dcde3e1
|
|
7
|
+
data.tar.gz: 98c02103e8ae43889661e373c0544c60fd9fffee2e78f79049653bffdd3bf05b6721f38d053a7b51d2543822e6e58a75fe0a575159f4867441ebd022db867003
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.2.1] - 2026-10-28
|
|
2
|
+
- Use monotonic clock to prevent false timeouts with Timecop
|
|
3
|
+
- Drop invalid `Exception` rescue clause
|
|
4
|
+
- Remove useless logging from Railtie
|
|
5
|
+
- Bump json dependency
|
|
6
|
+
|
|
1
7
|
## [0.2.0] - 2025-04-22
|
|
2
8
|
- Experimental new implementation, using a single-threaded monitoring approach
|
|
3
9
|
|
data/README.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
[//]: # (TODO: Add a public TODO list?)
|
|
2
|
-
|
|
3
|
-
# ⚠️ **_This project is a Work In Progress_** ⚠️
|
|
4
|
-
|
|
5
1
|
# RspecTimeGuard
|
|
6
2
|
|
|
7
3
|
`RspecTimeGuard` monitors your tests as they run and provides safeguards against tests that take too long, helping you maintain a fast, reliable test suite.
|
|
@@ -171,8 +167,11 @@ RSpec Time Guard works by:
|
|
|
171
167
|
3. Monitoring execution time
|
|
172
168
|
4. Taking action if the time limit is exceeded
|
|
173
169
|
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
## Performance and Feedback
|
|
171
|
+
|
|
172
|
+
RSpec Time Guard is a relatively new gem, and while our initial benchmarks show promising results, we're still gathering comprehensive performance data across different environments and use cases. The gem's impact on your test suite may vary depending on factors like test suite size, Ruby interpreter, and CI environment.
|
|
173
|
+
|
|
174
|
+
I'd love to hear about your experience using RSpec Time Guard.
|
|
176
175
|
|
|
177
176
|
## Contributing
|
|
178
177
|
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
module RspecTimeGuard
|
|
4
4
|
class Railtie < Rails::Railtie
|
|
5
5
|
initializer "rspec_time_guard.configure" do
|
|
6
|
-
Rails.logger.info("INITIALIZER")
|
|
7
|
-
|
|
8
6
|
config.after_initialize do
|
|
9
|
-
Rails.logger.info("AFTER INITIALIZE")
|
|
10
|
-
|
|
11
7
|
if defined?(RSpec) && Rails.env.test?
|
|
12
8
|
require "rspec_time_guard"
|
|
13
9
|
|
data/lib/rspec_time_guard.rb
CHANGED
|
@@ -18,7 +18,7 @@ module RspecTimeGuard
|
|
|
18
18
|
@mutex.synchronize do
|
|
19
19
|
@active_tests[example.object_id] = {
|
|
20
20
|
example: example,
|
|
21
|
-
start_time:
|
|
21
|
+
start_time: Process.clock_gettime(Process::CLOCK_MONOTONIC),
|
|
22
22
|
timeout: timeout,
|
|
23
23
|
thread_id: thread.object_id,
|
|
24
24
|
warned: false
|
|
@@ -52,7 +52,7 @@ module RspecTimeGuard
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def check_for_timeouts
|
|
55
|
-
now =
|
|
55
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
56
56
|
timed_out_examples = []
|
|
57
57
|
|
|
58
58
|
@mutex.synchronize do
|
|
@@ -108,12 +108,11 @@ module RspecTimeGuard
|
|
|
108
108
|
@_monitor ||= TimeoutMonitor.new
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# TODO: Write article (in 2 parts?)
|
|
111
112
|
# TODO: check warnings on test suite
|
|
112
|
-
# TODO: run test suite with new implementation and compare perfs
|
|
113
|
-
# TODO: speed up test suite
|
|
114
|
-
# => implement the 'single monitor thread' alternative
|
|
115
113
|
# TODO: CHeck how it works with other Ruby interpreters? (check which implem was tested)
|
|
116
|
-
# TODO: Handle RSpec summary manually
|
|
114
|
+
# TODO: Handle RSpec summary manually
|
|
115
|
+
# -> Add a TimeGuard section
|
|
117
116
|
# TODO: Run profiling on the whole test suite to check for performance issues
|
|
118
117
|
def setup
|
|
119
118
|
RSpec.configure do |config|
|
|
@@ -126,9 +125,6 @@ module RspecTimeGuard
|
|
|
126
125
|
|
|
127
126
|
begin
|
|
128
127
|
example.run
|
|
129
|
-
rescue RspecTimeGuard::TimeLimitExceededError => e
|
|
130
|
-
# NOTE: This changes the example's status to failed and records our error
|
|
131
|
-
example.exception = e
|
|
132
128
|
ensure
|
|
133
129
|
RspecTimeGuard.monitor.unregister_test(example)
|
|
134
130
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-time-guard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucas Montorio
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -66,7 +65,6 @@ metadata:
|
|
|
66
65
|
homepage_uri: https://github.com/LucasMontorio/rspec-time-guard
|
|
67
66
|
source_code_uri: https://github.com/LucasMontorio/rspec-time-guard
|
|
68
67
|
changelog_uri: https://github.com/LucasMontorio/rspec-time-guard/blob/main/CHANGELOG.md
|
|
69
|
-
post_install_message:
|
|
70
68
|
rdoc_options: []
|
|
71
69
|
require_paths:
|
|
72
70
|
- lib
|
|
@@ -81,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
81
79
|
- !ruby/object:Gem::Version
|
|
82
80
|
version: '0'
|
|
83
81
|
requirements: []
|
|
84
|
-
rubygems_version:
|
|
85
|
-
signing_key:
|
|
82
|
+
rubygems_version: 4.0.16
|
|
86
83
|
specification_version: 4
|
|
87
84
|
summary: A simple time keeper for RSpec tests.
|
|
88
85
|
test_files: []
|