Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Pa11y v7 and other dependency updates #231

Merged
merged 23 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0673704
Update kleur to v4.1.5
aarongoldenthal Jan 20, 2024
303d353
Update async to v3.2.5
aarongoldenthal Jan 20, 2024
70ad230
Update commander to v11.1.0
aarongoldenthal Jan 20, 2024
9607ced
Update node-fetch to v2.7.0
aarongoldenthal Jan 20, 2024
9d2fd9a
Update pa11y to v7.0.0 and puppeteer to v21.7.0
aarongoldenthal Jan 20, 2024
8a0359d
Update actions for latest Node, and match pa11y v7
aarongoldenthal Jan 20, 2024
d1b00e7
Update eslint to v8.56.0
aarongoldenthal Jan 20, 2024
978d9d5
Update mocha to v10.2.0
aarongoldenthal Jan 20, 2024
2820459
Update sinon to v17.0.1
aarongoldenthal Jan 20, 2024
74aad84
Update node engine to Node 18
aarongoldenthal Jan 20, 2024
d4fb505
Populate package keywords
aarongoldenthal Jan 20, 2024
3e6692f
Update globby to v11.1.0
aarongoldenthal Jan 20, 2024
8c5bf84
Update cheerio to v1.0.0-rc.12
aarongoldenthal Jan 20, 2024
5d87640
Revert puppeteer to 20.9.0 to match pa11y
aarongoldenthal Jan 21, 2024
5abb560
Update glob processing to properly handle negating patterns
aarongoldenthal Jan 21, 2024
610dc51
Update exitCode to allow graceful exit
aarongoldenthal Jan 21, 2024
fb98229
Refresh lockfile to update all transitive dependencies
aarongoldenthal Jan 21, 2024
87fa70c
Update mocha from 10.2.0 to 10.3.0
aarongoldenthal Feb 9, 2024
2ab50be
In `.nvmrc`, set Node `18` in place of `14`
danyalaytekin Mar 10, 2024
8525887
In readme, mention Node `18` in place of `12`
danyalaytekin Mar 10, 2024
e0ca81d
Increase timeout to 500ms from 100ms to attempt to fix test flakes, f…
danyalaytekin Mar 10, 2024
33be0a7
Move options closer to point of use
aarongoldenthal Mar 11, 2024
b8e2729
Revert globby to 6.1.0 to avoid behavioral changes
aarongoldenthal Mar 11, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ on:

jobs:
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org
- run: npm ci

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 18
- run: npm ci
- run: npm run lint

Expand All @@ -21,8 +21,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
node-version: [12, 14, 16, 18, 20]
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20]
steps:
- name: Normalise line-ending handling in Git
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
18
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Use this tool to test against a list of URLs or a sitemap, and report on issues

## Requirements

This command line tool requires a stable (even-numbered) [Node.js] version of 12 or above.
This command line tool requires a stable (even-numbered) [Node.js] version of 18 or above.

### Pa11y CI 3 and Ubuntu

Expand Down
25 changes: 13 additions & 12 deletions bin/pa11y-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,30 @@ const urls = globby.sync(commander.args, {
}).map(protocolify);

// Start the promise chain to actually run everything
const options = commander.opts();
Promise.resolve()
.then(() => {
// Load config based on the `--config` flag
return loadConfig(commander.config);
return loadConfig(options.config);
})
.then(config => {
// Load a sitemap based on the `--sitemap` flag
if (commander.sitemap) {
return loadSitemapIntoConfig(commander, config);
if (options.sitemap) {
return loadSitemapIntoConfig(options, config);
}
return config;
})
.then(config => {
// Override config reporters with CLI argument
if (commander.reporter) {
config.defaults.reporters = [commander.reporter];
if (options.reporter) {
config.defaults.reporters = [options.reporter];
}
// Actually run Pa11y CI
return pa11yCi(urls.concat(config.urls || []), config.defaults);
})
.then(report => {
// Output JSON if asked for it
if (commander.json) {
if (options.json) {
console.log(JSON.stringify(report, (key, value) => {
if (value instanceof Error) {
return {
Expand All @@ -98,16 +99,16 @@ Promise.resolve()
}
// Decide on an exit code based on whether
// errors are below threshold or everything passes
if (report.errors >= parseInt(commander.threshold, 10) && report.passes < report.total) {
process.exit(2);
if (report.errors >= parseInt(options.threshold, 10) && report.passes < report.total) {
process.exitCode = 2;
} else {
process.exit(0);
process.exitCode = 0;
}
})
.catch(error => {
// Handle any errors
console.error(error.message);
process.exit(1);
process.exitCode = 1;
});

// This function loads the JSON or JavaScript config
Expand All @@ -128,7 +129,7 @@ function loadConfig(configPath) {
if (!config) {
config = loadLocalConfigWithJson(configPath);
}
if (commander.config && !config) {
if (options.config && !config) {
return reject(new Error(`The config file "${configPath}" could not be loaded`));
}
} catch (error) {
Expand Down Expand Up @@ -200,7 +201,7 @@ function defaultConfig(config) {
config.defaults.log = config.defaults.log || console;
// Setting to undefined rather than 0 allows for a fallback to the default
config.defaults.wrapWidth = process.stdout.columns || undefined;
if (commander.json) {
if (options.json) {
delete config.defaults.log;
}
return config;
Expand Down
2 changes: 1 addition & 1 deletion lib/pa11y-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

// Create a Pa11y test function and an async queue
const taskQueue = queue(testRunner, options.concurrency);
taskQueue.drain = testRunComplete;
taskQueue.drain(testRunComplete);

// Push the URLs on to the queue
taskQueue.push(urls);
Expand Down Expand Up @@ -105,7 +105,7 @@

// This is the actual test runner, which the queue will
// execute on each of the URLs
async function testRunner(config) {

Check warning on line 108 in lib/pa11y-ci.js

View workflow job for this annotation

GitHub Actions / lint

Async function 'testRunner' has too many statements (16). Maximum allowed is 15
let url;
if (typeof config === 'string') {
url = config;
Expand Down
Loading
Loading