question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when running karma without internet connection

See original GitHub issue

Expected behavior

I would expect to be able to run unittests even when I do not have an internet connection available. My internet provider decided to ditch my connection today, I was working from home and I thought well, while they fix this I’ll go write some more unittests. No go. Apparently something goes wrong when it tries to lookup address information (which is not available).

Actual behavior

I get the following error:

C:\Users\project_name\node_modules\karma\lib\runner.js:65
      throw e
      ^

Error: getaddrinfo ENOENT localhost:9877
    at Object.exports._errnoException (util.js:849:11)
    at errnoException (dns.js:31:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

Enviroment Details

  • Karma version (output of karma --version): 0.13.22 (reproducible on 1.3.0)
  • Relevant part of your karma.config.js file: None
  • Other info:
  • Running Windows 10.
  • Running this in Webstorm 11 (though it also happens running CLI commands).

See: https://github.com/RobertDiebels/karma-test/tree/master for further details.

Steps to reproduce the behaviour

  1. Disconnect from all your networks.
  2. run command karma start
  3. run command karma run --conf karma.conf.js --file jasmine-test.spec.js
  4. Behold the error message

This is reproducible on Karma version: 1.3.0 just ran the steps above again.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
maksimrcommented, Dec 18, 2016

I can confirm that problem exist, but problem in karma run command only

karma start work as expected, karma run does not work if disable network

karma-windows-problem
0reactions
yaacovCRcommented, Apr 23, 2017

Consider node-offline-localhost.

Add the following before the breaking code:

require('node-offline-localhost').always();

And it just works (hopefully), at least until RFC 3493 gets fixed.

Full disclosure: I authored this package to streamline https in my dev environment when offline.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why isn't my internet connection working? - Karma Mobility
Check your coverage. It's possible you're in an area without any. Our network partner is experiencing downtime. It's usually minor and should be...
Read more >
Is it possible to run Karma with no browsers at all?
I'm doing my development via SSH into a remote machine, which I think (let me know if I'm wrong) is pointless to have...
Read more >
Testing Angular Components with Stub Services and Spies in ...
Scenario: We'll be creating a component named students.component.ts. This component will handle below activities: Get the list of students from a service.
Read more >
Testing services - Angular
Here are some synchronous and asynchronous unit tests of the ValueService written without assistance from Angular testing utilities. app/demo/demo.spec.ts
Read more >
Run/Debug Configuration: Karma | IntelliJ IDEA Documentation
Install the Karma test runner as described in Karma. ... Build, no error check: the same as the Build option, but IntelliJ IDEA...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found