Skip to content

Commit 8955c99

Browse files
authored
Add support for canvas v3
For now, we support both v2 and v3, since they both seem to work. We'd prefer to only support one major version for ease of maintenance, but currently v3 is in the RC stage, and v2 doesn't work with the latest versions of Node.js, so this seems worthwhile until v3 graduates to a full release. Closes #3795.
1 parent 8dfe288 commit 8955c99

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.github/workflows/jsdom-ci.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,29 @@ jobs:
2929
env:
3030
TEST_SUITE: 'node-canvas'
3131
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- node-version: '20'
37+
canvas-version: '^2.11.2'
38+
- node-version: '22'
39+
canvas-version: '^3.0.0-rc3'
3240
steps:
3341
- uses: actions/checkout@v4
3442
with:
3543
submodules: 'recursive'
3644
- uses: actions/setup-node@v4
3745
with:
38-
node-version: '20'
46+
node-version: ${{ matrix.node-version }}
3947
- name: Install required image manipulation packages with APT
4048
run: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
4149
- name: Setup HOSTS file for Web Platform Test server
4250
run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts
4351
- name: Install dependencies
44-
run: npm ci
52+
run: npm ci && npm install canvas@${{ matrix.canvas-version }}
4553
- name: Run tests
46-
run: npm install canvas && npm test -- --retries 1
54+
run: npm test -- --retries 1
4755
build:
4856
name: Tests
4957
runs-on: ubuntu-latest

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"xml-name-validator": "^5.0.0"
4747
},
4848
"peerDependencies": {
49-
"canvas": "^2.11.2"
49+
"canvas": "^2.11.2 || ^3.0.0-rc3"
5050
},
5151
"peerDependenciesMeta": {
5252
"canvas": {

0 commit comments

Comments
 (0)