Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma test exception in angular2 application

Can I get a better log or something? I don't have a clue where to look for the error.

Chrome 57.0.2987 (Linux 0.0.0) ERROR
  Uncaught Response with status: 0  for URL: null
  at webpack:///~/rxjs/Subscriber.js:238:0 <- src/test.ts:737
PhantomJS 2.1.1 (Linux 0.0.0): Executed 31 of 31 ERROR (1.258 secs / 1.352 secs)
like image 344
heldt Avatar asked Nov 08 '22 00:11

heldt


1 Answers

Your code is making an HTTP request and failing. Per the error message, the URL is null and the status code is 0. 0 isn't an actual HTTP status code, but it can mean a timeout occurred. This Stack Overflow question and answer has some pointers on what 0 can mean.

I ran into this when testing a component. Mocking the HTTP request solved the problem. For how to do that, I recommend this thoughtram article on testing HTTP services.

like image 93
jody tate Avatar answered Nov 15 '22 12:11

jody tate