Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vstest integration #124

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f860066
initial commit
Nsidorenco Sep 25, 2024
4dbac4f
fix tests
Nsidorenco Sep 25, 2024
0ebd107
add xunit fact queries
Nsidorenco Sep 26, 2024
d7821c5
add xunit test
Nsidorenco Sep 29, 2024
453e677
add nunit
Nsidorenco Sep 29, 2024
1175b13
add nunit support
Nsidorenco Oct 1, 2024
3ed8003
feat: test discovery
Nsidorenco Nov 9, 2024
2dfa5b3
feat: test runner
Nsidorenco Nov 9, 2024
2c363c8
cleanup
Nsidorenco Nov 9, 2024
913e4bc
improve test discovery
Nsidorenco Nov 9, 2024
2c47046
improve test_spec
Nsidorenco Nov 10, 2024
253e225
feat: dap strategy
Nsidorenco Nov 10, 2024
10705b3
improve detection
Nsidorenco Nov 10, 2024
b7bcb69
feat: csharp
Nsidorenco Nov 10, 2024
b3b1c65
test discovery caching
Nsidorenco Nov 11, 2024
c8d558c
vstest path detection
Nsidorenco Nov 11, 2024
025d7da
clean up
Nsidorenco Nov 11, 2024
0dc31d9
improve detection stability
Nsidorenco Nov 12, 2024
145eede
improve test file filtering
Nsidorenco Nov 12, 2024
4b555f0
concurrent test discovery
Nsidorenco Nov 12, 2024
5741e15
remove unused test case fields
Nsidorenco Nov 13, 2024
ad180ed
discovery all projects at once
Nsidorenco Nov 13, 2024
bea87f9
handle running directories
Nsidorenco Nov 14, 2024
90485b4
remove old tests
Nsidorenco Nov 15, 2024
efb9e33
handle roll forward dotnet versions
Nsidorenco Nov 20, 2024
dd15f3d
simplify id collection
Nsidorenco Nov 20, 2024
5aaabc5
clean up
Nsidorenco Nov 23, 2024
8b3f6d7
improve position detection
Nsidorenco Nov 24, 2024
109dd72
improve dap strategy
Nsidorenco Nov 26, 2024
c5c6e10
Add testing
Nsidorenco Dec 2, 2024
543ac69
improve scripts detection
Nsidorenco Dec 4, 2024
682cc94
improve scripts detection
Nsidorenco Dec 4, 2024
135ee32
allow using vstest.console.exe on windows
Nsidorenco Dec 4, 2024
1e95b39
clean up in file reading code
Nsidorenco Dec 4, 2024
827a21f
fix path detection on windows
Nsidorenco Dec 7, 2024
05d7eda
update readme
Nsidorenco Dec 22, 2024
2506790
Merge branch 'main' into test-runner
Issafalcon Dec 27, 2024
294d894
feat: nesting of parameterized test cases
Nsidorenco Dec 28, 2024
a43e352
use custom neotest strategy
Nsidorenco Dec 28, 2024
c2bad80
feat: use msbuild to find dll path
Nsidorenco Jan 11, 2025
19f8ec9
update CI
Nsidorenco Jan 18, 2025
ee0f925
improve results reporting
Nsidorenco Jan 18, 2025
d125374
use $TargetPath over $OutputPath
Nsidorenco Jan 20, 2025
e416cae
fix nightly CI
Nsidorenco Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
Nsidorenco committed Dec 4, 2024

Verified

This commit was signed with the committer’s verified signature.
Sebobo Sebastian Helzle
commit 4dbac4f7de76a5702e0f60a9a24709ed2ff4144d
6 changes: 3 additions & 3 deletions lua/neotest-dotnet/framework-discovery.lua
Original file line number Diff line number Diff line change
@@ -110,10 +110,10 @@ function M.get_test_framework_utils_from_source(lang, source, custom_attribute_a
local parsed_query = vim.fn.has("nvim-0.9.0") == 1
and vim.treesitter.query.parse(lang, framework_query)
or vim.treesitter.parse_query(lang, framework_query)
for _, captures in parsed_query:iter_matches(root, source) do
for _, node, _, _ in parsed_query:iter_captures(root, source) do
local test_attribute = vim.fn.has("nvim-0.9.0") == 1
and vim.treesitter.get_node_text(captures[1], source)
or vim.treesitter.query.get_node_text(captures[1], source)
and vim.treesitter.get_node_text(node, source)
or vim.treesitter.query.get_node_text(node, source)
if test_attribute then
if
string.find(xunit_attributes, test_attribute)
55 changes: 25 additions & 30 deletions lua/neotest-dotnet/init.lua
Original file line number Diff line number Diff line change
@@ -61,8 +61,10 @@ DotnetNeotestAdapter._build_position = function(...)
logger.debug("neotest-dotnet: Buil Position Args: ")
logger.debug(args)

local lang = lib.files.match_root_pattern("*.fsproj")(args[1]) and "fsharp" or "c_sharp"

local framework =
FrameworkDiscovery.get_test_framework_utils_from_source(args[2], custom_attribute_args) -- args[2] is the content of the file
FrameworkDiscovery.get_test_framework_utils_from_source(lang, args[2], custom_attribute_args) -- args[2] is the content of the file

logger.debug("neotest-dotnet: Framework: ")
logger.debug(framework)
@@ -80,41 +82,34 @@ end
---@param path any The path to the file to discover positions in
---@return neotest.Tree
DotnetNeotestAdapter.discover_positions = function(path)
local lang = nil

if lib.files.match_root_pattern("*.fsproj")(path) then
lang = "fsharp"
else
lang = "c_sharp"
end
local lang = lib.files.match_root_pattern("*.fsproj")(path) and "fsharp" or "c_sharp"

local content = lib.files.read(path)
local test_framework =
FrameworkDiscovery.get_test_framework_utils_from_source(lang, content, custom_attribute_args)
local framework_queries = test_framework.get_treesitter_queries(lang, custom_attribute_args)

-- local query = [[
-- ;; --Namespaces
-- ;; Matches namespace with a '.' in the name
-- (namespace_declaration
-- name: (qualified_name) @namespace.name
-- ) @namespace.definition
--
-- ;; Matches namespace with a single identifier (no '.')
-- (namespace_declaration
-- name: (identifier) @namespace.name
-- ) @namespace.definition
--
-- ;; Matches file-scoped namespaces (qualified and unqualified respectively)
-- (file_scoped_namespace_declaration
-- name: (qualified_name) @namespace.name
-- ) @namespace.definition
--
-- (file_scoped_namespace_declaration
-- name: (identifier) @namespace.name
-- ) @namespace.definition
-- ]] .. framework_queries
local query = framework_queries
local query = [[
;; --Namespaces
;; Matches namespace with a '.' in the name
(namespace_declaration
name: (qualified_name) @namespace.name
) @namespace.definition

;; Matches namespace with a single identifier (no '.')
(namespace_declaration
name: (identifier) @namespace.name
) @namespace.definition

;; Matches file-scoped namespaces (qualified and unqualified respectively)
(file_scoped_namespace_declaration
name: (qualified_name) @namespace.name
) @namespace.definition

(file_scoped_namespace_declaration
name: (identifier) @namespace.name
) @namespace.definition
]] .. framework_queries

local tree = lib.treesitter.parse_positions(path, query, {
nested_namespaces = true,