Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Update to work with jsdom v10+ #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmrwoods
Copy link

jsdom v10 introduced a new api, incompatible with previous versions.

This caused "TypeError: require(...).jsdom is not a function" when
jest-environment-jsdom-debug was used with jsdom v10 or later.

As new versions of jsdom still support the old api for now, fix by
requiring the "old api", which is available on the new versions, and
fall back to the previous code otherwise.

Note use of var to get around block scoping of const with try/catch.
I'm not a javascript developer, I just need to do some quick and dirty
work on a js project and I want a debugger. My code probably sucks,
please, please feel free to change to something more appropriate.

jsdom v10 introduced a new api, incompatible with previous versions.

This caused "TypeError: require(...).jsdom is not a function" when
jest-environment-jsdom-debug was used with jsdom v10 or later.

As new versions of jsdom still support the old api for now, fix by
requiring the "old api", which is available on the new versions, and
fall back to the previous code otherwise.

Note use of var to get around block scoping of const with try/catch.
I'm not a javascript developer, I just need to do some quick and dirty
work on a js project and I want a debugger. My code probably sucks,
please, please feel free to change to something more appropriate.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant