Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Add runner to the report for each issue. Fixes #8 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ report.results = results => {

// Internal method used to report an individual result
report.issue = issue => {
const runner = issue.runner;
const code = issue.code;
const selector = issue.selector.replace(/\s+/g, ' ');
const context = (issue.context ? issue.context.replace(/\s+/g, ' ') : '[no context]');
return cleanWhitespace(`

${typeStarts[issue.type]} ${issue.message}
${grey(`├── ${code}`)}
${grey(`├── ${runner}: ${code}`)}
${grey(`├── ${selector}`)}
${grey(`└── ${context}`)}
`);
Expand Down
9 changes: 6 additions & 3 deletions test/unit/lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,23 @@ describe('lib/reporter', () => {
{
type: 'error',
code: 'mock-code-1',
runner: 'axe',
message: 'mock-message-1',
context: 'mock-context-1',
selector: 'mock-selector-1'
},
{
type: 'warning',
code: 'mock-code-2',
runner: 'htmlcs',
message: 'mock-message-2',
context: 'mock-context-2',
selector: 'mock-selector-2'
},
{
type: 'notice',
code: 'mock-code-3',
runner: 'htmlcs',
message: 'mock-message-3',
context: null,
selector: 'mock-selector-3'
Expand All @@ -75,17 +78,17 @@ describe('lib/reporter', () => {
Results for URL: http://mock-url/

• Error: mock-message-1
├── mock-code-1
├── axe: mock-code-1
├── mock-selector-1
└── mock-context-1

• Warning: mock-message-2
├── mock-code-2
├── htmlcs: mock-code-2
├── mock-selector-2
└── mock-context-2

• Notice: mock-message-3
├── mock-code-3
├── htmlcs: mock-code-3
├── mock-selector-3
└── [no context]

Expand Down