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

Does not work on node 17 or above, requires node 16 #39

Open
Charuru opened this issue Oct 26, 2022 · 7 comments
Open

Does not work on node 17 or above, requires node 16 #39

Charuru opened this issue Oct 26, 2022 · 7 comments

Comments

@Charuru
Copy link

Charuru commented Oct 26, 2022

Seems like this is known? f78b1b5

Is there any plan to fix this or is it just stuck on 16 forever?

@badeball
Copy link
Owner

Seems like this is known? f78b1b5

No, it just means that 16 was most recent at the time of writing. Is there something not working on 17+?

@Charuru
Copy link
Author

Charuru commented Oct 26, 2022

Oh okay, 17&18 was out at that time so I assumed. Just doesn't start for me on 16+ and there are other reports on google.

https://stackoverflow.com/questions/70278340/unable-to-run-karmajsdom-tests-on-nodejs-17-x

26 10 2022 11:46:04.352:WARN [karma]: No captured browser, open http://localhost:9876/
26 10 2022 11:46:04.378:INFO [karma-server]: Karma v6.4.1 server started at http://localhost:9876/
26 10 2022 11:46:04.379:INFO [launcher]: Launching browsers jsdom with concurrency unlimited
26 10 2022 11:46:04.381:INFO [launcher]: Starting browser jsdom
26 10 2022 11:46:04.401:ERROR [karma-server]: UnhandledRejection: Error: connect ECONNREFUSED ::1:9876
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16)
26 10 2022 11:46:04.401:ERROR [karma-server]: Error: connect ECONNREFUSED ::1:9876
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 9876
}

Also what do you think about converting this to happy-dom instead?

@badeball from what I see then callback never happens.

      jsdom.JSDOM.fromURL(url, jsdomOptions).then(function (dom) {
        self.window = dom.window;
      });

@badeball
Copy link
Owner

This might be of interest to you.

Can you try running tests with NODE_OPTIONS=--dns-result-order=ipv4first ..?

Also what do you think about converting this to happy-dom instead?

I think a happy-dom integration should exist as a separate package.

@Charuru
Copy link
Author

Charuru commented Oct 26, 2022

That does fix it, are you able to use 16+ without that option?

@badeball
Copy link
Owner

It's a bit up to you. You can either run your app and have it listen on both ipv4 and ipv6, in which case all node versions are going to work or you have to tell node and jsdom what you mean when you ask it to access "localhost". You can change the default from the runtime like so:

import dns from "node:dns";
dns.setDefaultResultOrder("ipv4first");

@badeball badeball reopened this Oct 26, 2022
@badeball
Copy link
Owner

badeball commented Oct 26, 2022

Wait, karma is the app in this context (I forget what repo I am in..). Maybe we can make some assumptions about it. Leaving this open for now.

@Charuru
Copy link
Author

Charuru commented Oct 26, 2022

I don't understand, where do I do this? Shouldn't it be handled by the launcher?

Other launchers like ChromeCanaryHeadless that I'm also using works fine without any changes.

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

2 participants