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 v8 and other dependency updates #242

Open
wants to merge 16 commits into
base: main
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20]
node-version: [18, 20, 22]
steps:
- name: Normalise line-ending handling in Git
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions bin/pa11y-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const path = require('path');
const globby = require('globby');
const protocolify = require('protocolify');
const pkg = require('../package.json');
const commander = require('commander');

const {Command} = require('commander');
const commander = new Command();

// Here we're using Commander to specify the CLI options
commander
Expand Down
2 changes: 1 addition & 1 deletion lib/pa11y-ci.js
Original file line number Diff line number Diff line change
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 All @@ -118,7 +118,7 @@
await cycleReporters(reporters, 'begin', url);

config.browser = config.useIncognitoBrowserContext ?
await testBrowser.createIncognitoBrowserContext() :
await testBrowser.createBrowserContext() :
testBrowser;

// Run the Pa11y test on the current URL and add
Expand Down
2,533 changes: 1,492 additions & 1,041 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@
"node": ">=18"
},
"dependencies": {
"async": "~3.2.5",
"async": "~3.2.6",
"cheerio": "~1.0.0-rc.12",
"commander": "~11.1.0",
"commander": "~12.1.0",
"globby": "~6.1.0",
"kleur": "~4.1.5",
"lodash": "~4.17.21",
"node-fetch": "~2.7.0",
"pa11y": "^7.0.0",
"pa11y": "^8.0.0",
"protocolify": "~3.0.0",
"puppeteer": "^20.9.0",
"puppeteer": "^23.2.1",
"wordwrap": "~1.0.0"
},
"devDependencies": {
"eslint": "^8.56.0",
"mocha": "^10.3.0",
"eslint": "^8.57.0",
"mocha": "^10.7.3",
"mockery": "^2.1.0",
"nyc": "^15.1.0",
"nyc": "^17.0.0",
"pa11y-lint-config": "^3.0.0",
"proclaim": "^3.6.0",
"sinon": "^17.0.1"
"sinon": "^18.0.0"
},
"main": "./lib/pa11y-ci.js",
"bin": {
Expand All @@ -53,7 +53,7 @@
"verify-coverage": "nyc check-coverage --lines 90 --functions 90 --branches 90",
"test-unit": "mocha --file test/unit/setup.test.js 'test/unit/**/*.test.js' --recursive",
"test-coverage": "nyc --reporter=text --reporter=html mocha --file test/unit/setup.test.js 'test/unit/**/*.test.js' --recursive",
"test-integration": "mocha --file test/integration/setup.test.js 'test/integration/**/*.test.js' test/integration/teardown.test.js --recursive --timeout 20000 --slow 5000",
"test-integration": "mocha --file test/integration/setup.test.js 'test/integration/**/*.test.js' test/integration/teardown.test.js --recursive --timeout 30000 --slow 5000",
"test": "npm run test-coverage && npm run verify-coverage && npm run test-integration"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cli-defaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('pa11y-ci (with default configurations set)', () => {
it('uses the default config for each URL', () => {
assert.include(global.lastResult.output, 'http://localhost:8090/passing-1 - Failed to run');
assert.include(global.lastResult.output, 'http://localhost:8090/passing-2 - Failed to run');
assert.include(global.lastResult.output, 'timed out');
assert.include(global.lastResult.output, 'timeout');
});

});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cli-erroring.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('pa11y-ci (with multiple erroring URLs)', () => {
assert.include(global.lastResult.output, 'Errors in ./foo/erroring.html');
assert.include(global.lastResult.output, 'net::ERR_FILE_NOT_FOUND');
assert.include(global.lastResult.output, 'Errors in http://localhost:8090/timeout');
assert.include(global.lastResult.output, 'timed out');
assert.include(global.lastResult.output, 'timeout');
});

it('outputs a total erroring notice', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/cli-reporter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('pa11y-ci (with default reporter)', () => {
assert.include(global.lastResult.stdout, 'Running Pa11y on 2 URLs');
assert.include(global.lastResult.stderr, 'http://localhost:8090/passing-1 - Failed to run');
assert.include(global.lastResult.stderr, 'http://localhost:8090/passing-2 - Failed to run');
assert.include(global.lastResult.stderr, 'timed out');
assert.include(global.lastResult.stderr, 'timeout');
});

});
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('pa11y-ci (with multiple reporters)', () => {
assert.include(global.lastResult.stdout, 'Running Pa11y on 2 URLs');
assert.include(global.lastResult.stderr, 'http://localhost:8090/passing-1 - Failed to run');
assert.include(global.lastResult.stderr, 'http://localhost:8090/passing-2 - Failed to run');
assert.include(global.lastResult.stderr, 'timed out');
assert.include(global.lastResult.stderr, 'timeout');
});

});
8 changes: 4 additions & 4 deletions test/unit/lib/pa11y-ci.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ describe('lib/pa11y-ci', () => {
assert.callCount(pa11y, 1);
assert.calledWith(pa11y, 'qux-url', userUrls[0]);
});
it('did not createIncognitoBrowserContext', () => {
assert.callCount(mockBrowser.createIncognitoBrowserContext, 0);
it('did not createBrowserContext', () => {
assert.callCount(mockBrowser.createBrowserContext, 0);
});
it('closes the browser context after the test runner completes', () => {
assert.callCount(mockBrowser.close, 1);
Expand Down Expand Up @@ -398,11 +398,11 @@ describe('lib/pa11y-ci', () => {

it('closes each incognito browser context created during test runner execution', () => {
assert.callCount(
mockBrowser.createIncognitoBrowserContext,
mockBrowser.createBrowserContext,
2
);
assert.callCount(
mockBrowser.createIncognitoBrowserContext.close,
mockBrowser.createBrowserContext.close,
2
);
});
Expand Down
6 changes: 3 additions & 3 deletions test/unit/mock/puppeteer.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const puppeteer = module.exports = {

const mockBrowser = (puppeteer.mockBrowser = {
close: sinon.stub(),
createIncognitoBrowserContext: sinon.spy(() => {
return {close: mockBrowser.createIncognitoBrowserContext.close};
createBrowserContext: sinon.spy(() => {
return {close: mockBrowser.createBrowserContext.close};
})
});

mockBrowser.createIncognitoBrowserContext.close = sinon.stub();
mockBrowser.createBrowserContext.close = sinon.stub();

puppeteer.launch.resolves(mockBrowser);
Loading