Skip to content

Commit e76dcce

Browse files
Fix tests, test more, support Node 16-20 (#318)
* Add `.nvmrc` → 14 * Fix package.json's URLs * Update to Pa11y CI's version (`https` etc) * Add Node 16 to matrix, and make linter run each time * Standardise `.editorconfig` * Upgrade to `actions/checkout@4` and `actions/setup-node@3` * Replace `npm install` with `npm ci` * Replace `wait-action` with `sleep 10s` * Rewrite to detach config, use promises, and replace `request` with `fetch` (adding `node-fetch` until Node 18) * Delete small single-use helper * Bump to `pa11y-webservice@4.1` and use caret from here (we control the dep) * Return to `this.last`, fix syntax errors * Update copyright to 2023 and remove unused ref * Fix troubleshooting link * Remove symbols, since they could become outdated * Remove missing link * Replace emoji note with GitHub Markdown note * Fix setup link * Replace br with double space * Replace `sh` with `console` for terminal output * Rename Mongo DB used in integration tests to avoid clash locally * Remove JSCS and references to other unused tools * Remove tooling tasks update * Compress definitions and layout where it makes sense or brings clarity * Rename db used in tests to `pa11y-dashboard-integration-test`, to avoid clash with `pa11y-webservice`'s own test DB * Use briefer syntax * Fix integration test setup & config * Reverse function order to return early * Update to `pa11y-lint-config@3`, update `ecmaVersion` to 2020, remove some rule overrides * Fix linting errors, remove cruft * Move linting and broken integration test command into npm scripts (it remains broken) * Revert `node-fetch` to `^2.7.0` (can't do ESM right now) * Upgrade to `pa11y-webservice@^4.2` from `^4.1` * Upgrade to `mocha@^9.2` from `^8.4` (can't do `10` yet because it drops Node 12) * Use backticks for property names * Fix anchor link for 'installing MongoDB' * Reorganise test workflow and add Node `18` and `20` to test matrix * Fix `lockfile-version` to `2` * Apply support policy * Replace Travis badge with one for Actions * Define some more links, separate code blocks * Reflect greater confidence in support for recent versions of MongoDB * Test against MongoDB versions 3-7 * Remove Make tasks `all`, `ci`, `clean`, `install`, `node_modules`, `lint` * Fix integration test command in workflow * Restore shallow Mocha command for now * Move linting into own step `lint` to avoid duplicated warnings * Give the `test` workflow a better name now that it uses a bigger matrix * Drop back to ES2019 from ES2020 for Node 12, remove use of `?.` * Reduce `--slow` to `4000` * Remove a `describe.only` 👀 * Fix broken test for add new item → standard * Rename availability check function * Fix task count check when testing task creation * Return fully to the original `new` logic * Use `127.0.0.1` consistently to fix (possible) IPV6 issue * Fix Cheerio call in failing test * Add MongoDB 2, and tweak other final versions * Lower case and shorten test name, to sit well alongside lint job * Replace `underscore(.groupBy)` with `lodash/groupby` * Capitalise Puppeteer * Say we test against MongoDB 2 as well * Document two replacements of Make with npm scripts * Revise requirements, permitting Node 16+ and describing Ubuntu issue * Support Node 16, 18, 20 * Install `lodash.keys` and fix Lodash mistakes * Fix rebase autoresolution error affecting `index.js` 👀 * This is Pa11y Dashboard not Webservice * Fix MongoDB link * Remove unused link def for Puppeteer * Shush markdown linter * Actually use `pa11y-webservice@4.3` * Improve support table * Don't `fail-fast` * Remove dependency `underscore` * Fix dashboard's port definition for integration test * Set `NODE_ENV=test` for integration tests * Use `mocha@10` * Extend the sleep to rule out the service not starting in time * Wait on port `4000` instead of sleeping * Fix `wait-on-action` to `v1.1.0` * Fix includes of `lodash.groupby` and `lodash.keys` * Label the port waiting action * Fix to `pa11y-webservice@4.2.0` until dep issue resolved * Set waiter action to start after 1s, time out after 30s, and log * Upgrade to `pa11y-webservice@^4.3.1` from `~4.2.0` * Remove comment about recent versions of MongoDB, since we test with them now
1 parent 8145069 commit e76dcce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+988
-1477
lines changed

.editorconfig

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# http://editorconfig.org
2-
31
root = true
42

53
[*]
@@ -11,7 +9,7 @@ insert_final_newline = true
119
trim_trailing_whitespace = true
1210

1311
[*.md]
14-
indent_style = spaces
12+
indent_style = space
1513
trim_trailing_whitespace = false
1614

1715
[*.yml]

.eslintrc.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
'use strict';
22

3-
module.exports = require('pa11y-lint-config/eslint/es2017');
3+
const pa11yConfig = require('pa11y-lint-config/eslint/es2017');
4+
5+
const config = {
6+
...pa11yConfig,
7+
parserOptions: {
8+
ecmaVersion: 2019
9+
}
10+
};
11+
12+
module.exports = config;

.github/workflows/tests.yml

+40-26
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,58 @@
1-
name: Build and lint
2-
31
on:
42
push:
53
branches:
64
- main
75
pull_request:
86

97
jobs:
10-
checkout_and_test:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 12
15+
- run: npm ci
16+
- run: npm run lint
17+
18+
test:
19+
name: test (node ${{ matrix.node }}, mongodb ${{ matrix.mongo }})
1120
runs-on: ubuntu-20.04
1221
strategy:
22+
fail-fast: false
1323
matrix:
24+
node: [12, 14, 16, 18, 20]
25+
mongo: [latest]
1426
include:
15-
- node-version: 12.x
16-
lint: true # Linter is run only once to shorten the total build time
17-
- node-version: 14.x
27+
- { node: 12, mongo: 6.0.11 }
28+
- { node: 12, mongo: 5.0.22 }
29+
- { node: 12, mongo: 4.4.25 }
30+
- { node: 12, mongo: 3.6.23 }
31+
- { node: 12, mongo: 2.6.12 }
1832

1933
steps:
20-
- name: Checkout code from ${{ github.repository }}
21-
uses: actions/checkout@v2
22-
- name: Setup node
23-
uses: actions/setup-node@v2
34+
- uses: actions/checkout@v4
35+
- uses: actions/setup-node@v3
2436
with:
25-
node-version: ${{ matrix.node-version }}
26-
- name: MongoDB in GitHub Actions
27-
uses: supercharge/mongodb-github-action@1.3.0
37+
node-version: ${{ matrix.node }}
38+
- run: npm ci
39+
40+
- name: Supply MongoDB ${{ matrix.mongo }}
41+
uses: supercharge/mongodb-github-action@1.5.0
2842
with:
29-
mongodb-version: 3.4
30-
- name: Install dependencies
31-
run: npm i
32-
- name: Run linter
33-
if: ${{ matrix.lint }}
34-
run: make lint
35-
- name: Create test config
43+
mongodb-version: ${{ matrix.mongo }}
44+
45+
- name: Supply integration test configuration file
3646
run: cp config/test.sample.json config/test.json
37-
- name: Start test app
47+
48+
- name: Make dashboard available to be integration-tested
3849
run: NODE_ENV=test node index.js &
39-
- name: Wait / Sleep
40-
uses: jakejarvis/wait-action@v0.1.0
50+
- name: Wait for dashboard to respond
51+
uses: iFaxity/wait-on-action@v1.1.0
4152
with:
42-
time: '10s'
43-
- name: Run tests
44-
run: make ci
53+
resource: http://localhost:4000
54+
delay: 1000
55+
timeout: 30000
56+
log: true
57+
58+
- run: NODE_ENV=test npm test

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Config files
32
config/development.json
43
config/production.json
@@ -8,5 +7,5 @@ config/test.json
87
node_modules
98
npm-debug.log
109

11-
# JetBrains IDE
10+
# Editors
1211
.idea

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lockfile-version=2

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

CONTRIBUTING.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
2-
Contributing Guide
3-
==================
1+
# Contributing Guide
42

53
Thanks for getting involved :tada:
64

@@ -14,8 +12,8 @@ Our website outlines the many ways that you can contribute to Pa11y:
1412

1513

1614

17-
[code-of-conduct]: http://pa11y.org/contributing/code-of-conduct/
18-
[communications]: http://pa11y.org/contributing/communications/
19-
[companies]: http://pa11y.org/contributing/companies/
20-
[designers]: http://pa11y.org/contributing/designers/
21-
[developers]: http://pa11y.org/contributing/developers/
15+
[code-of-conduct]: https://pa11y.org/contributing/code-of-conduct/
16+
[communications]: https://pa11y.org/contributing/communications/
17+
[companies]: https://pa11y.org/contributing/companies/
18+
[designers]: https://pa11y.org/contributing/designers/
19+
[developers]: https://pa11y.org/contributing/developers/

Makefile

-15
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
1-
include Makefile.node
2-
3-
# We need to run integration tests recursively
4-
export INTEGRATION_FLAGS := --recursive
5-
6-
7-
# Verify tasks
8-
# ------------
9-
10-
# Lint alias for backwards compatibility
11-
lint: verify
12-
13-
141
# Client-side asset tasks
152
# -----------------------
163

17-
# Compile LESS
184
less:
195
@lessc -x ./public/less/main.less ./public/css/site.min.css
206
@$(TASK_DONE)
217

22-
# Compile client-side JavaScript
238
uglify:
249
@uglifyjs \
2510
public/js/vendor/jquery/jquery.min.js \

Makefile.node

-125
This file was deleted.

0 commit comments

Comments
 (0)