appmap 0.66.2 → 0.67.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: 2dd5295e0bbe8c9a4281b27bd712b61640672e93a03d6c3e31af3e201c9ca592
4
- data.tar.gz: 8fb74d28bb2367918831c6d3af029440591da8ee694f1645fc2ef8baf5b28b60
3
+ metadata.gz: 4209d3f9422b61ba07ca1776597eac220374e8308a303cdf001604c90903dd31
4
+ data.tar.gz: 55a755af5bd85255ce882633d3089a0ca308d137b15945e0a1fff4d5479c4994
5
5
  SHA512:
6
- metadata.gz: ef07a3169b2d1f4dcabb406296275506250840cc767440b60a106f48ad5ee251017a9e9f7cd9769e7d0d133a3b9704f76bfef571fd69feef85163979cec80a80
7
- data.tar.gz: 34c9c18e230dc46d868b759422eb7aeaba79b99fd1cca610bbc1a8bdc70a7cfa18e34a064a43cc50847c8c452bf267a6003a5b98cb3a2e2e8fa40028552fe112
6
+ metadata.gz: 4a7ce04424eac8292b0457c99bc3b6f699c0e80a6222450e52f37071e078c2c574c33e8a89249c584412c50da5b26d07f98864f50ecc13e0318da6272fafb879
7
+ data.tar.gz: 6c8ba9b9a67f09ce662d1bdf0569238537087709cff6f9be2562d50fe06d8ca4199268a2bc3c0d9136dd8a6ab6ff0e66f0d85683b4d3c15e95ba5e10dbcdeb71
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.67.0](https://github.com/applandinc/appmap-ruby/compare/v0.66.2...v0.67.0) (2021-10-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Ensure rack is available, and handle nil HTTP response ([5e81dc4](https://github.com/applandinc/appmap-ruby/commit/5e81dc4310c9b7f2d81c31339f8490639c845f76))
7
+ * Handle WeakRef ([852ee04](https://github.com/applandinc/appmap-ruby/commit/852ee047880f9d1492be38772ed3f0cc1a670cb5))
8
+
9
+
10
+ ### Features
11
+
12
+ * APPMAP_AUTOREQUIRE and APPMAP_INITIALIZE env vars to customize loading behavior ([369807e](https://github.com/applandinc/appmap-ruby/commit/369807e4c90243e296b324e70805bd09d0f5fc4a))
13
+ * Perform GC before running each test ([84c895e](https://github.com/applandinc/appmap-ruby/commit/84c895e95fe8caa270cc1412e239599bfcc1b467))
14
+
1
15
  ## [0.66.2](https://github.com/applandinc/appmap-ruby/compare/v0.66.1...v0.66.2) (2021-10-07)
2
16
 
3
17
 
data/lib/appmap/event.rb CHANGED
@@ -111,10 +111,12 @@ module AppMap
111
111
  rescue NoMethodError
112
112
  begin
113
113
  value.inspect
114
- rescue StandardError
114
+ rescue
115
115
  last_resort_string.call
116
116
  end
117
- rescue StandardError
117
+ rescue WeakRef::RefError
118
+ nil
119
+ rescue
118
120
  last_resort_string.call
119
121
  end
120
122
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'appmap/event'
4
4
  require 'appmap/util'
5
+ require 'rack'
5
6
 
6
7
  module AppMap
7
8
  module Handler
@@ -60,10 +61,14 @@ module AppMap
60
61
  def initialize(response, parent_id, elapsed)
61
62
  super AppMap::Event.next_id_counter, :return, Thread.current.object_id
62
63
 
63
- self.status = response.code.to_i
64
+ if response
65
+ self.status = response.code.to_i
66
+ self.headers = NetHTTP.copy_headers(response)
67
+ else
68
+ self.headers = {}
69
+ end
64
70
  self.parent_id = parent_id
65
71
  self.elapsed = elapsed
66
- self.headers = NetHTTP.copy_headers(response)
67
72
  end
68
73
 
69
74
  def to_h
@@ -142,6 +142,7 @@ if AppMap::Minitest.enabled?
142
142
  alias run_without_hook run
143
143
 
144
144
  def run
145
+ GC.start
145
146
  AppMap::Minitest.begin_test self, name
146
147
  begin
147
148
  run_without_hook
data/lib/appmap/rspec.rb CHANGED
@@ -87,6 +87,7 @@ module AppMap
87
87
  end
88
88
 
89
89
  warn "Starting recording of example #{example}@#{source_location}" if AppMap::RSpec::LOG
90
+ GC.start
90
91
  @trace = AppMap.tracing.trace
91
92
  @webdriver_port = webdriver_port.()
92
93
  end
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.66.2'
6
+ VERSION = '0.67.0'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
 
data/lib/appmap.rb CHANGED
@@ -74,6 +74,6 @@ lambda do
74
74
  require 'appmap/depends'
75
75
  end
76
76
 
77
- end.call
77
+ end.call unless ENV['APPMAP_AUTOREQUIRE'] == 'false'
78
78
 
79
- AppMap.initialize_configuration if ENV['APPMAP'] == 'true'
79
+ AppMap.initialize_configuration if ENV['APPMAP'] == 'true' && ENV['APPMAP_INITIALIZE'] != 'false'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'appmap', git: 'applandinc/appmap-ruby', branch: `git rev-parse --abbrev-ref HEAD`.strip
4
+ gem 'minitest'
5
+ gem 'mocha'
@@ -0,0 +1,5 @@
1
+ name: mocha_mock_app
2
+ packages:
3
+ - path: lib
4
+ - gem: mocha
5
+ shallow: false
@@ -0,0 +1,5 @@
1
+ class Sheep
2
+ def baa
3
+ 'baa'
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
+
3
+ require 'minitest/autorun'
4
+
5
+ require 'appmap'
6
+ require 'appmap/minitest' if ENV['APPMAP_AUTOREQUIRE'] == 'false'
7
+
8
+ require 'sheep'
9
+ require 'mocha/minitest'
10
+
11
+ class SheepTest < Minitest::Test
12
+ def test_sheep
13
+ sheep = mock('sheep')
14
+ sheep.responds_like(Sheep.new)
15
+ sheep.expects(:baa).returns('baa')
16
+ sheep.baa
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'test_helper'
5
+
6
+ class MockCompatibilityTest < Minitest::Test
7
+ def perform_minitest_test(test_name, env = {})
8
+ Bundler.with_clean_env do
9
+ Dir.chdir 'test/fixtures/mocha_mock_app' do
10
+ FileUtils.rm_rf 'tmp'
11
+ system 'bundle config --local local.appmap ../../..'
12
+ system 'bundle'
13
+ system(env.merge({ 'APPMAP' => 'true' }), %(bundle exec ruby -Ilib -Itest test/#{test_name}_test.rb))
14
+
15
+ yield
16
+ end
17
+ end
18
+ end
19
+
20
+ def test_expectation
21
+ perform_minitest_test('sheep') do
22
+ appmap_file = 'tmp/appmap/minitest/Sheep_sheep.appmap.json'
23
+
24
+ assert File.file?(appmap_file), 'appmap output file does not exist'
25
+ appmap = JSON.parse(File.read(appmap_file))
26
+ assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
27
+ assert_includes appmap.keys, 'metadata'
28
+ metadata = appmap['metadata']
29
+ assert_equal 'succeeded', metadata['test_status']
30
+ end
31
+ end
32
+
33
+ def test_expectation_without_autorequire
34
+ perform_minitest_test('sheep', 'APPMAP_AUTOREQUIRE' => 'false') do
35
+ appmap_file = 'tmp/appmap/minitest/Sheep_sheep.appmap.json'
36
+
37
+ assert File.file?(appmap_file), 'appmap output file does not exist'
38
+ appmap = JSON.parse(File.read(appmap_file))
39
+ assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
40
+ assert_includes appmap.keys, 'metadata'
41
+ metadata = appmap['metadata']
42
+ assert_equal 'succeeded', metadata['test_status']
43
+ end
44
+ end
45
+ end
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.66.2
4
+ version: 0.67.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: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -3699,6 +3699,10 @@ files:
3699
3699
  - test/fixtures/minitest_recorder/appmap.yml
3700
3700
  - test/fixtures/minitest_recorder/lib/hello.rb
3701
3701
  - test/fixtures/minitest_recorder/test/hello_test.rb
3702
+ - test/fixtures/mocha_mock_app/Gemfile
3703
+ - test/fixtures/mocha_mock_app/appmap.yml
3704
+ - test/fixtures/mocha_mock_app/lib/sheep.rb
3705
+ - test/fixtures/mocha_mock_app/test/sheep_test.rb
3702
3706
  - test/fixtures/openssl_recorder/Gemfile
3703
3707
  - test/fixtures/openssl_recorder/appmap.yml
3704
3708
  - test/fixtures/openssl_recorder/lib/openssl_cert_sign.rb
@@ -3715,6 +3719,7 @@ files:
3715
3719
  - test/gem_test.rb
3716
3720
  - test/inspect_cli_test.rb
3717
3721
  - test/minitest_test.rb
3722
+ - test/mock_compatibility_test.rb
3718
3723
  - test/openssl_test.rb
3719
3724
  - test/record_process_test.rb
3720
3725
  - test/rspec_test.rb