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

Problem with RC and jsdom #2390

Open
1 task done
brettz9 opened this issue Jun 20, 2024 · 0 comments · May be fixed by #2409
Open
1 task done

Problem with RC and jsdom #2390

brettz9 opened this issue Jun 20, 2024 · 0 comments · May be fixed by #2409

Comments

@brettz9
Copy link
Contributor

brettz9 commented Jun 20, 2024

Issue or Feature

Not sure whether you'll treat this as a jsdom issue (in case jsdom has to change its API or something), but with the RC release, jsdom no longer works.

Steps to Reproduce

With jsdom version 24.1.0

import jsdom from 'jsdom';

const {window: {document}} = new jsdom.JSDOM('');

const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');

...gives:

/Users/brett/typeson-registry/node_modules/.pnpm/jsdom@24.1.0_canvas@3.0.0-rc2/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:116
  ctx[name] = function (image, ...rest) {
            ^

TypeError: Cannot assign to read only property 'createPattern' of object '#<CanvasRenderingContext2D>'
    at wrapNodeCanvasMethod (/Users/brett/typeson-registry/node_modules/.pnpm/jsdom@24.1.0_canvas@3.0.0-rc2/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:116:13)
    at HTMLCanvasElementImpl.getContext (/Users/brett/typeson-registry/node_modules/.pnpm/jsdom@24.1.0_canvas@3.0.0-rc2/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:35:11)
    at HTMLCanvasElement.getContext (/Users/brett/typeson-registry/node_modules/.pnpm/jsdom@24.1.0_canvas@3.0.0-rc2/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
    at file:///Users/brett/typeson-registry/.idea/canvas.js:6:20
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:106:12)

Node.js v18.20.3

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): 3.0.0-rc2
  • Environment (e.g. node 20.9.0 on macOS 14.1.1): v18.16.0 on macOS 14.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant