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
Code assumes clearImmediate #2398
Comments
The MDN page says it's implemented in Node.js 0.10+. I'm pretty sure it exists in 16.10.0. Not sure what's happening? |
I think it's because tests are running inside |
Tested the following code on: https://npm.runkit.com/jsdom const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const { window } = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
console.log({ clearImmediate: window.clearImmediate})
console.log({ setInterval: window.setInterval}) Output: Object {clearImmediate: undefined}
Object {setInterval: function()} |
yeah it would be great to get a failing test that we can build upon. But it seems that should be fixed in |
It does not seem like this method is/will be available on any modern browser and from what I've seen on jsdom repository, I do not believe they would add support for a deprecated feature, below is a note from MDN.
If you are okay with a function existence check, I could work on a PR. |
This was explicitly removed from JSDom because it isn't a browser standard. Most of the other libraries that have been affected by this have used an alternative to |
Running into the same issue, related to the pr above. Not sure why overriding node globals for a process running in Node was chosen but here we are. |
a workaround I'm using is to set:
|
As written in the README file, |
Please avoid duplicates
Reproducible test case
https://runkit.com/bpinto/nock-nock-2398
Nock Version
13.2.9
Node Version
16.10.0
TypeScript Version
No response
What happened?
Calling
nock.abortPendingRequests()
does a call toclearImmediate
internally, but this is not always available so an error is thrown.See:
https://developer.mozilla.org/en-US/docs/Web/API/Window/clearImmediate
testing-library/dom-testing-library#914
P.S.: Reproducible test case is hacky since the runkit environment does contain
clearImmediate
function and I had to delete it manually.Would you be interested in contributing a fix?
The text was updated successfully, but these errors were encountered: