aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_unit
Commit message (Collapse)AuthorAgeFilesLines
* remove unnessary option setting from test runneryuuji.yaginuma2016-04-251-5/+2
| | | | | | | If run the test over the `rake` command, because of the test patterns is passed via `rake_run` method, do not need to be obtained from the argv. This probably fixes #24372.
* [ci skip] Improve comment minitest plugin initialization.Kasper Timm Hansen2016-03-221-2/+4
| | | | | Didn't feel we were clear enough about our motivation for placing Rails first and why we needed to call `load_plugins`.
* Don't get ahead of ourselves.Kasper Timm Hansen2016-03-221-3/+3
| | | | The useless explicit self calls were driving me nuts.
* Set Rails as the first minitest initialized plugin.Kasper Timm Hansen2016-03-221-1/+3
| | | | | | | | | | | When calling `load_plugins` minitest would fill out its extensions, then we'd tackle ourselves on as the last plugin. Because minitest loads plugins in order we will ultimately have the last say on what reporters will be used. Invert that strategy by putting ourselves first and give other plugins plenty of leeway to override our default reporter setup. Fixes #24179.
* make sure `rake test` respects TESTOPTSAaron Patterson2016-02-221-1/+2
| | | | | We should be able to pass options to minitest via TESTOPTS environment variable
* [ci skip] Mention testing fore-runners.Kasper Timm Hansen2016-02-211-0/+2
| | | | Get it? ( ͡° ͜ʖ ͡°)
* use method provided by minitestyuuji.yaginuma2016-02-211-7/+1
| | | | | | | The process of converting `Test` to `String` is already defined in minitest. I think it is better to use that for the consistency of output content. ref: https://github.com/seattlerb/minitest/blob/master/lib/minitest/test.rb#L261..L267
* modify to `error` also abort when specify fail fast optionyuuji.yaginuma2016-02-172-2/+2
|
* test runner, relay minitest information about the error location.Yves Senn2016-02-151-1/+1
| | | | | This is a follow-up to ea70c29 to bring back the assertion error location information provided by minitest.
* Revert "Prefer Minitest's location for test failures."Yves Senn2016-02-151-8/+2
| | | | | | | | | | | | | | | | | | | | 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.
* Fix mixing line filters with Minitest's -n filter.Kasper Timm Hansen2016-02-051-4/+12
| | | | | | | | | | | 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.
* Fix line filters running tests from multiple runnables.Kasper Timm Hansen2016-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | `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.
* Don't run all tests when files end in a colon.Kasper Timm Hansen2016-01-181-1/+1
| | | | | | | | | | | | | | 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 :)
* bring back `TEST` env for `rake test`.Yves Senn2016-01-121-1/+6
| | | | | | | Closes #23027. This does not restore complete backwards compatibility. It simply passes the contets of the `TEST` env to the new runner.
* Merge pull request #22808 from y-yagi/do_not_clear_all_reportersKasper Timm Hansen2016-01-111-1/+2
|\ | | | | delete only unnecessary reporter
| * delete only unnecessary reporteryuuji.yaginuma2016-01-111-1/+2
| | | | | | | | | | 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.
* | Added multiple line filters support for test runnerSiva Gollapalli2016-01-102-4/+9
| |
* | [ci skip] Clarify some Minitest origins.Kasper Timm Hansen2016-01-091-0/+2
| | | | | | | | | | It might be tough for readers to know why we implement `===`, and where the Regexp in `derive_regexp` came from.
* | Extract line filtering to Railties.Kasper Timm Hansen2016-01-092-0/+69
|/ | | | | | | | | | | | 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.
* Move test coloring closer to where it's used.Kasper Timm Hansen2015-12-231-15/+9
| | | | | | | | | | | 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.
* Remove local variable color.Kasper Timm Hansen2015-12-231-5/+5
| | | | | Focus `color_output`'s intent on coloring output by a result. We aren't meant to pass it arbitrary codes to color output.
* Rename color to color_output.Kasper Timm Hansen2015-12-231-6/+5
| | | | | | 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.
* Remove unused blue color.Kasper Timm Hansen2015-12-231-2/+1
| | | | I got the blues because we aren't coloring any lines blue.
* Color failure line by result code.Kasper Timm Hansen2015-12-231-1/+1
| | | | | | | 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.
* Rewrite aggregated results suppression.Kasper Timm Hansen2015-12-231-10/+4
| | | | | | | | 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.
* [ci skip] Clarify why we're clearing reporters.Kasper Timm Hansen2015-12-231-1/+1
| | | | | | Minitest by default includes a summary reporter and a progress reporter. To print colored output, we have to replace the progress reporter.
* Add colored output to the new test reporter.Lucas Mazza2015-12-222-1/+47
|
* display detailed information in inline reportingyuuji.yaginuma2015-12-211-1/+7
| | | | | | | | | | | | | | | | | | | | | 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 ```
* show relative path the rerun snippet of test runner in rails engineyuuji.yaginuma2015-12-101-1/+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 ```
* Fix #22232: rake test tasks exit status codeArkadiusz Fal2015-12-071-1/+3
| | | | | | | 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.
* allow use of minitest-rails gem with test runnerChris Kottom2015-11-301-1/+1
|
* add `bin/test` script to rails pluginyuuji.yaginuma2015-11-281-3/+4
|
* Prefer Minitest's location for test failures.Kasper Timm Hansen2015-11-121-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ........ ```
* Output inline is set to true in the plugin.Kasper Timm Hansen2015-10-071-1/+1
| | | | | | Change the reporter to just read the option. Pass output_inline where needed in tests.
* Hide Minitest's aggregated results if outputting inline.Kasper Timm Hansen2015-10-071-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Add fail fast to test runner.Kasper Timm Hansen2015-09-292-0/+13
| | | | | Passing `--fail-fast` to the test runner will now abort the test run on the first failure. The run continues on any unexpected errors.
* Add inline failure reporting to test runner.Kasper Timm Hansen2015-09-282-5/+32
| | | | | | | | | 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.
* check if @rake_patterns is definedyuuji.yaginuma2015-09-281-1/+2
| | | | | | | This removes the following warning. ``` railties/lib/rails/test_unit/minitest_plugin.rb:45: warning: instance variable @rake_patterns not initialize ```
* modify to pass the correct argument to the test runner from rakeyuuji.yaginuma2015-09-082-6/+15
| | | | | | | | 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.
* raise LoadError when a non-existent file or directory is specified to the ↵yuuji.yaginuma2015-09-071-1/+1
| | | | | | | | 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.
* make `ENV` a required argumentyuuji.yaginuma2015-08-291-1/+1
|
* Allow Minitest to load plugins. Fixes #21102Oleg Sukhodolsky2015-08-031-0/+1
|
* Avoid crashing when minitest-rails is loaded.Victor Costan2015-07-011-3/+3
| | | | | | | | 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.
* do not show "Failed tests" message when a failed test is notyuuji.yaginuma2015-06-231-3/+9
|
* make it possible to customize the executable inside rereun snippets.Yves Senn2015-06-131-1/+5
| | | | | | | | | | | | | | | | | | | 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 ```
* Improve test runner's Minitest integration.Kasper Timm Hansen2015-06-045-152/+85
| | | | | | | | | | | 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/
* Remove unused private classesRafael Mendonça França2015-05-031-126/+0
| | | | | | | The usage of these classes where removed at 8017e6af31caa58a58787274ff0ca01397219e49. cc @arthurnn @senny
* Merge pull request #19441 from y-yagi/use_existArthur Nogueira Neves2015-03-211-1/+1
|\ | | | | use `Dir.exist?` instead of deprecated `Dir.exists?`
| * use `Dir.exist?` instead of deprecated `Dir.exists?`yuuji.yaginuma2015-03-211-1/+1
| |
* | Merge pull request #19445 from prathamesh-sonpatki/rm-ostructArthur Nogueira Neves2015-03-211-1/+0
|\ \ | | | | | | Removed requiring ostruct because its unused