File tree 4 files changed +60
-0
lines changed
4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ return {
38
38
ROOT = {' ./test/integration/' },
39
39
pattern = ' ' , -- No fancy pattern for integration tests
40
40
},
41
+ e2e = {
42
+ ROOT = {' ./test/e2e/' },
43
+ pattern = ' ' ,
44
+ }
41
45
}
42
46
43
47
-- vim:ft=lua
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ unit-test:
33
33
integration-test :
34
34
@./test/bin/busted --run integration
35
35
36
+ end-to-end-test :
37
+ @./test/bin/nvim --headless -c " set loadplugins" -c " luafile ./scripts/e2e.lua"
38
+
36
39
test : unit-test integration-test
37
40
38
41
clean :
Original file line number Diff line number Diff line change
1
+ vim .cmd (" edit .busted" )
2
+ vim .secure .trust ({
3
+ action = " allow" ,
4
+ bufnr = 0 ,
5
+ })
6
+
7
+ local neotest = require (" neotest" )
8
+ local nb = require (" lua.neotest-busted" )
9
+
10
+ local function consumer (client )
11
+ client .listeners .results = function (_ , results , partial )
12
+ if partial == false then
13
+ local has_errors = false
14
+ for _ , result in pairs (results ) do
15
+ for _ , e in ipairs (result .errors or {}) do
16
+ has_errors = true
17
+ io.stdout :write (e .message .. " \n\n " )
18
+ end
19
+ end
20
+ if has_errors then
21
+ vim .cmd (" cq!" )
22
+ end
23
+ io.stdout :write (" All e2e tests passed!\n\n " )
24
+ vim .cmd (" qa!" )
25
+ end
26
+ end
27
+ end
28
+ neotest .setup ({ adapters = { nb }, consumers = { consumer } })
29
+ neotest .run .run (" ./test/e2e/" )
Original file line number Diff line number Diff line change
1
+ -- NOTE: tests tests should be run from within Neovim to make sure the plugin
2
+ -- can handle text output from within a test. Ideally this should be run as an
3
+ -- end-to-end test, but I cannot figure out how to write these because Neotest
4
+ -- runs everything asynchronously.
5
+
6
+ local output_handler = require ' neotest-busted._output-handler'
7
+
8
+ describe (' Test which write to standard output' , function ()
9
+
10
+ it (' Has an explicit line break' , function ()
11
+ print (' Some text written to standard output\n ' )
12
+ assert .is_true (true )
13
+ end )
14
+
15
+ it (' Has no explicit line break' , function ()
16
+ print (' Some text written to standard output' )
17
+ assert .is_true (true )
18
+ end )
19
+
20
+ it (' Contains the result marker from the output handler' , function ()
21
+ print (string.format (' %sThis could trip us up' , output_handler .marker ))
22
+ assert .is_true (true )
23
+ end )
24
+ end )
You can’t perform that action at this time.
0 commit comments