| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
| |
This is a follow-up to ea70c29 to bring back the assertion error
location information provided by minitest.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 0db310586ac3e15be95d2ef27ff40cfa24c05c10.
Closes #23686.
Conflicts:
railties/test/application/test_runner_test.rb
It's possible that the `result.location` returned by minitest is outside
the test file itself. For example in the case of mocha. This resulted in
bad rerun snipptets:
```
bin/rails test app/models/deliveries/delivery.rb:103
```
Let's always use the first line of the failed test-case in our rerun
snippet. We can display the line number of the assertion error elsewhere.
|
|
|
|
|
|
|
|
|
|
|
| |
Previous commit accidentally broke mixing line filters with string -n filter.
Fix by checking if it is a string and returning it.
We also need to ensure the -n filter carry forward into any other composite filters.
Fix by letting the named filter be extractable, so we'll keep this for the next runnable's
run.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`derive_regexp` was written with the assumption that we were run from a
blank slate — that if the filter didn't match we might as well return it
because it was nil.
This isn't the case because minitest calls `run` on every runnable. Which
is any subclass of Minitest::Runnable, such as ActiveSupport::TestCase,
ActionDispatch::IntegrationTest as well as any inheriting from those.
Thus after the first `run` we'd have put in a composite filter in
`options[:filter]` making the next `run` create a linked list when it
failed to match the regexp and put the composite filter as the head.
Every runnable would accumulate more and more of the same filters,
which effectively acted like an expanding whitelist and we ran tests
from other runnables.
Clog the accumulation by returning nil if there's no filter to derive
a regexp from.
Note: we pass a seed in the tests because Minitest shuffles the runnables
to ensure the whitelist is expanded enough that the failure is triggered.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If running `bin/rails t test/models/bunny_test.rb:` we'd implicitly run all the
tests in the bunny test. I now highly doubt that people would ever put in a line
filter without a line *and* want that to mean run all tests in that file.
Instead, change regex to require a line digit after the colon, so runs without a
line at the end would fail to require the test file.
This also has the side benefit of breaking requiring a file with many colons:
`bin/rails t test/models/bunny_test.rb:::::::::::::4`
Think this means I've had enough colonoscopy to last me through the year :)
|
|
|
|
|
|
|
| |
Closes #23027.
This does not restore complete backwards compatibility. It simply passes
the contets of the `TEST` env to the new runner.
|
|\
| |
| | |
delete only unnecessary reporter
|
| |
| |
| |
| |
| | |
Reporter that defines its own users at the time of this process are also loaded,
to avoid them from being deleted, to delete only the specified to unnecessary reporter.
|
| | |
|
| |
| |
| |
| |
| | |
It might be tough for readers to know why we implement `===`, and where
the Regexp in `derive_regexp` came from.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
The line filter parsing added to ActiveSupport::TestCase is only half the story
to enable line filtering. The other half, of adding the patterns to the options,
is done in the Minitest plugin that Railties has.
Thus it makes more sense to have the filter in Railties with the other half and
all the line filtering tests.
Move the filter and extend Active Support in an initializer, so that when users
or `rails/all.rb` require `rails/test_unit/railtie` we can still filter by line.
|
|
|
|
|
|
|
|
|
|
|
| |
Didn't like the constant being at the top of the file, gave it overdue importance.
Now that `color_output` expects a result we can shorten some of the flexibility
from earlier:
* Inline COLOR_CODES constant (keep local variable for readability,
but don't need names of colors at run time).
* Inline color variable in `color_output`. Looks just as clear without it.
|
|
|
|
|
| |
Focus `color_output`'s intent on coloring output by a result. We aren't meant
to pass it arbitrary codes to color output.
|
|
|
|
|
|
| |
The word color is being thrown all around with slightly different meanings.
Right now, I understand it. But I'd like to be more immediately clear.
|
|
|
|
| |
I got the blues because we aren't coloring any lines blue.
|
|
|
|
|
|
|
| |
The static red color wouldn't paint skips in their designated yellow.
Use the color name we got from the result label earlier, which marks
skips as yellow.
|
|
|
|
|
|
|
|
| |
I should have replaced the summary reporter with a subclass
the first time I wrote this.
For whatever reason, I didn't. Do it right and slim the methods added
to Minitest in the process.
|
|
|
|
|
|
| |
Minitest by default includes a summary reporter and a progress reporter.
To print colored output, we have to replace the progress reporter.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The errors message only was not displayed, as if it did not use the inline reporting,
modified to also information the method name and the like in error are displayed.
```
# before
Failed assertion, no message given.
bin/rails test test/models/user_test.rb:5
```
```
# after
Failure:
UserTest#test_the_truth:
Failed assertion, no message given.
bin/rails test test/models/user_test.rb:5
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the absolute path is not required to re-run the test,
modified so that unnecessary information is not displayed.
```ruby
# before
bin/rails test /path/to/blorgh/test/integration/navigation_test.rb:5
# after
bin/rails test test/integration/navigation_test.rb:5
```
|
|
|
|
|
|
|
| |
The exit status code was not set when tests were fired with `rake`.
Now, it is being set and it matches behavior of running tests via `rails`
command (`rails test`), so no matter if `rake test` or `rails test` command
is used the exit code will be set.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running tests, the Rails test runner would report the start of the test method as the test failure.
For this test:
```ruby
1 require 'test_helper
2
3 class BunnyTest < ActiveSupport::TestCase
4 test "something failing" do
5 assert false, 'This failed'
6 end
7 end
```
The runner outputs 5 instead of 4:
```
............................................F
This failed
bin/rails test test/models/bunny_test.rb:5
........
```
|
|
|
|
|
|
| |
Change the reporter to just read the option.
Pass output_inline where needed in tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We'd see the failures and errors reported after the run, which is needless, when we've already
reported them.
Turns:
```
.......................................S....................F
This failed
bin/rails test test/models/bunny_test.rb:14
....
Finished in 0.100886s, 1020.9583 runs/s, 1001.1338 assertions/s.
2) Failure:
BunnyTest#test_something_failing [/Users/kasperhansen/Documents/code/collection_caching_test/test/models/bunny_test.rb:15]:
This failed
103 runs, 101 assertions, 1 failures, 0 errors, 1 skips
You have skipped tests. Run with --verbose for details.
```
Into:
```
...................S.......................................F
This failed
bin/rails test test/models/bunny_test.rb:14
......................
Finished in 0.069910s, 1473.3225 runs/s, 1444.7143 assertions/s.
103 runs, 101 assertions, 1 failures, 0 errors, 1 skips
```
|
|
|
|
|
| |
Passing `--fail-fast` to the test runner will now abort the test run
on the first failure. The run continues on any unexpected errors.
|
|
|
|
|
|
|
|
|
| |
Any failures or errors will be reported inline during the run by default.
Skipped tests will be reported if run in verbose mode.
Any result is output with failure messages and a rerun snippet for that test.
Rerun snippets won't be output after a run, unless `--defer-output` is passed.
|
|
|
|
|
|
|
| |
This removes the following warning.
```
railties/lib/rails/test_unit/minitest_plugin.rb:45: warning: instance variable @rake_patterns not initialize
```
|
|
|
|
|
|
|
|
| |
test runner sets file to be tested in plugin_rails_options,
but in plugin_rails_options, processing has been made to the argument of the
actual command rather than the argument of Minitest.run.
For example, if you run `./bin rake db:migrate test`, the options[:patterns], `db:migrate test` was incorrectly set.
|
|
|
|
|
|
|
|
| |
test runner
Currently, if a file or directory that does not exist was specified in the test runner,
that argument is ignored.
This commit has been modified to cause an error if there is no file or directory.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The improvments to the test runner's integration with minitest in commit
b6fc8e25a10cc4abdd03018798b180270d6c5d7f add methods to the Minitest
module that refer to the Rails module. Unfortunately, when the
minitest-rails gem is loaded, the reference is incorrectly resolved to
the Minitest::Rails module.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the Rails repository we use a `bin/test` executable to run our tests.
However the rerun snippets still included `bin/rails test`:
BEFORE:
```
Failed tests:
bin/rails test test/cases/adapters/postgresql/schema_test.rb:91
```
AFTER:
```
Failed tests:
bin/test test/cases/adapters/postgresql/schema_test.rb:91
```
|
|
|
|
|
|
|
|
|
|
|
| |
This also adds free mix and matching of directories, files and lines filters.
Like so:
bin/rails test models/post_test.rb test/integration models/person_test.rb:26
You can also mix in a traditional Minitest filter:
bin/rails test test/integration -n /check_it_out/
|
|
|
|
|
|
|
| |
The usage of these classes where removed at
8017e6af31caa58a58787274ff0ca01397219e49.
cc @arthurnn @senny
|
|\
| |
| | |
use `Dir.exist?` instead of deprecated `Dir.exists?`
|
| | |
|
|\ \
| | |
| | | |
Removed requiring ostruct because its unused
|
| |/ |
|
|/ |
|
| |
|
|
|
|
| |
bundle exec db:migrate rake was not working, with the new runner, before this commit
|
| |
|
| |
|
| |
|