-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82af8c0
commit 9293f09
Showing
4 changed files
with
137 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
local nio = require("nio") | ||
local lib = require("neotest.lib") | ||
local vstest = require("neotest-dotnet.vstest_wrapper") | ||
|
||
---@async | ||
---@param spec neotest.RunSpec | ||
---@return neotest.Process | ||
return function(spec) | ||
local process_output = nio.fn.tempname() | ||
lib.files.write(process_output, "") | ||
|
||
local wait_file = vstest.run_tests( | ||
spec.context.stream_path, | ||
spec.context.result_path, | ||
process_output, | ||
spec.context.ids | ||
) | ||
|
||
local result_future = nio.control.future() | ||
|
||
nio.run(function() | ||
vstest.spin_lock_wait_file(wait_file, 5 * 30 * 1000) | ||
result_future:set() | ||
end) | ||
|
||
local stream_data, stop_stream = lib.files.stream_lines(process_output) | ||
|
||
return { | ||
is_complete = function() | ||
return result_future.is_set() | ||
end, | ||
output = function() | ||
return process_output | ||
end, | ||
stop = function() | ||
stop_stream() | ||
end, | ||
output_stream = function() | ||
return function() | ||
local lines = stream_data() | ||
return table.concat(lines, "\n") | ||
end | ||
end, | ||
attach = function() end, | ||
result = function() | ||
result_future:wait() | ||
return 1 | ||
end, | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters