Comments (2)
So basically I would want my diagnostic message on the line of the failure. The blue arrow should show this 😄
my config:
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"nvim-neotest/neotest-plenary",
"nvim-neotest/neotest-go",
},
config = function()
local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local message =
diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
require("neotest").setup({
diagnostic = {
enabled = true,
severity = 4,
},
adapters = {
require("neotest-go")({
experimental = { test_table = true },
}),
},
})
end,
main.go:
package main
import "fmt"
func AddNoZero(a, b int) (int, error) {
if a == 0 || b == 0 {
return 0, fmt.Errorf("cannot add zero")
}
return a + b, nil
}
main_test.go
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAddNoZero(t *testing.T) {
type args struct {
a int
b int
}
tests := []struct {
name string
args args
want int
assertion assert.ErrorAssertionFunc
}{
{
name: "correct test",
args: args{
a: 2,
b: 5,
},
want: 7,
assertion: assert.NoError,
},
{
name: "another correct test",
args: args{
a: 8,
b: 5,
},
want: 13,
assertion: assert.NoError,
},
{
name: "failing test",
args: args{
a: 7,
b: 5,
},
want: 9,
assertion: assert.NoError,
},
{
name: "final correct test",
args: args{
a: 7,
b: 5,
},
want: 12,
assertion: assert.NoError,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := AddNoZero(tt.args.a, tt.args.b)
tt.assertion(t, err)
assert.Equal(t, tt.want, got)
})
}
}
from neotest-go.
Hi @arnevm123 could you please provide some screenshots? It would help understand what do you want to achive
from neotest-go.
Related Issues (20)
- [feature request] Table-driven tests written as map[string]struct{} HOT 5
- Neotest Summary window is showing incorrect status HOT 2
- nil error on test single function HOT 5
- Error while testing a file/directory with failed test cases HOT 1
- 'No tests found' using minimal config HOT 40
- Test Output in JSON, making it difficult to read HOT 30
- Tests having warnings are marked as failed HOT 2
- Test coverage generation is not working properly due to cwd being changed to the test file directory. HOT 9
- Running package tests HOT 4
- Query: invalid structure at position 1288 for language go
- how to add test binary flags
- Cannot run spec tests HOT 3
- No Tests Found HOT 2
- Neotest-go not compatible with Go provided via pkgx HOT 1
- cannot run unit tests HOT 1
- neotest-go adapter being used for typescript files when repo has both typescript and go HOT 1
- Feat - Add Support for Nested Subtests
- Error with Neotest-go, subtests and skipping them. HOT 6
- "Run nearest" runs all tests HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neotest-go.