-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a11y: Cleanup some test summary stuff..
- Loading branch information
1 parent
dbed666
commit 71e3468
Showing
4 changed files
with
39 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
# Summarize the axe rspec failures into aggregate counts | ||
# TODO: This should be an RSpec formatter | ||
|
||
require 'json' | ||
require 'pp' | ||
|
||
RESULTS_PATH = File.join(File.dirname(__FILE__), '..', '..', 'tmp/rspec_output.json') | ||
AXE_CASE_TITLE = /\n\s*\n\s*\d+\)\s+([-\w]+):/ | ||
|
||
|
||
def failing_specs(results_data) | ||
results_data['examples'].filter do |ex| | ||
ex['status'] == 'failed' | ||
end | ||
end | ||
|
||
def summarize_results(results) | ||
failing_specs(results).map do |ex| | ||
ex['exception']['message'].scan(AXE_CASE_TITLE) | ||
end.flatten.tally | ||
end | ||
|
||
def print_summary | ||
results_data = JSON.parse(File.read(RESULTS_PATH)) | ||
failing_tests_by_type = summarize_results(results_data) | ||
pp(failing_tests_by_type) | ||
puts "Total: #{failing_tests_by_type.values.sum} failures." | ||
end | ||
|
||
print_summary |
This file was deleted.
Oops, something went wrong.