From e2a4c6b83b5ae4eef28055dfbbc032f42ef76350 Mon Sep 17 00:00:00 2001 From: V13Axel Date: Sat, 17 Feb 2024 17:02:32 -0500 Subject: [PATCH] Use vim-notify when errors happen --- lua/neotest-pest/init.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/neotest-pest/init.lua b/lua/neotest-pest/init.lua index 4bb51f7..726d4a2 100644 --- a/lua/neotest-pest/init.lua +++ b/lua/neotest-pest/init.lua @@ -4,6 +4,20 @@ local utils = require('neotest-pest.utils') local config = require('neotest-pest.config') local debug = logger.debug +local notify = function(msg, level) + vim.notify(msg, level, { + title = "neotest-pest", + }) +end + +local error = function(msg) + notify(msg, "error") +end + +local info = function(msg) + notify(msg, "info") +end + ---@class neotest.Adapter ---@field name string local NeotestAdapter = { name = "neotest-pest" } @@ -143,18 +157,21 @@ function NeotestAdapter.results(test, result, tree) local ok, data = pcall(lib.files.read, output_file) if not ok then + error("No test output file found! Should have been at: " .. output_file) logger.error("No test output file found:", output_file) return {} end local ok, parsed_data = pcall(lib.xml.parse, data) if not ok then + error("Failed to parse test output!") logger.error("Failed to parse test output:", output_file) return {} end local ok, results = pcall(utils.get_test_results, parsed_data, output_file) if not ok then + error("Could not get test results!") logger.error("Could not get test results", output_file) return {} end