File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ defmodule ErrorTrackerTest do
44 alias ErrorTracker.Error
55 alias ErrorTracker.Occurrence
66
7- @ relative_file_path Path . relative_to ( __ENV__ . file , File . cwd! ( ) )
7+ # We use this file path because for some reason the test scripts are not
8+ # handled as part of the application, so the last line of the app executed is
9+ # on the case module.
10+ @ relative_file_path "test/support/case.ex"
811
912 describe inspect ( & ErrorTracker . report / 3 ) do
1013 setup context do
@@ -29,6 +32,12 @@ defmodule ErrorTrackerTest do
2932 test "reports badarith errors" do
3033 string_var = to_string ( 1 )
3134
35+ # We set the otp_app to `nil` because the error is not reported by an OTP
36+ # application but by this script, so the last line of the stacktrace is not
37+ # the correct one if we leave the right value.
38+ Application . put_env ( :error_tracker , :otp_app , nil )
39+ on_exit ( fn -> Application . put_env ( :error_tracker , :otp_app , :error_tracker ) end )
40+
3241 % Occurrence { error: error = % Error { } } =
3342 report_error ( fn -> 1 + string_var end )
3443
You can’t perform that action at this time.
0 commit comments