Skip to content

Commit

Permalink
Expose raw_output in TestRun::TestResult
Browse files Browse the repository at this point in the history
This allows you to print out all the qunit output, not just the summary. See rails/rails#42513 for an example of why.
  • Loading branch information
ghiculescu committed Jun 16, 2021
1 parent 31ac70b commit a947f07
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/qunit/selenium/test_run.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QUnit
module Selenium
class TestRun
TestResult = Struct.new(:tests, :assertions, :duration)
TestResult = Struct.new(:tests, :assertions, :duration, :raw_output)
ID_TESTRESULT = 'qunit-testresult'
ID_TESTS = 'qunit-tests'

Expand All @@ -17,11 +17,15 @@ def completed?
def result
assertions = {total: total_assertions, passed: passed_assertions, failed: failed_assertions}
tests = {total: total_tests, passed: pass_tests, failed: fail_tests}
TestResult.new(tests, assertions, duration)
TestResult.new(tests, assertions, duration, raw_output)
end

private

def raw_output
@qunit_tests.text
end

def duration
match = /Tests completed in (?<milliseconds>\d+) milliseconds/.match @qunit_testresult.text
match[:milliseconds].to_i / 1000
Expand All @@ -44,4 +48,4 @@ def total_tests
end
end
end
end
end

0 comments on commit a947f07

Please sign in to comment.