forked from Shopify/ruby-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_helper.rb
59 lines (46 loc) · 1.54 KB
/
test_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# typed: strict
# frozen_string_literal: true
require "sorbet-runtime"
ENV["RUBY_LSP_ENV"] = "test"
if ENV["COVERAGE"]
require "simplecov"
SimpleCov.start do
T.bind(self, SimpleCov::Configuration)
enable_coverage :branch
end
end
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
$VERBOSE = nil unless ENV["VERBOSE"] || ENV["CI"]
require "ruby_lsp/internal"
require "ruby_lsp/test_helper"
require "rubocop/cop/ruby_lsp/use_language_server_aliases"
require "rubocop/cop/ruby_lsp/use_register_with_handler_method"
require "minitest/autorun"
require "minitest/reporters"
require "tempfile"
require "mocha/minitest"
SORBET_PATHS = T.let(Gem.loaded_specs["sorbet-runtime"].full_require_paths.freeze, T::Array[String])
# Define breakpoint methods without actually activating the debugger
require "debug/prelude"
# Load the debugger configuration to skip Sorbet paths. But this still doesn't activate the debugger
require "debug/config"
DEBUGGER__::CONFIG[:skip_path] = Array(DEBUGGER__::CONFIG[:skip_path]) + SORBET_PATHS
minitest_reporter = if ENV["SPEC_REPORTER"]
Minitest::Reporters::SpecReporter.new(color: true)
else
Minitest::Reporters::DefaultReporter.new(color: true)
end
Minitest::Reporters.use!(minitest_reporter)
module Minitest
class Test
extend T::Sig
include RubyLsp::TestHelper
Minitest::Test.make_my_diffs_pretty!
end
end
begin
require "spoom/backtrace_filter/minitest"
Minitest.backtrace_filter = Spoom::BacktraceFilter::Minitest.new
rescue LoadError
# Tapioca (and thus Spoom) is not available on Windows
end