Module: RSpecTracer
- Extended by:
- Configuration
- Defined in:
- lib/rspec_tracer.rb,
lib/rspec_tracer/cache.rb,
lib/rspec_tracer/filter.rb,
lib/rspec_tracer/logger.rb,
lib/rspec_tracer/runner.rb,
lib/rspec_tracer/example.rb,
lib/rspec_tracer/version.rb,
lib/rspec_tracer/reporter.rb,
lib/rspec_tracer/source_file.rb,
lib/rspec_tracer/rspec_runner.rb,
lib/rspec_tracer/configuration.rb,
lib/rspec_tracer/report_merger.rb,
lib/rspec_tracer/report_writer.rb,
lib/rspec_tracer/ruby_coverage.rb,
lib/rspec_tracer/rspec_reporter.rb,
lib/rspec_tracer/time_formatter.rb,
lib/rspec_tracer/coverage_merger.rb,
lib/rspec_tracer/coverage_writer.rb,
lib/rspec_tracer/remote_cache/aws.rb,
lib/rspec_tracer/report_generator.rb,
lib/rspec_tracer/coverage_reporter.rb,
lib/rspec_tracer/remote_cache/repo.rb,
lib/rspec_tracer/remote_cache/cache.rb,
lib/rspec_tracer/html_reporter/reporter.rb,
lib/rspec_tracer/remote_cache/validator.rb
Defined Under Namespace
Modules: Configuration, Example, HTMLReporter, RSpecReporter, RSpecRunner, RemoteCache, RubyCoverage, SourceFile, TimeFormatter
Classes: ArrayFilter, BlockFilter, Cache, CoverageMerger, CoverageReporter, CoverageWriter, Filter, Logger, RegexFilter, ReportGenerator, ReportMerger, ReportWriter, Reporter, Runner, StringFilter
Constant Summary
collapse
- VERSION =
'1.1.0'
Configuration::ALLOWED_CONFIGURER, Configuration::DEFAULT_CACHE_DIR, Configuration::DEFAULT_COVERAGE_DIR, Configuration::DEFAULT_LOCK_FILE, Configuration::DEFAULT_REPORT_DIR, Configuration::LOG_LEVEL
Class Attribute Summary collapse
Class Method Summary
collapse
configure
Class Attribute Details
.duplicate_examples ⇒ Object
Returns the value of attribute duplicate_examples.
34
35
36
|
# File 'lib/rspec_tracer.rb', line 34
def duplicate_examples
@duplicate_examples
end
|
.no_examples ⇒ Object
Returns the value of attribute no_examples.
34
35
36
|
# File 'lib/rspec_tracer.rb', line 34
def no_examples
@no_examples
end
|
.pid ⇒ Object
Returns the value of attribute pid.
34
35
36
|
# File 'lib/rspec_tracer.rb', line 34
def pid
@pid
end
|
.running ⇒ Object
Returns the value of attribute running.
34
35
36
|
# File 'lib/rspec_tracer.rb', line 34
def running
@running
end
|
Class Method Details
.at_exit_behavior ⇒ Object
rubocop:enable Metrics/AbcSize
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/rspec_tracer.rb', line 80
def at_exit_behavior
return unless RSpecTracer.pid == Process.pid && RSpecTracer.running
::Kernel.exit(1) if duplicate_examples
run_exit_tasks
ensure
FileUtils.rm_f(RSpecTracer.lock_file) if parallel_tests_last_process?
RSpecTracer.running = false
end
|
.coverage_merger ⇒ Object
115
116
117
|
# File 'lib/rspec_tracer.rb', line 115
def coverage_merger
@coverage_merger if defined?(@coverage_merger)
end
|
.coverage_reporter ⇒ Object
107
108
109
|
# File 'lib/rspec_tracer.rb', line 107
def coverage_reporter
@coverage_reporter if defined?(@coverage_reporter)
end
|
.examples_traced_files ⇒ Object
131
132
133
|
# File 'lib/rspec_tracer.rb', line 131
def examples_traced_files
@examples_traced_files if defined?(@examples_traced_files)
end
|
.filter_examples ⇒ Object
rubocop:disable Metrics/AbcSize
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/rspec_tracer.rb', line 49
def filter_examples
groups = Set.new
to_run = Hash.new { |hash, group| hash[group] = [] }
RSpec.world.filtered_examples.each_pair do |example_group, examples|
examples.each do |example|
tracer_example = RSpecTracer::Example.from(example)
example_id = tracer_example[:example_id]
example.metadata[:rspec_tracer_example_id] = example_id
if runner.run_example?(example_id)
run_reason = runner.run_example_reason(example_id)
tracer_example[:run_reason] = run_reason
example.metadata[:description] = "#{example.description} (#{run_reason})"
to_run[example_group] << example
groups << example.example_group.parent_groups.last
runner.register_example(tracer_example)
else
runner.on_example_skipped(example_id)
end
end
end
runner.deregister_duplicate_examples
[to_run, groups.to_a]
end
|
.parallel_tests? ⇒ Boolean
139
140
141
|
# File 'lib/rspec_tracer.rb', line 139
def parallel_tests?
defined?(@parallel_tests) && @parallel_tests == true
end
|
.report_merger ⇒ Object
119
120
121
|
# File 'lib/rspec_tracer.rb', line 119
def report_merger
@report_merger if defined?(@report_merger)
end
|
.report_writer ⇒ Object
111
112
113
|
# File 'lib/rspec_tracer.rb', line 111
def report_writer
@report_writer if defined?(@report_writer)
end
|
.runner ⇒ Object
103
104
105
|
# File 'lib/rspec_tracer.rb', line 103
def runner
@runner if defined?(@runner)
end
|
.simplecov? ⇒ Boolean
135
136
137
|
# File 'lib/rspec_tracer.rb', line 135
def simplecov?
defined?(@simplecov) && @simplecov == true
end
|
.start ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/rspec_tracer.rb', line 36
def start
RSpecTracer.running = false
RSpecTracer.pid = Process.pid
return if RUBY_ENGINE == 'jruby' && !valid_jruby_opts?
RSpecTracer.logger.debug "Started RSpec tracer (pid: #{RSpecTracer.pid})"
parallel_tests_setup
initial_setup
end
|
.start_example_trace ⇒ Object
92
93
94
|
# File 'lib/rspec_tracer.rb', line 92
def start_example_trace
trace_point.enable
end
|
.stop_example_trace(example_id) ⇒ Object
96
97
98
99
100
101
|
# File 'lib/rspec_tracer.rb', line 96
def stop_example_trace(example_id)
trace_point.disable
@examples_traced_files[example_id] = @traced_files
@traced_files = Set.new
end
|
.trace_point ⇒ Object
123
124
125
|
# File 'lib/rspec_tracer.rb', line 123
def trace_point
@trace_point if defined?(@trace_point)
end
|
.traced_files ⇒ Object
127
128
129
|
# File 'lib/rspec_tracer.rb', line 127
def traced_files
@traced_files if defined?(@traced_files)
end
|