@@ -17,6 +17,14 @@ local function run_tests_and_update_state(tests)
1717 M .state .last_run = run_api .run_tests (tests )
1818end
1919
20+ local function with_exceptions (fn )
21+ nio .run (fn , function (success , stacktrace )
22+ if not success then
23+ vim .notify (stacktrace , vim .log .levels .ERROR )
24+ end
25+ end )
26+ end
27+
2028function M .run_all_tests ()
2129 nio .run (function ()
2230 local tests = tests_api .get_all_tests ()
@@ -28,7 +36,7 @@ function M.run_all_tests()
2836end
2937
3038function M .run_tests ()
31- nio . run (function ()
39+ with_exceptions (function ()
3240 local current_test = location .get_test_at_cursor ()
3341
3442 local tests
@@ -47,7 +55,7 @@ function M.run_tests()
4755end
4856
4957function M .run_tests_in_ns ()
50- nio . run (function ()
58+ with_exceptions (function ()
5159 local namespaces
5260 local current_namespace = location .get_current_namespace ()
5361 local test_namespaces = tests_api .get_test_namespaces ()
@@ -74,7 +82,7 @@ function M.run_tests_in_ns()
7482end
7583
7684function M .rerun_previous ()
77- nio . run (function ()
85+ with_exceptions (function ()
7886 if not M .state .previous then
7987 return
8088 end
@@ -83,7 +91,7 @@ function M.rerun_previous()
8391end
8492
8593function M .rerun_failed ()
86- nio . run (function ()
94+ with_exceptions (function ()
8795 local failed = {}
8896 for test , report in pairs (M .state .last_run ) do
8997 if report .status == " failed" then
@@ -101,20 +109,20 @@ function M.rerun_failed()
101109end
102110
103111function M .open_last_report ()
104- if not M .state .last_run then
112+ if not M .state .last_run then
105113 return
106114 end
107115 run_api .open_reports (M .state .last_run )
108116end
109117
110118function M .load_tests ()
111- nio . run (function ()
119+ with_exceptions (function ()
112120 tests_api .load_tests ()
113121 end )
114122end
115123
116124function M .analyze_exception (sym )
117- nio . run (function ()
125+ with_exceptions (function ()
118126 exceptions_api .render_exception (sym )
119127 end )
120128end
0 commit comments