-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prototyping for custom test reporter [skip ci]
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Minitest | ||
module Reporters | ||
class RubyLspReporter < BaseReporter | ||
def initialize(options = {}) | ||
# TODO | ||
super | ||
end | ||
|
||
def start | ||
# TODO | ||
super | ||
end | ||
|
||
def before_test(test) | ||
# TODO | ||
super | ||
end | ||
|
||
def record(test) | ||
result = { | ||
classname: test.klass, | ||
file: test.source_location[0], | ||
line: test.source_location[1], | ||
time: test.time, | ||
} | ||
if (failure = test.failure) | ||
result[:failure] = { | ||
type: failure.class.name, | ||
message: failure.message, # TODO: truncate? | ||
} | ||
end | ||
|
||
if test.skipped? | ||
result[:skipped] = { | ||
message: "TODO: skip reason", | ||
} | ||
end | ||
|
||
puts result.to_json | ||
# TODO: flush IO after each? | ||
|
||
super # need? | ||
end | ||
|
||
def report | ||
# TODO | ||
super | ||
end | ||
end | ||
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