karma html reporter not working as expected - karma-runner

I am working on a MEAN stack app using karma-jasmine as unit testing framework I am trying to find a good html reporter for unit testing results
first I tried karma-jasmine-html-reporter but it not live reload the debug page I had to refresh it maually and this cause me stuck many times and thought the issue is in my code till I remember I have to reload the page!
I found this one also karma-jasmine-html-reporter-livereload but it not working at all the debug page is blank and an error in the console
jasmineRequire is not defined
Finally I tried this one karma-html-live-reporter the debug page is empty but with no errors in console and I can see the result of the tests logged in the console
EDIT:
I found a solution with this one when I read the log carefully I found that live html reporter is not working on debug page as expected but on localhost:5060 !! which is very strange
but when I go there I found everything working perfect
how to configure karma to open this port automatically?
package.json:
"jasmine-core": "^2.5.2",
"karma": "^1.6.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-jasmine-html-reporter-livereload": "^1.0.0",
please anyone has a similar situtaion could help or suggest something!
Thanks in advance!

Related

Bit.cloud not showing my components tests

Bit.cloud is not showing my tests, but they are right there, and they show when running bit start locally. Sadly, the link on the no tests page directing me to learn how to add tests goes to a 404.
I the workspace is public, have a look and see here, the first link the is "tests" tab showing empty, https://bit.cloud/koodoo/koomeleon/second-charge/validation/~tests, and this link is a test for the the same component https://bit.cloud/koodoo/koomeleon/second-charge/validation/~code/eligibility/dateOfBirth/index.test.ts.
Also, side note, can I get an invite to the Slack workspace please? Again the link on the bit.cloud page goes to a sign-in page for the workspace bit-dev-community, but there is no way of registering or requesting an invite.
Please and thank you in advanced.
Explanation
The reason your tests are not being show is due to its extension.
Tests are configured to use the .spec.ts extension to work.
Solution
Having said so, rename your test to:
vaidation.spec.tsx
and it will work.
edit: forgot to add the 'x' at the end of '.tsx'

Weird BaseOptions problem in Dio 4.0.0 (Dart)

I met some strange behavior, which got my mind blow out.
I have a piece of code
import 'package:dio/dio.dart';
...
var baseOptions = BaseOptions(
baseUrl: "http://localhost:8080");
If I run it from simple Dart console program I got this in debugger which at final works OK:
However when I do THE SAME THING somewhere inside Flutter stuff, I get this weird thing which doesn't work:
What's going on here? What am I doing wrong in the Flutter case?
I finally found the answer. I was wrong with my assumptions in this question, but I will not delete it for people who would have the same root cause analysis path as me.
First of all my problem was not weirdness in BaseOptions. The actual error I got from Dio was just string: "XMLHttpRequest error". I started to find anything strange and found divergence in BaseOptions which led me to idea that the problem was the weird BaseOptions. Not it's not. The real root cause was with CORS. Since my build used web based Flutter and an app was opened in Chrome the CORS defense system started to work and prevented the requests from sending. In console Dart app everything was ok since there is no CORS involved. One more problem was that I used POST request type and a custom header, which both are also not very welcome for CORS policies.
So to fix my problem what I had to do - is to fix CORS.
But what is going on with BaseOptions? I don't know for sure but most likely it is related to the way how Dart code compiled to JS. Looks a bit ugly in debugger, but it seems JS needs to know which field comes from which place for some reason.

Login with remembering tests not failing

Normally I'd be happy my tests are passing, but not in this case. I'm going through the tutorial again, making my own app. So I have a few differences with the tutorial code, which are (hopefully) just cosmetic. All the logging in and session stuff should be the same.
After slogging through Section 8.4.2 Login With Remembering, the tests are supposed to fail (listing 8.37), because there's no way to log out. But mine pass.
Does anybody know which test is supposed to fail? I don't know how I will track down a problem without a failure.
I missed the section on logging out. After adding that code, I get an expected failure in "login with valid information followed by logout"
delete logout_path
assert_not is_logged_in?
assert_redirected_to root_url f
ollow_redirect!
assert_select "a[href=?]", login_path <----- fails

Why is Eclipse's HTML viewer randomly showing previous output and an error?

Well, this video shows my problem best : http://www.youtube.com/watch?v=yDeChV254Ck&feature=youtu.be
If I have a page that is proper/ok, everything works fine and as expected.
If I purposely induce an error (which I have been doing loads of whilst learning!), Eclipse doesn't show an error at all inline/red underline, and, when I try to run, it will either display an error (which I expect it should be doing every time), or it will randomly display the last successful build.
I can (remotely) understand the logic of alternating, maybe someone would want to see the previous output, but, this is just completely random - no logic at all, so, I just don't understand why it is happening.
Does anyone know what is going on?
edit - been able to recreate this on a brand new install. What is going on!?

Can't write code in FBrell code window

At fbrell.com I want to test some code and to see code of theirs existing examples. But, in none of the following browser IE8, FF3, Chrome I can't write anything in the text area. When I go to Save Code of an existing example there is for a second shown code of that example and after that it dissapears. Same thing happens at my home and my work PC.
Googling about this problem wasn't successful.
How to do it?
FBrell console is implemented in Facebook, JavaScript Test Console try it if it didn't work, try clearing the cache.