File tree 3 files changed +26
-0
lines changed
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,16 @@ require("neotest-phpunit")({
108
108
})
109
109
```
110
110
111
+ If there are projects you don't want discovered, you can instead set ` root_ignore_files ` to ignore any matching projects.
112
+
113
+ For example, if your project uses Pest and the appropriate [ neotest adapter] ( https://github.com/V13Axel/neotest-pest ) , you'll need to set:
114
+
115
+ ``` lua
116
+ require (" neotest-phpunit" )({
117
+ root_ignore_files = { " tests/Pest.php" }
118
+ })
119
+ ```
120
+
111
121
### Filtering directories
112
122
113
123
By default, the adapter will search test files in all dirs in the root with the exception of ` node_modules ` and ` .git ` . You can change this with:
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ M.get_env = function()
8
8
return {}
9
9
end
10
10
11
+ M .get_root_ignore_files = function ()
12
+ return {}
13
+ end
14
+
11
15
M .get_root_files = function ()
12
16
return { " composer.json" , " phpunit.xml" , " .gitignore" }
13
17
end
Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ local NeotestAdapter = { name = "neotest-phpunit" }
59
59
function NeotestAdapter .root (dir )
60
60
local result = nil
61
61
62
+ for _ , root_ignore_file in ipairs (config .get_root_ignore_files ()) do
63
+ result = lib .files .match_root_pattern (root_ignore_file )(dir )
64
+ if result then return nil end
65
+ end
66
+
62
67
for _ , root_file in ipairs (config .get_root_files ()) do
63
68
result = lib .files .match_root_pattern (root_file )(dir )
64
69
if result then break end
@@ -198,6 +203,13 @@ setmetatable(NeotestAdapter, {
198
203
return opts .phpunit_cmd
199
204
end
200
205
end
206
+ if is_callable (opts .root_ignore_files ) then
207
+ config .get_root_ignore_files = opts .root_ignore_files
208
+ elseif opts .root_ignore_files then
209
+ config .get_root_ignore_files = function ()
210
+ return opts .root_ignore_files
211
+ end
212
+ end
201
213
if is_callable (opts .root_files ) then
202
214
config .get_root_files = opts .root_files
203
215
elseif opts .root_files then
You can’t perform that action at this time.
0 commit comments