Class: TLDR
- Inherits:
-
Object
- Object
- TLDR
- Includes:
- Assertions, Hooks, Skippable
- Defined in:
- lib/tldr/minitest_compatibility.rb,
lib/tldr.rb,
lib/tldr/rake.rb,
lib/tldr/error.rb,
lib/tldr/hooks.rb,
lib/tldr/runner.rb,
lib/tldr/planner.rb,
lib/tldr/version.rb,
lib/tldr/watcher.rb,
lib/tldr/executor.rb,
lib/tldr/path_util.rb,
lib/tldr/ruby_util.rb,
lib/tldr/skippable.rb,
lib/tldr/assertions.rb,
lib/tldr/class_util.rb,
lib/tldr/value/plan.rb,
lib/tldr/value/test.rb,
lib/tldr/argv_parser.rb,
lib/tldr/strategizer.rb,
lib/tldr/yaml_parser.rb,
lib/tldr/value/config.rb,
lib/tldr/reporters/base.rb,
lib/tldr/value/location.rb,
lib/tldr/value/wip_test.rb,
lib/tldr/backtrace_filter.rb,
lib/tldr/value/test_group.rb,
lib/tldr/parallel_controls.rb,
lib/tldr/reporters/default.rb,
lib/tldr/value/test_result.rb,
lib/tldr/argv_reconstructor.rb,
lib/tldr/sorbet_compatibility.rb
Overview
These methods are provided to support drop-in compatibility with Minitest. You can use them by mixing them into your test or into the ‘TLDR` base class itself:
class YourTest < TLDR
include TLDR::MinitestCompatibility
def test_something
# …
end
end
The implementation of these methods is extremely similar or identical to those found in minitest itself, which is Copyright © Ryan Davis, seattle.rb and distributed under the MIT License
Defined Under Namespace
Modules: Assertions, ClassUtil, Hooks, MinitestCompatibility, PathUtil, Reporters, RubyUtil, Run, Skippable Classes: ArgvParser, ArgvReconstructor, BacktraceFilter, Config, Error, Executor, Failure, Location, Plan, Planner, Runner, Skip, SorbetCompatibility, Strategizer, Task, Test, TestGroup, TestResult, WIPTest, Watcher, YamlParser
Constant Summary collapse
- VERSION =
"1.1.1"- CONFLAGS =
{ timeout: "--[no-]timeout", watch: "--watch", fail_fast: "--fail-fast", parallel: "--[no-]parallel", seed: "--seed", names: "--name", exclude_names: "--exclude-name", exclude_paths: "--exclude-path", helper_paths: "--helper", no_helper: "--no-helper", prepend_paths: "--prepend", no_prepend: "--no-prepend", load_paths: "--load-path", base_path: "--base-path", config_path: "--[no-]config", reporter: "--reporter", emoji: "--[no-]emoji", warnings: "--[no-]warnings", verbose: "--verbose", yes_i_know: "--yes-i-know", print_interrupted_test_backtraces: "--print-interrupted-test-backtraces", i_am_being_watched: "--i-am-being-watched", exit_0_on_timeout: "--exit-0-on-timeout", exit_2_on_failure: "--exit-2-on-failure", paths: nil }.freeze
- PATH_FLAGS =
[:paths, :helper_paths, :load_paths, :prepend_paths, :exclude_paths].freeze
- MOST_RECENTLY_MODIFIED_TAG =
"MOST_RECENTLY_MODIFIED".freeze
- CONFIG_ATTRIBUTES =
[ :timeout, :watch, :fail_fast, :parallel, :seed, :names, :exclude_names, :exclude_paths, :helper_paths, :no_helper, :prepend_paths, :no_prepend, :load_paths, :base_path, :config_path, :reporter, :emoji, :warnings, :verbose, :yes_i_know, :print_interrupted_test_backtraces, :i_am_being_watched, :exit_0_on_timeout, :exit_2_on_failure, :paths, # Internal properties :config_intended_for_merge_only, :seed_set_intentionally, :cli_defaults ].freeze
- GROUPED_TESTS =
If it’s not safe to run a set of tests in parallel, you can force them to run in a group together (in a single worker) with ‘run_these_together!` in your test.
This method takes an array of tuples, where the first element is the class (or its name as a string, if the class is not yet defined in the current file) and the second element is the method name. If the second element is nil, then all the tests on the class will be run together.
Examples:
- `run_these_together!` will run all the tests defined on the current class to be run in a group - `run_these_together!([[ClassA, nil], ["ClassB", :test_1], [ClassB, :test_2]])` will run all the tests defined on ClassA, and test_1 and test_2 from ClassB Concurrent::Array.new
- THREAD_UNSAFE_TESTS =
This is a similar API to run_these_together! but its effect is more drastic Rather than running the provided (class, method) tuples in a group within a thread as part of a parallel run, it will reserve all tests specified by all calls to ‘dont_run_these_in_parallel!` to be run after all parallel tests have finished.
This has an important implication! If your test suite is over TLDR’s time limit, it means that these tests will never be run outside of CI unless you run them manually.
Like ‘run_these_together!`, `dont_run_these_in_parallel!` takes an array of tuples, where the first element is the class (or its fully-qualified name as a string) and the second element is `nil` (matching all the class’s test methods) or else one of the methods on the class.
Examples:
- `dont_run_these_in_parallel!` will run all the tests defined on the current class after all parallel tests have finished - `dont_run_these_in_parallel!([[ClassA, nil], ["ClassB", :test_1], [ClassB, :test_2]])` will run all the tests defined on ClassA, and test_1 and test_2 from ClassB Concurrent::Array.new
Class Method Summary collapse
- .dont_run_these_in_parallel!(klass_method_tuples = [[self, nil]]) ⇒ Object
- .filter_backtrace(backtrace) ⇒ Object
- .run_these_together!(klass_method_tuples = [[self, nil]]) ⇒ Object
Methods included from Hooks
Methods included from Skippable
Methods included from Assertions
#assert, #assert_empty, #assert_equal, #assert_in_delta, #assert_in_epsilon, #assert_includes, #assert_instance_of, #assert_kind_of, #assert_match, #assert_nil, #assert_operator, #assert_output, #assert_path_exists, #assert_pattern, #assert_predicate, #assert_raises, #assert_respond_to, #assert_same, #assert_silent, #assert_throws, capture_io, diff, h, msg, #refute, #refute_empty, #refute_equal, #refute_in_delta, #refute_in_epsilon, #refute_includes, #refute_instance_of, #refute_kind_of, #refute_match, #refute_nil, #refute_operator, #refute_path_exists, #refute_pattern, #refute_predicate, #refute_respond_to, #refute_same
Class Method Details
.dont_run_these_in_parallel!(klass_method_tuples = [[self, nil]]) ⇒ Object
44 45 46 |
# File 'lib/tldr/parallel_controls.rb', line 44 def self.dont_run_these_in_parallel! klass_method_tuples = [[self, nil]] THREAD_UNSAFE_TESTS << TestGroup.new(klass_method_tuples) end |
.filter_backtrace(backtrace) ⇒ Object
37 38 39 |
# File 'lib/tldr/backtrace_filter.rb', line 37 def self.filter_backtrace backtrace BacktraceFilter.new.filter(backtrace) end |
.run_these_together!(klass_method_tuples = [[self, nil]]) ⇒ Object
18 19 20 |
# File 'lib/tldr/parallel_controls.rb', line 18 def self.run_these_together! klass_method_tuples = [[self, nil]] GROUPED_TESTS << TestGroup.new(klass_method_tuples) end |