File tree 3 files changed +21
-6
lines changed
fixtures/mocha_mock_app/test
3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 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'
Original file line number Diff line number Diff line change 1
1
$LOAD_PATH. unshift File . expand_path ( '../lib' , __dir__ )
2
2
3
- require 'appmap/minitest'
3
+ require 'minitest/autorun'
4
+
5
+ require 'appmap'
6
+ require 'appmap/minitest' if ENV [ 'APPMAP_AUTOREQUIRE' ] == 'false'
4
7
5
8
require 'sheep'
6
- require 'minitest/autorun'
7
9
require 'mocha/minitest'
8
10
9
11
class SheepTest < Minitest ::Test
Original file line number Diff line number Diff line change 4
4
require 'test_helper'
5
5
6
6
class MockCompatibilityTest < Minitest ::Test
7
- def perform_minitest_test ( test_name )
7
+ def perform_minitest_test ( test_name , env = { } )
8
8
Bundler . with_clean_env do
9
9
Dir . chdir 'test/fixtures/mocha_mock_app' do
10
10
FileUtils . rm_rf 'tmp'
11
11
system 'bundle config --local local.appmap ../../..'
12
12
system 'bundle'
13
- system ( { 'APPMAP' => 'true' } , %(bundle exec ruby -Ilib -Itest test/#{ test_name } _test.rb) )
13
+ system ( env . merge ( { 'APPMAP' => 'true' } ) , %(bundle exec ruby -Ilib -Itest test/#{ test_name } _test.rb) )
14
14
15
15
yield
16
16
end
@@ -29,4 +29,17 @@ def test_expectation
29
29
assert_equal 'succeeded' , metadata [ 'test_status' ]
30
30
end
31
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
32
45
end
You can’t perform that action at this time.
0 commit comments