appmap 0.98.1 → 0.99.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/appmap/minitest.rb +24 -10
- data/lib/appmap/rspec.rb +23 -6
- data/lib/appmap/util.rb +12 -1
- data/lib/appmap/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 463cf482f8d6b1a33721886b5d049ae0ce11c469759562a4ea0b8c6c149abb23
|
4
|
+
data.tar.gz: 727ecbc15e19e486f69ed668d9e077a3045c10b24c0892b66801346d11a02a4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cec680149e2742d4ed403a73d7283c454e0e561a95207ab426b9996c4056fa93626d0544de0923f575252038869a7e7e6b6f351eaaab4f1b7576ef20467bb527
|
7
|
+
data.tar.gz: 573b7ba81cae478ea658c27937563410bd83143bb0c13b9aeea3402422460ac55debff2adeffc83cb77c4be1372f6e49f1c640d8ff193c18199597a0bff25f58
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# [0.99.0](https://github.com/getappmap/appmap-ruby/compare/v0.98.1...v0.99.0) (2023-04-13)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Don't report vendored paths as local ([e09cb4f](https://github.com/getappmap/appmap-ruby/commit/e09cb4f9764d275c7ba0858f16b545c2d287b473))
|
7
|
+
* Report the first relative path in the backtrace ([f81b346](https://github.com/getappmap/appmap-ruby/commit/f81b346ebc66a4f60ca26ad384d72672893d1333))
|
8
|
+
|
9
|
+
|
10
|
+
### Features
|
11
|
+
|
12
|
+
* Report metadata.test_failure ([82c87d2](https://github.com/getappmap/appmap-ruby/commit/82c87d2453ce7c040bce138bf55d94d47aca58fc))
|
13
|
+
|
1
14
|
## [0.98.1](https://github.com/getappmap/appmap-ruby/compare/v0.98.0...v0.98.1) (2023-03-09)
|
2
15
|
|
3
16
|
|
data/lib/appmap/minitest.rb
CHANGED
@@ -26,13 +26,28 @@ module AppMap
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def source_location
|
29
|
-
test.method(test_name).source_location
|
29
|
+
location = test.method(test_name).source_location
|
30
|
+
[ Util.normalize_path(location.first), location.last ].join(':')
|
30
31
|
end
|
31
32
|
|
32
|
-
def finish(
|
33
|
-
|
33
|
+
def finish(failures, exception)
|
34
|
+
failed = failures.any? || exception
|
35
|
+
warn "Finishing recording of #{failed ? 'failed ' : ''} test #{test.class}.#{test.name}" if AppMap::Minitest::LOG
|
34
36
|
warn "Exception: #{exception}" if exception && AppMap::Minitest::LOG
|
35
37
|
|
38
|
+
if failed
|
39
|
+
failure_exception = failures.first || exception
|
40
|
+
warn "Failure exception: #{failure_exception}" if AppMap::Minitest::LOG
|
41
|
+
|
42
|
+
first_location = failure_exception.backtrace_locations.find { |location| !Pathname.new(Util.normalize_path(location.absolute_path)).absolute? }
|
43
|
+
failure_location = [ Util.normalize_path(first_location.path), first_location.lineno ].join(':') if first_location
|
44
|
+
|
45
|
+
test_failure = {
|
46
|
+
message: failure_exception.message,
|
47
|
+
location: failure_location,
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
36
51
|
events = []
|
37
52
|
AppMap.tracing.delete @trace
|
38
53
|
|
@@ -49,7 +64,8 @@ module AppMap
|
|
49
64
|
AppMap::Minitest.save name: scenario_name,
|
50
65
|
class_map: class_map,
|
51
66
|
source_location: source_location,
|
52
|
-
test_status: failed
|
67
|
+
test_status: failed ? 'failed' : 'succeeded',
|
68
|
+
test_failure: test_failure,
|
53
69
|
exception: exception,
|
54
70
|
events: events
|
55
71
|
end
|
@@ -79,7 +95,7 @@ module AppMap
|
|
79
95
|
recording = @recordings_by_test.delete(test.object_id)
|
80
96
|
return warn "No recording found for #{test}" unless recording
|
81
97
|
|
82
|
-
recording.finish
|
98
|
+
recording.finish test.failures || [], exception
|
83
99
|
end
|
84
100
|
|
85
101
|
def config
|
@@ -90,7 +106,7 @@ module AppMap
|
|
90
106
|
@event_methods += event_methods
|
91
107
|
end
|
92
108
|
|
93
|
-
def save(name:, class_map:, source_location:, test_status:, exception:, events:)
|
109
|
+
def save(name:, class_map:, source_location:, test_status:, test_failure:, exception:, events:)
|
94
110
|
metadata = AppMap::Minitest.metadata.tap do |m|
|
95
111
|
m[:name] = name
|
96
112
|
m[:source_location] = source_location
|
@@ -105,11 +121,9 @@ module AppMap
|
|
105
121
|
type: 'tests',
|
106
122
|
}
|
107
123
|
m[:test_status] = test_status
|
124
|
+
m[:test_failure] = test_failure if test_failure
|
108
125
|
if exception
|
109
|
-
m[:exception] =
|
110
|
-
class: exception.class.name,
|
111
|
-
message: AppMap::Event::MethodEvent.display_string(exception.to_s),
|
112
|
-
}
|
126
|
+
m[:exception] = Util.format_exception(exception)
|
113
127
|
end
|
114
128
|
end
|
115
129
|
|
data/lib/appmap/rspec.rb
CHANGED
@@ -8,7 +8,7 @@ require 'fileutils'
|
|
8
8
|
module AppMap
|
9
9
|
module RSpec
|
10
10
|
APPMAP_OUTPUT_DIR = 'tmp/appmap/rspec'
|
11
|
-
LOG =
|
11
|
+
LOG = (ENV['APPMAP_DEBUG'] == 'true' || ENV['DEBUG'] == 'true')
|
12
12
|
|
13
13
|
def self.metadata
|
14
14
|
AppMap.detect_metadata
|
@@ -96,10 +96,24 @@ module AppMap
|
|
96
96
|
result
|
97
97
|
end
|
98
98
|
|
99
|
-
def finish(exception)
|
100
|
-
|
99
|
+
def finish(failure, exception)
|
100
|
+
failed = true if failure || exception
|
101
|
+
warn "Finishing recording of #{failed ? 'failed ' : ''} example #{example}" if AppMap::RSpec::LOG
|
101
102
|
warn "Exception: #{exception}" if exception && AppMap::RSpec::LOG
|
102
103
|
|
104
|
+
if failed
|
105
|
+
failure_exception = failure || exception
|
106
|
+
warn "Failure exception: #{failure_exception}" if AppMap::RSpec::LOG
|
107
|
+
|
108
|
+
first_location = failure_exception.backtrace_locations.find { |location| !Pathname.new(Util.normalize_path(location.absolute_path)).absolute? }
|
109
|
+
failure_location = [ Util.normalize_path(first_location.path), first_location.lineno ].join(':') if first_location
|
110
|
+
|
111
|
+
test_failure = {
|
112
|
+
message: failure_exception.message.strip,
|
113
|
+
location: failure_location,
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
103
117
|
events = []
|
104
118
|
AppMap.tracing.delete @trace
|
105
119
|
|
@@ -134,6 +148,7 @@ module AppMap
|
|
134
148
|
class_map: class_map,
|
135
149
|
source_location: source_location,
|
136
150
|
test_status: exception ? 'failed' : 'succeeded',
|
151
|
+
test_failure: test_failure,
|
137
152
|
exception: exception,
|
138
153
|
events: events
|
139
154
|
end
|
@@ -169,7 +184,7 @@ module AppMap
|
|
169
184
|
recording = @recordings_by_example.delete(example.object_id)
|
170
185
|
return warn "No recording found for #{example}" unless recording
|
171
186
|
|
172
|
-
recording.finish exception unless recording == :false
|
187
|
+
recording.finish example.execution_result.exception || exception, exception unless recording == :false
|
173
188
|
end
|
174
189
|
|
175
190
|
def config
|
@@ -180,7 +195,7 @@ module AppMap
|
|
180
195
|
@event_methods += event_methods
|
181
196
|
end
|
182
197
|
|
183
|
-
def save(name:, class_map:, source_location:, test_status:, exception:, events:)
|
198
|
+
def save(name:, class_map:, source_location:, test_status:, test_failure:, exception:, events:)
|
184
199
|
metadata = AppMap::RSpec.metadata.tap do |m|
|
185
200
|
m[:name] = name
|
186
201
|
m[:source_location] = source_location
|
@@ -195,8 +210,10 @@ module AppMap
|
|
195
210
|
type: 'tests'
|
196
211
|
}
|
197
212
|
m[:test_status] = test_status
|
213
|
+
m[:test_failure] = test_failure if test_failure
|
198
214
|
if exception
|
199
|
-
m[:exception] =
|
215
|
+
m[:exception] = Util.format_exception(exception)
|
216
|
+
{
|
200
217
|
class: exception.class.name,
|
201
218
|
message: AppMap::Event::MethodEvent.display_string(exception.to_s)
|
202
219
|
}
|
data/lib/appmap/util.rb
CHANGED
@@ -139,13 +139,24 @@ module AppMap
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def normalize_path(path)
|
142
|
-
|
142
|
+
is_local_path = -> { path.index(Dir.pwd) == 0 }
|
143
|
+
is_bundled_path = -> { path.index(Bundler.bundle_path.to_s) == 0 }
|
144
|
+
is_vendored_path = -> { path.index(File.join(Dir.pwd, 'vendor/bundle')) == 0 }
|
145
|
+
|
146
|
+
if is_local_path.() && !is_bundled_path.() && !is_vendored_path.()
|
143
147
|
path[Dir.pwd.length + 1..-1]
|
144
148
|
else
|
145
149
|
path
|
146
150
|
end
|
147
151
|
end
|
148
152
|
|
153
|
+
def format_exception(exception)
|
154
|
+
{
|
155
|
+
class: exception.class.name,
|
156
|
+
message: AppMap::Event::MethodEvent.display_string(exception.to_s),
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
149
160
|
# Convert a Rails-style path from /org/:org_id(.:format)
|
150
161
|
# to Swagger-style paths like /org/{org_id}
|
151
162
|
def swaggerize_path(path)
|
data/lib/appmap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.99.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|