-
Notifications
You must be signed in to change notification settings - Fork 182
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
- Loading branch information
Showing
3 changed files
with
60 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,53 @@ | ||
# 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 | ||
|
||
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