Skip to content

Commit 15f6444

Browse files
committed
feat: Direct minitest and rspec startup messages to the Rails log, when available
1 parent 1709374 commit 15f6444

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/appmap/minitest.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,21 @@ def finish(exception)
5454

5555
@recordings_by_test = {}
5656
@event_methods = Set.new
57+
@recording_count = 0
5758

5859
class << self
5960
def init
60-
warn 'Configuring AppMap recorder for Minitest'
61-
6261
FileUtils.mkdir_p APPMAP_OUTPUT_DIR
6362
end
6463

64+
def first_recording?
65+
@recording_count == 0
66+
end
67+
6568
def begin_test(test, name)
69+
AppMap.info 'Configuring AppMap recorder for Minitest' if first_recording?
70+
@recording_count += 1
71+
6672
@recordings_by_test[test.object_id] = Recording.new(test, name)
6773
end
6874

lib/appmap/rspec.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,21 @@ def finish(exception)
139139

140140
@recordings_by_example = {}
141141
@event_methods = Set.new
142+
@recording_count = 0
142143

143144
class << self
144145
def init
145-
warn 'Configuring AppMap recorder for RSpec'
146-
147146
FileUtils.mkdir_p APPMAP_OUTPUT_DIR
148147
end
149148

149+
def first_recording?
150+
@recording_count == 0
151+
end
152+
150153
def begin_spec(example)
154+
AppMap.info 'Configuring AppMap recorder for RSpec' if first_recording?
155+
@recording_count += 1
156+
151157
@recordings_by_example[example.object_id] = Recording.new(example)
152158
end
153159

0 commit comments

Comments
 (0)