Skip to content

Commit 2267c7d

Browse files
committed
ci: exclude test files from enumeration
Now we can add more test/screenshots without having to modify all previous screenshots total number of files.
1 parent fbb1d64 commit 2267c7d

21 files changed

Lines changed: 102 additions & 95 deletions

tests/api_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ T["api"]["fzf_exec"]["function"] = new_set({ parametrize = { { "sync" }, { "asyn
5252
T["api"]["fzf_exec"]["rg"] = new_set({ parametrize = { { true }, { false }, { 1 } } }, {
5353
function(multiprocess)
5454
helpers.FzfLua.fzf_exec(child,
55-
[['rg --files -g "!.git" --sort=path']],
55+
[['rg --files -g !.git -g !tests/** --sort=path']],
5656
{
5757
__expect_lines = true,
5858
-- __postprocess_wait = multiprocess ~= 1,

tests/files_spec.lua

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ T["files"]["close|abort"] = new_set({ parametrize = { { "<esc>" }, { "<c-c>" } }
3232
previewer = false,
3333
cwd_prompt = false,
3434
multiprocess = true,
35-
cmd = "rg --files --sort=path",
35+
cmd = "rg --files --sort=path -g !tests/**",
3636
})
3737
end,
3838
})
@@ -47,7 +47,7 @@ T["files"]["multiprocess"] = new_set({ parametrize = { { false }, { true } } },
4747
previewer = false,
4848
cwd_prompt = false,
4949
multiprocess = multiprocess,
50-
cmd = "rg --files --sort=path",
50+
cmd = "rg --files --sort=path -g !tests/**",
5151
})
5252
end,
5353
})
@@ -66,12 +66,15 @@ T["files"]["previewer"]["builtin"] = new_set({ parametrize = { { "ci" }, { "buil
6666
end
6767
helpers.FzfLua.files(child, {
6868
__expect_lines = true,
69+
__screen_opts = helpers.IS_WIN()
70+
-- Ignore debug command due to ^! escape sequence on Win
71+
and { ignore_text = { 6, 28 }, normalize_paths = true } or nil,
6972
debug = 1,
7073
hidden = false,
7174
file_icons = icons,
7275
cwd_prompt = false,
7376
multiprocess = true,
74-
cmd = "rg --files --sort=path",
77+
cmd = "rg --files --sort=path -g !tests/**",
7578
winopts = { preview = { scrollbar = false } },
7679
previewer = previewer == "builtin"
7780
and "builtin"
@@ -107,7 +110,7 @@ T["files"]["icons"]["defaults"] = new_set({ parametrize = { { "+attrs" }, { "-at
107110
previewer = false,
108111
cwd_prompt = false,
109112
file_icons = icons,
110-
cmd = "rg --files --sort=path",
113+
cmd = "rg --files --sort=path -g !tests/**",
111114
})
112115
end,
113116
})
@@ -119,17 +122,18 @@ T["files"]["executable"] = new_set({ parametrize = { { "fd" }, { "rg" }, { "find
119122
local opts, exclude
120123
if exec == "fd" then
121124
exclude = "{}"
122-
opts = { fd_opts = "--color=never --type f --type l --exclude .git | sort" }
125+
opts = {
126+
fd_opts = "--color=never --type f --type l --exclude .git --exclude tests | sort" }
123127
elseif exec == "rg" then
124128
exclude = [[{ "fd", "fdfind" }]]
125-
opts = { rg_opts = '--files -g "!.git" --sort=path' }
129+
opts = { rg_opts = '--files -g "!.git" --sort=path -g !tests/**' }
126130
else
127131
exclude = [[{ "fd", "fdfind", "rg" }]]
128132
opts = {
129133
find_opts =
130-
[[-type f \! -path '*/.git/*' \! -path '*/doc/tags' \! -path '*/deps/*' | sort]],
134+
[[-type f \! -path '*/.git/*' \! -path '*/doc/tags' \! -path '*/deps/*' ! -path '*/tests/*'| sort]],
131135
dir_opts =
132-
[[/s/b/a:-d | findstr -v "\.git\\" | findstr -v "doc\\tags" | findstr -v "deps" | sort]],
136+
[[/s/b/a:-d | findstr -v "\.git\\" | findstr -v "doc\\tags" | findstr -v "deps" | findstr -v "tests" | sort]],
133137
strip_cwd_prefix = true
134138
}
135139
end
@@ -160,17 +164,20 @@ T["files"]["executable"] = new_set({ parametrize = { { "fd" }, { "rg" }, { "find
160164
T["files"]["preview should work after chdir #1864"] = function()
161165
-- Ignore last "-- TERMINAL --" line and "[DEBUG]" line containing the cmd
162166
local screen_opts = { ignore_text = { 6, 28 }, normalize_paths = helpers.IS_WIN() }
163-
eq(child.lua_get([[_G._fzf_lua_on_create]]), vim.NIL)
164-
child.lua([[FzfLua.files {
167+
helpers.FzfLua.files(child, {
168+
__expect_lines = true,
169+
__screen_opts = screen_opts,
170+
cmd = "rg --files --sort=path -g !tests/**",
171+
hidden = false,
165172
cwd_prompt = false,
166-
previewer = 'builtin',
167-
winopts = { preview = { hidden = false } }
168-
}]])
169-
child.wait_until(function() return child.lua_get([[_G._fzf_load_called]]) == true end)
170-
child.lua([[vim.cmd.cd("./tests")]])
171-
child.type_keys([[<c-n>]])
172-
sleep(100)
173-
child.expect_screen_lines(screen_opts)
173+
previewer = "builtin",
174+
winopts = { preview = { hidden = false } },
175+
__after_open = function()
176+
child.lua([[vim.cmd.cd("./tests")]])
177+
child.type_keys([[<c-n>]])
178+
sleep(100)
179+
end
180+
})
174181
end
175182

176183
return T

tests/screenshots/tests-api_spec.lua---api---fzf_exec---rg---1-+-args-{-1-}

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
01|
33
02|~
44
03|~ ╭─────────────────────────────────────────────────╮
5-
04|~ │> 133/133
5+
04|~ │> 82/82
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ LICENSE ││
8-
07|~ │ Makefile
9-
08|~ │ OPTIONS.md
8+
07|~ │ Makefile
9+
08|~ │ OPTIONS.md
1010
09|~ │ README-Win.md │
1111
10|~ │ README.md │
1212
11|~ │ autoload/fzf_lua.vim │

tests/screenshots/tests-api_spec.lua---api---fzf_exec---rg---1-+-args-{-false-}

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
01|
33
02|~
44
03|~ ╭─────────────────────────────────────────────────╮
5-
04|~ │> 134/134
5+
04|~ │> 83/83
66
05|~ │──────────────────────────────────────────────── │
7-
06|~ │▌ [DEBUG] [st] rg --files -g "!.git" --sort=path││
8-
07|~ │ LICENSE
9-
08|~ │ Makefile
7+
06|~ │▌ [DEBUG] [st] rg --files -g !.git -g !tests/*··││
8+
07|~ │ LICENSE
9+
08|~ │ Makefile
1010
09|~ │ OPTIONS.md │
1111
10|~ │ README-Win.md │
1212
11|~ │ README.md │

tests/screenshots/tests-api_spec.lua---api---fzf_exec---rg---1-+-args-{-true-}

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
01|
33
02|~
44
03|~ ╭─────────────────────────────────────────────────╮
5-
04|~ │> 134/134
5+
04|~ │> 83/83
66
05|~ │──────────────────────────────────────────────── │
7-
06|~ │▌ [DEBUG] [mt] rg --files -g "!.git" --sort=path││
8-
07|~ │ LICENSE
9-
08|~ │ Makefile
7+
06|~ │▌ [DEBUG] [mt] rg --files -g !.git -g !tests/*··││
8+
07|~ │ LICENSE
9+
08|~ │ Makefile
1010
09|~ │ OPTIONS.md │
1111
10|~ │ README-Win.md │
1212
11|~ │ README.md │

tests/screenshots/tests-files_spec.lua---files---close-abort---1-+-args-{-'-c-c-'-}

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
01|
33
02|~
44
03|~ ╭───────────────────── Files ─────────────────────╮
5-
04|~ │> 134/134 (0) │
5+
04|~ │> 83/83 (0) │
66
05|~ │──────────────────────────────────────────────── │
7-
06|~ │▌ [DEBUG] [mt] rg --files --sort=path ││
8-
07|~ │ LICENSE
9-
08|~ │ Makefile
7+
06|~ │▌ [DEBUG] [mt] rg --files --sort=path -g !test··││
8+
07|~ │ LICENSE
9+
08|~ │ Makefile
1010
09|~ │ OPTIONS.md │
1111
10|~ │ README-Win.md │
1212
11|~ │ README.md │

tests/screenshots/tests-files_spec.lua---files---close-abort---1-+-args-{-'-esc-'-}

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
01|
33
02|~
44
03|~ ╭───────────────────── Files ─────────────────────╮
5-
04|~ │> 134/134 (0) │
5+
04|~ │> 83/83 (0) │
66
05|~ │──────────────────────────────────────────────── │
7-
06|~ │▌ [DEBUG] [mt] rg --files --sort=path ││
8-
07|~ │ LICENSE
9-
08|~ │ Makefile
7+
06|~ │▌ [DEBUG] [mt] rg --files --sort=path -g !test··││
8+
07|~ │ LICENSE
9+
08|~ │ Makefile
1010
09|~ │ OPTIONS.md │
1111
10|~ │ README-Win.md │
1212
11|~ │ README.md │

tests/screenshots/tests-files_spec.lua---files---executable---1-+-args-{-'fd'-}

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
01|
33
02|~
44
03|~ ╭─────────────────── Files h ────────────────────╮
5-
04|~ │> 146/146 (0) │
5+
04|~ │> 95/95 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] fd --hidden --color=never --typ··││
8-
07|~ │ .editorconfig
8+
07|~ │ .editorconfig
99
08|~ │ .github/ISSUE_TEMPLATE/bug.yaml │
1010
09|~ │ .github/ISSUE_TEMPLATE/config.yml │
1111
10|~ │ .github/ISSUE_TEMPLATE/feature.yaml │

tests/screenshots/tests-files_spec.lua---files---executable---1-+-args-{-'find-dir'-}

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
01|
33
02|~
44
03|~ ╭───────────────────── Files ─────────────────────╮
5-
04|~ │> 146/146 (0) │
5+
04|~ │> 95/95 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] find . -type f \! -path '*/.git··││
8-
07|~ │ .editorconfig
8+
07|~ │ .editorconfig
99
08|~ │ .github/ISSUE_TEMPLATE/bug.yaml │
1010
09|~ │ .github/ISSUE_TEMPLATE/config.yml │
1111
10|~ │ .github/ISSUE_TEMPLATE/feature.yaml │

tests/screenshots/tests-files_spec.lua---files---executable---1-+-args-{-'rg'-}

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
01|
33
02|~
44
03|~ ╭─────────────────── Files h ────────────────────╮
5-
04|~ │> 146/146 (0) │
5+
04|~ │> 95/95 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] rg --hidden --files -g "!.git" ··││
8-
07|~ │ .editorconfig
8+
07|~ │ .editorconfig
99
08|~ │ .github/ISSUE_TEMPLATE/bug.yaml │
1010
09|~ │ .github/ISSUE_TEMPLATE/config.yml │
1111
10|~ │ .github/ISSUE_TEMPLATE/feature.yaml │

0 commit comments

Comments
 (0)