Skip to content

Use new addon name in addon settings documentation #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ All configuration options must be nested under the `Ruby LSP RSpec` addon within
{
// ...
"rubyLsp.addonSettings": {
"Ruby LSP RSpec": {
"ruby-lsp-rspec": {
// Configuration options go here
}
}
Expand All @@ -87,7 +87,7 @@ Customize the command used to run tests via CodeLens. If not set, the command wi
{
// ...
"rubyLsp.addonSettings": {
"Ruby LSP RSpec": {
"ruby-lsp-rspec": {
"rspecCommand": "rspec -f d"
}
}
Expand All @@ -107,7 +107,7 @@ Enable debug logging. Currently, this only logs the RSpec command used by CodeLe
```json
{
"rubyLsp.addonSettings": {
"Ruby LSP RSpec": {
"ruby-lsp-rspec": {
"debug": true
}
}
Expand Down
14 changes: 11 additions & 3 deletions lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
# frozen_string_literal: true

require "rspec/core/formatters"
require "rspec/core/formatters/progress_formatter"
require "ruby_lsp/test_reporters/lsp_reporter"

module RubyLsp
module RSpec
class RSpecFormatter
class RSpecFormatter < ::RSpec::Core::Formatters::ProgressFormatter
::RSpec::Core::Formatters.register(
self,
:example_passed,
:example_pending,
:example_failed,
:example_started,
:start_dump,
:stop,
)

def initialize(output)
@output = output
super(output)
end

def example_started(notification)
Expand All @@ -29,20 +31,26 @@ def example_started(notification)
end

def example_passed(notification)
super(notification)

example = notification.example
uri = uri_for(example)
id = generate_id(example)
RubyLsp::LspReporter.instance.record_pass(id: id, uri: uri)
end

def example_failed(notification)
super(notification)

example = notification.example
uri = uri_for(example)
id = generate_id(example)
RubyLsp::LspReporter.instance.record_fail(id: id, message: notification.exception.message, uri: uri)
end

def example_pending(notification)
super(notification)

example = notification.example
uri = uri_for(example)
id = generate_id(example)
Expand All @@ -63,4 +71,4 @@ def generate_id(example)
end
end
end
end
end
Loading