mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 22:31:15 +00:00
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
This commit is contained in:
66
.github/workflows/tests.yml
vendored
66
.github/workflows/tests.yml
vendored
@@ -1,5 +1,3 @@
|
||||
name: Build and lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -7,38 +5,54 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
checkout_and_test:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
|
||||
test:
|
||||
name: test (node ${{ matrix.node }}, mongodb ${{ matrix.mongo }})
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [12, 14, 16, 18, 20]
|
||||
mongo: [latest]
|
||||
include:
|
||||
- node-version: 12.x
|
||||
lint: true # Linter is run only once to shorten the total build time
|
||||
- node-version: 14.x
|
||||
- { node: 12, mongo: 6.0.11 }
|
||||
- { node: 12, mongo: 5.0.22 }
|
||||
- { node: 12, mongo: 4.4.25 }
|
||||
- { node: 12, mongo: 3.6.23 }
|
||||
- { node: 12, mongo: 2.6.12 }
|
||||
|
||||
steps:
|
||||
- name: Checkout code from ${{ github.repository }}
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: MongoDB in GitHub Actions
|
||||
uses: supercharge/mongodb-github-action@1.3.0
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: npm ci
|
||||
|
||||
- name: Supply MongoDB ${{ matrix.mongo }}
|
||||
uses: supercharge/mongodb-github-action@1.5.0
|
||||
with:
|
||||
mongodb-version: 3.4
|
||||
- name: Install dependencies
|
||||
run: npm i
|
||||
- name: Run linter
|
||||
if: ${{ matrix.lint }}
|
||||
run: make lint
|
||||
- name: Create test config
|
||||
mongodb-version: ${{ matrix.mongo }}
|
||||
|
||||
- name: Supply integration test configuration file
|
||||
run: cp config/test.sample.json config/test.json
|
||||
- name: Start test app
|
||||
|
||||
- name: Make dashboard available to be integration-tested
|
||||
run: NODE_ENV=test node index.js &
|
||||
- name: Wait / Sleep
|
||||
uses: jakejarvis/wait-action@v0.1.0
|
||||
- name: Wait for dashboard to respond
|
||||
uses: iFaxity/wait-on-action@v1.1.0
|
||||
with:
|
||||
time: '10s'
|
||||
- name: Run tests
|
||||
run: make ci
|
||||
resource: http://localhost:4000
|
||||
delay: 1000
|
||||
timeout: 30000
|
||||
log: true
|
||||
|
||||
- run: NODE_ENV=test npm test
|
||||
|
Reference in New Issue
Block a user