Skip to content

Commit

Permalink
Make suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
beechnut committed Jun 20, 2024
1 parent 555f111 commit 42f4f37
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/pa11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ function doesIntersect(setA, setB) {
}

function didSitewideFilesChange() {
const result = doesIntersect(changedFileSet(), sitewideFileSet())
if (result) {
const filesDidChange = doesIntersect(changedFileSet(), sitewideFileSet())
if (filesDidChange) {
console.log('[pa11y] Sitewide files changed, doing sitewide sample') /* eslint-disable-line no-console */
} else {
console.log('[pa11y] Sitewide files did not change, not doing sitewide sample') /* eslint-disable-line no-console */
}
return result
return filesDidChange
}

function sample(array, limit = 1) {
Expand Down Expand Up @@ -112,25 +112,25 @@ function sampleFiles () {
// We list the output paths because that's where the generated HTML
// lives, the page that will be seen by the public.
//
function pa11yPerPage({ dir, results }) {
function pa11yPerPage({ dir, eleventyEventResults }) {
const differ = process.env.CI ? new CommitDiffer : new Differ
const changedFiles = differ.changedFiles();
const filesToWrite = [];

results.forEach((result) => {
eleventyEventResults.forEach((result) => {
const doc = new Document(result, dir, changedFiles);
if (doc.shouldScan()) { filesToWrite.push(result.outputPath) }
});

return filesToWrite
}

async function pa11yScan ({ dir, results }) {
async function pa11yScan ({ dir, eleventyEventResults }) {
if (!process.env.PA11Y_SCAN) { return false }

const pa11yList = process.env.PA11Y_TARGET_FILE || 'PA11Y_TARGETS';

const perPageFiles = pa11yPerPage({ dir, results });
const perPageFiles = pa11yPerPage({ dir, eleventyEventResults });
let sitewideFiles = [];

if (didSitewideFilesChange()) {
Expand Down

0 comments on commit 42f4f37

Please sign in to comment.