Update reporter to include screenshot, remove try statement to ensure CI fails when an error occurs

Change-Id: I685c8a74352b4172d7a086467a9b3cfc84d57cee
This commit is contained in:
bwang 2022-05-05 12:35:29 -05:00
parent cdd144f928
commit 6b814da689
2 changed files with 63 additions and 68 deletions

View File

@ -89,9 +89,10 @@
<div class="page">
<h1>Accessibility Report For {{{name}}}</h1>
<p>Run on: {{{pageUrl}}}</p>
<p>Generated at: {{date}}</p>
<h1>Accessibility Report for "{{{name}}}"</h1>
<p><b>Run on:</b> {{{pageUrl}}}</p>
<p><b>Generated at:</b> {{date}}</p>
<p><b>Page screenshot:</b> <a href="./{{{name}}}.png">{{{name}}}.png</a></p>
<nav class="counts">
<a href="#error" class="count error">{{errorCount}} total errors</a>
@ -101,12 +102,12 @@
{{#issueData}}
<div id="{{type}}" class="container">
<h2>{{typeLabel}}, {{typeCount}} rules</h2>
<h2>{{typeLabel}}, {{typeCount}} rule(s)</h2>
{{#messages}}
<div class="message {{type}}">
<h3>{{message}}</h3>
<p>Rule: {{runner}}, {{code}}</p>
{{#runnerExtras}}<p>Impact: {{impact}}</p>{{/runnerExtras}}
<p><b>Rule:</b> {{runner}}, {{code}}</p>
{{#runnerExtras}}<p><b>Impact:</b> {{impact}}</p>{{/runnerExtras}}
<h4>{{issueCount}} instance(s):</h4>
<ul class="issues-list">
{{#issues}}

View File

@ -46,7 +46,6 @@ async function runTests( opts ) {
throw new Error( 'Missing env variables' );
}
try {
const tests = config.tests;
const allValidTests = tests.filter( ( test ) => test.name ).length === tests.length;
if ( !allValidTests ) {
@ -104,11 +103,6 @@ async function runTests( opts ) {
// Save in json report
fs.promises.writeFile( `${config.reportDir}/report-${name}.json`, JSON.stringify( testResult, null, ' ' ), 'utf8' );
} );
} catch ( error ) {
// Output an error if it occurred
console.error( error.message );
}
}
function setupCLI() {