@@ -55,6 +55,31 @@ describe("Test test detection", function()
5555 assert .are_same (expected_tests , tests )
5656 end )
5757
58+ nio .tests .it (" detect tests in subfolder of project" , function ()
59+ local test_file = solution_path
60+ .. " /src/FsharpTest/Subfolder/Subfolder2/Subfolder3/MoreTests.fs"
61+ local positions = plugin .discover_positions (test_file )
62+
63+ assert .is_not_nil (positions , " Positions should not be nil" )
64+
65+ local tests = {}
66+
67+ for _ , position in positions :iter () do
68+ if position .type == " test" then
69+ tests [# tests + 1 ] = position .name
70+ end
71+ end
72+
73+ local expected_tests = {
74+ " My test in subfolder" ,
75+ }
76+
77+ table.sort (expected_tests )
78+ table.sort (tests )
79+
80+ assert .are_same (expected_tests , tests )
81+ end )
82+
5883 nio .tests .it (" detect tests in fsharp file with many test cases" , function ()
5984 local test_file = solution_path .. " /src/FsharpTest/ManyTests.fs"
6085 local positions = plugin .discover_positions (test_file )
@@ -105,12 +130,29 @@ describe("Test test detection", function()
105130 assert .is_truthy (plugin .filter_dir (" CSharpTest" , " /src/CSharpTest" , solution_path ))
106131 end )
107132
133+ nio .tests .it (" not filter nested test directory" , function ()
134+ assert .is_truthy (
135+ plugin .filter_dir (
136+ " Subfolder3" ,
137+ " /src/FsharpTest/Subfolder/Subfolder2/Subfolder3" ,
138+ solution_path
139+ )
140+ )
141+ end )
142+
108143 nio .tests .it (" identify test file" , function ()
109144 local test_file = solution_path .. " /src/CSharpTest/UnitTest1.cs"
110145
111146 assert .is_truthy (plugin .is_test_file (test_file ))
112147 end )
113148
149+ nio .tests .it (" identify test file in subfolder" , function ()
150+ local test_file = solution_path
151+ .. " /src/FsharpTest/Subfolder/Subfolder2/Subfolder3/MoreTests.fs"
152+
153+ assert .is_truthy (plugin .is_test_file (test_file ))
154+ end )
155+
114156 nio .tests .it (" filter file in non-test project" , function ()
115157 local project_file = solution_path .. " /src/ConsoleApp/ConsoleApp.csproj"
116158
0 commit comments