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

Feature request: when pretendToBeVisual is false, "requestAnimationFrame is not defined" should be a more informative error #3689

Open
DanKaplanSES opened this issue Mar 2, 2024 · 0 comments

Comments

@DanKaplanSES
Copy link
Contributor

DanKaplanSES commented Mar 2, 2024

Basic info:

  • Node.js version: 20.10.0
  • jsdom version: 24.0.0

Minimal reproduction case

import { JSDOM } from "jsdom";

const { window } = new JSDOM("", {
  pretendToBeVisual: false,
});

window.eval(`requestAnimationFrame`); // ReferenceError: requestAnimationFrame is not defined

How does similar code behave in browsers?

window.eval(`requestAnimationFrame`); // ƒ requestAnimationFrame() { [native code] }

Feature request

Instead of erroring with ReferenceError: requestAnimationFrame is not defined, I would like to request an error message like, ReferenceError: requestAnimationFrame is not defined because JSDOM's pretendToBeVisual option is set to false. This would help users resolve this error when they are unaware that JSDOM is even in use; in some contexts, JSDOM is a transitive dependency.

Once I hear feedback that this is a good idea, I might be able to create a PR for it.

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

No branches or pull requests

1 participant