diff --git a/HISTORY.md b/HISTORY.md index 550bdb9..2615e40 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,15 @@ # RELEASE HISTORY +## Unreleased + +* Bring the HTML reporter in from rubytest-html, rewritten for the recorder: + `rubytest -f html`. It escapes what it writes, reports skipped tests and + cases, and shows captured output with each test. +* Bring the Rake task in from rubytest-rake: `require 'rubytest/rake'` for + `Test::Rake::TestTask`. The task now fails when the run does (it always + exited 0), runs only the default globs that match a file, and lets `TEST` + replace the task's files for one invocation. + ## 0.10.0 / 2026-11-17 Results now go through a recorder to the reporters, and the reporters that diff --git a/README.md b/README.md index a8afe26..1a858d9 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,10 @@ test), `outline` (nested cases), `progress` (running count and timing), `tap` (TAP version 13), and `tapy` and `tapj` (TAP-Y and TAP-J, the structured streams that [tapout](https://github.com/rubyworks/tapout) reads). Select one with `rubytest -f FORMAT`; `-y` and `-j` are short for `-f tapy` and `-f tapj`. -Formats load only when selected. The TAP formats capture test output: TAP -emits it as diagnostics, and TAP-Y and TAP-J record it with each test. +`html` writes the whole run as one self-contained HTML document +(`rubytest -f html > report.html`). Formats load only when selected. The TAP +and HTML formats capture test output: TAP emits it as diagnostics, and TAP-Y, +TAP-J and HTML record it with each test. ## Installation @@ -122,8 +124,31 @@ named profile, use the `-p/--profile` option: The configuration file can also be at `config/test.rb`, `Testfile`, or `.test` (with optional `.rb` extension). -If you are using Rake, shelling out to `rubytest` keeps your test -environment pristine: +### Via Rake + +Rubytest has a Rake task. In your Rakefile: + + require 'rubytest/rake' + + Test::Rake::TestTask.new do |run| + run.loadpath 'lib' + run.test_files << 'test/*_test.rb' + end + +The block takes the same settings as `Test.configure`. With no files, the +task runs whichever of `test/**/test_*.rb`, `*_test.rb`, `case_*.rb` and +`*_case.rb` it finds, and with no load path it adds `lib`. The task is named +`test` unless you give it another name (`TestTask.new('spec')`). + +To run only some tests for one invocation, set `TEST`: + + $ rake test TEST=test/foo_test.rb + +Where the platform can fork, the tests run in a child process, so what they +load stays out of Rake's. `rake test` fails if the run does. + +A configuration file isn't read by the task. To use one, shell out to +`rubytest` instead: desc "run tests" task :test do diff --git a/demo/05_builtin_reporters.md b/demo/05_builtin_reporters.md index bab28b4..2534679 100644 --- a/demo/05_builtin_reporters.md +++ b/demo/05_builtin_reporters.md @@ -116,3 +116,27 @@ The command line has a shortcut for each. cli.options.parse!([flag]) cli.format.assert == format end + +The HTML format writes one self-contained document once the run has +finished. Names, messages and captured output are escaped. + + markup = probe_type.new('markup &') { print '