diff --git a/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb b/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb index 15a0dfe..959675d 100644 --- a/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb +++ b/lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb @@ -80,7 +80,7 @@ def generate_id(example) def adjust_backtrace(backtrace) # Correct the backtrace entry so that vscode recognized it as a link to open parts = backtrace.split(":", 3) - parts[0].sub(/^\./, "file://" + File.expand_path(".")) + ":" + parts[1] + " : " + parts[2] + parts[0].sub(/^\./, "file://" + File.expand_path(".")) + ":" + parts[1] + " : " + (parts[2] || "") end end end diff --git a/spec/fixtures/rspec_example_spec.rb b/spec/fixtures/rspec_example_spec.rb index 5aa6670..46b5e03 100644 --- a/spec/fixtures/rspec_example_spec.rb +++ b/spec/fixtures/rspec_example_spec.rb @@ -30,5 +30,9 @@ it "raises an error" do raise "oops" end + it "is pending but fixed" do + pending + expect { raise "error" }.to raise_error + end end end diff --git a/spec/rspec_formatter_spec.rb b/spec/rspec_formatter_spec.rb index ee08065..010986b 100644 --- a/spec/rspec_formatter_spec.rb +++ b/spec/rspec_formatter_spec.rb @@ -132,6 +132,22 @@ "uri" => "file://#{fixture_path}", }, }, + { + "method" => "start", + "params" => { + "id" => "./spec/fixtures/rspec_example_spec.rb:11::./spec/fixtures/rspec_example_spec.rb:12::./spec/fixtures/rspec_example_spec.rb:33", + "line" => "33", + "uri" => "file://#{fixture_path}", + }, + }, + { + "method" => "fail", + "params" => { + "id" => "./spec/fixtures/rspec_example_spec.rb:11::./spec/fixtures/rspec_example_spec.rb:12::./spec/fixtures/rspec_example_spec.rb:33", + "message" => "Expected pending 'No reason given' to fail. No error was raised.\n\n# file://#{fixture_path}:33 : ", + "uri" => "file://#{fixture_path}", + }, + }, { "method" => "finish", "params" => {} }, ]