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
4
4
alias ErrorTracker.Error
5
5
alias ErrorTracker.Occurrence
6
6
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"
8
11
9
12
describe inspect ( & ErrorTracker . report / 3 ) do
10
13
setup context do
@@ -29,6 +32,12 @@ defmodule ErrorTrackerTest do
29
32
test "reports badarith errors" do
30
33
string_var = to_string ( 1 )
31
34
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
+
32
41
% Occurrence { error: error = % Error { } } =
33
42
report_error ( fn -> 1 + string_var end )
34
43
You can’t perform that action at this time.
0 commit comments