From d8fd4852a36828ea47eb7ac578e3b171f701c6b8 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Sat, 10 Aug 2024 22:22:21 +0200 Subject: [PATCH] test: integration test for neotest-golang Add integration test for executing Go tests through neotest and neotest-golang. * **Integration Test**: - Create a new file `tests/integration/neotest_golang_spec.lua`. - Initialize neotest and set up neotest-golang. - Run Go tests in the `tests/go` directory. - Verify the results of the Go tests executed through neotest and neotest-golang. - Ensure the exit code is 0 and all tests passed. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/fredrikaverpil/neotest-golang?shareId=XXXX-XXXX-XXXX-XXXX). --- tests/integration/neotest_golang_spec.lua | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/integration/neotest_golang_spec.lua diff --git a/tests/integration/neotest_golang_spec.lua b/tests/integration/neotest_golang_spec.lua new file mode 100644 index 00000000..518e31a2 --- /dev/null +++ b/tests/integration/neotest_golang_spec.lua @@ -0,0 +1,24 @@ +local async = require("nio").tests +local neotest = require("neotest") + +describe("neotest-golang integration", function() + async.it("runs Go tests and verifies results", function() + -- Initialize neotest and set up neotest-golang + neotest.setup({ + adapters = { + require("neotest-golang"), + }, + }) + + -- Run Go tests in the tests/go directory + local results = neotest.run.run({ vim.fn.expand("tests/go") }) + + -- Verify the results of the Go tests executed through neotest and neotest-golang + for _, result in pairs(results) do + assert.are.equal(result.status, "passed") + end + + -- Ensure the exit code is 0 and all tests passed + assert.are.equal(vim.v.shell_error, 0) + end) +end)