appmap 0.98.0 → 0.99.0

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: 409ba80fae04609fbed2635342499d743638bf1be48c9a2872931fb21898ffee
4
- data.tar.gz: 26dab002cc9e0d616cb803d0d67095c5d5eaf307ae8f8b86f6e4a3446127af99
3
+ metadata.gz: 463cf482f8d6b1a33721886b5d049ae0ce11c469759562a4ea0b8c6c149abb23
4
+ data.tar.gz: 727ecbc15e19e486f69ed668d9e077a3045c10b24c0892b66801346d11a02a4d
5
5
  SHA512:
6
- metadata.gz: 9db98d6ca5f3a620b03ea1b8ecaa2fff7769745ec1b8dda2cee635cca7024f73b90fd6cd6b4c1eacebed5645630e30113d1c771ee07d1af6107d2de228ee58bf
7
- data.tar.gz: a777268c6a9edd86113c9f139c010f0987ed60f91ed050bfe9d42bf5dce4e8d4e8acd2bcf9eaef0cade32159ea02ba590998b41cd5520c7d3c24a4652e0d6dad
6
+ metadata.gz: cec680149e2742d4ed403a73d7283c454e0e561a95207ab426b9996c4056fa93626d0544de0923f575252038869a7e7e6b6f351eaaab4f1b7576ef20467bb527
7
+ data.tar.gz: 573b7ba81cae478ea658c27937563410bd83143bb0c13b9aeea3402422460ac55debff2adeffc83cb77c4be1372f6e49f1c640d8ff193c18199597a0bff25f58
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
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
+
14
+ ## [0.98.1](https://github.com/getappmap/appmap-ruby/compare/v0.98.0...v0.98.1) (2023-03-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Prevent AppMaps from being constantly re-indexed ([0311ab4](https://github.com/getappmap/appmap-ruby/commit/0311ab4c2f759e8c471982d47e6038e3aaa9f908))
20
+ * Report test_status from minitest ([659f89a](https://github.com/getappmap/appmap-ruby/commit/659f89aa5a11280eb886abe14ec0c70790cb07a7))
21
+
1
22
  # [0.98.0](https://github.com/getappmap/appmap-ruby/compare/v0.97.0...v0.98.0) (2023-02-22)
2
23
 
3
24
 
data/README.md CHANGED
@@ -22,7 +22,7 @@ granular than a full debug trace. It's designed to be optimal for understanding
22
22
  Visit the [AppMap for Ruby](https://appland.com/docs/reference/appmap-ruby.html) reference page on AppLand.com for a complete reference guide.
23
23
 
24
24
  # Development
25
- [![Build Status](https://travis-ci.com/applandinc/appmap-ruby.svg?branch=master)](https://travis-ci.com/applandinc/appmap-ruby)
25
+ [![Build Status](https://travis-ci.com/getappmap/appmap-ruby.svg?branch=master)](https://travis-ci.com/getappmap/appmap-ruby)
26
26
 
27
27
  ## Internal architecture
28
28
 
data/appmap.yml CHANGED
@@ -1,2 +1,3 @@
1
1
  name: AppMap Rubygem
2
2
  packages: []
3
+ appmap_dir: dummy
@@ -11,7 +11,7 @@ module AppMap
11
11
  # be activated around each test.
12
12
  module Minitest
13
13
  APPMAP_OUTPUT_DIR = 'tmp/appmap/minitest'
14
- LOG = ( ENV['APPMAP_DEBUG'] == 'true' || ENV['DEBUG'] == 'true' )
14
+ LOG = (ENV['APPMAP_DEBUG'] == 'true' || ENV['DEBUG'] == 'true')
15
15
 
16
16
  def self.metadata
17
17
  AppMap.detect_metadata
@@ -26,14 +26,28 @@ module AppMap
26
26
  end
27
27
 
28
28
  def source_location
29
- test.method(test_name).source_location.join(':')
29
+ location = test.method(test_name).source_location
30
+ [ Util.normalize_path(location.first), location.last ].join(':')
30
31
  end
31
32
 
32
-
33
- def finish(exception)
34
- warn "Finishing recording of test #{test.class}.#{test.name}" if AppMap::Minitest::LOG
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
35
36
  warn "Exception: #{exception}" if exception && AppMap::Minitest::LOG
36
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
+
37
51
  events = []
38
52
  AppMap.tracing.delete @trace
39
53
 
@@ -45,12 +59,13 @@ module AppMap
45
59
 
46
60
  feature_group = test.class.name.underscore.split('_')[0...-1].join('_').capitalize
47
61
  feature_name = test.name.split('_')[1..-1].join(' ')
48
- scenario_name = [ feature_group, feature_name ].join(' ')
62
+ scenario_name = [feature_group, feature_name].join(' ')
49
63
 
50
64
  AppMap::Minitest.save name: scenario_name,
51
65
  class_map: class_map,
52
66
  source_location: source_location,
53
- test_status: exception ? 'failed' : 'succeeded',
67
+ test_status: failed ? 'failed' : 'succeeded',
68
+ test_failure: test_failure,
54
69
  exception: exception,
55
70
  events: events
56
71
  end
@@ -80,18 +95,18 @@ module AppMap
80
95
  recording = @recordings_by_test.delete(test.object_id)
81
96
  return warn "No recording found for #{test}" unless recording
82
97
 
83
- recording.finish exception
98
+ recording.finish test.failures || [], exception
84
99
  end
85
100
 
86
101
  def config
87
- @config or raise "AppMap is not configured"
102
+ @config or raise 'AppMap is not configured'
88
103
  end
89
104
 
90
105
  def add_event_methods(event_methods)
91
106
  @event_methods += event_methods
92
107
  end
93
108
 
94
- 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:)
95
110
  metadata = AppMap::Minitest.metadata.tap do |m|
96
111
  m[:name] = name
97
112
  m[:source_location] = source_location
@@ -99,18 +114,16 @@ module AppMap
99
114
  m[:frameworks] ||= []
100
115
  m[:frameworks] << {
101
116
  name: 'minitest',
102
- version: Gem.loaded_specs['minitest']&.version&.to_s
117
+ version: Gem.loaded_specs['minitest']&.version&.to_s,
103
118
  }
104
119
  m[:recorder] = {
105
120
  name: 'minitest',
106
- type: 'tests'
121
+ type: 'tests',
107
122
  }
108
123
  m[:test_status] = test_status
124
+ m[:test_failure] = test_failure if test_failure
109
125
  if exception
110
- m[:exception] = {
111
- class: exception.class.name,
112
- message: AppMap::Event::MethodEvent.display_string(exception.to_s)
113
- }
126
+ m[:exception] = Util.format_exception(exception)
114
127
  end
115
128
  end
116
129
 
@@ -118,7 +131,7 @@ module AppMap
118
131
  version: AppMap::APPMAP_FORMAT_VERSION,
119
132
  metadata: metadata,
120
133
  classMap: class_map,
121
- events: events
134
+ events: events,
122
135
  }.compact
123
136
  fname = AppMap::Util.scenario_filename(name)
124
137
 
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 = false
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
- warn "Finishing recording of example #{example}" if AppMap::RSpec::LOG
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
- if path.index(Dir.pwd) == 0 && !path.index(Bundler.bundle_path.to_s)
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)
@@ -3,9 +3,9 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.98.0'
6
+ VERSION = '0.99.0'
7
7
 
8
- APPMAP_FORMAT_VERSION = '1.10.0'
8
+ APPMAP_FORMAT_VERSION = '1.12.0'
9
9
 
10
10
  SUPPORTED_RUBY_VERSIONS = %w[2.5 2.6 2.7 3.0 3.1 3.2].freeze
11
11
 
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.98.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-02-22 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source