-
Notifications
You must be signed in to change notification settings - Fork 12k
Testing directly with karma #10703
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
Comments
This also breaks integration with the test runner in WebStorm & IDEA ... it's not possible to run tests from WebStorm any more by pressing the "green triangles" next to the test code :-( |
Anybody know any alternative on running the tests? I just migrated to angular 6 as well. Now I can't run our tests. Wondering what's the suggested way to run test now? Do I need some cli configuration or something? |
@josephharveyangeles You can tunnel everything via the angular cli like
|
For the IntelliJ (WebStorm, IDEA) integration the issue is tracked here: |
Obviously this was broken by #10478 but the issue doesn't say why this is an error now.. Also, please vote on https://youtrack.jetbrains.com/issue/WEB-32653 if you are affected. |
FYI, according to the jetbrains ticket, the issue will be fixed in IDEA 2018.1.4 |
Still broken on:
|
And it is still broken on
|
@timdoes It works if you create a new run configuration. It will detect Cli and use it as Karma engine. If you run an old configuration still pointing to a global/local karma instance, it fails. |
@AlexGS74 That worked. Thanks! |
@maprox Latest released version of Webstorm is 2018.1.3. It doesn't support this as it was release before Angular Cli 6 release. |
According to the WebStorm Release Notes this should be fixed: https://confluence.jetbrains.com/display/WI/WebStorm+181.5087.27+Release+Notes |
Hi, I have updated IntelliJ IDEA to 2018.1.4 (Build #IU-181.5087.20, built on May 16, 2018) and the Karma plugin to 181.5087.27 and now it works, provided you point your Karma package to your Angular-CLI package and not to your Karma package (as suggested by @AlexGS74). |
@maprox - Fixed it, once I updated the Karma plugin. |
This is not just an intellij issue. I am running into this problem on macOS running "karma start" from the command line and I get this error. I'm using Angular 6.0.4 and karma 2.0.2
If there is a work around for this environment, please let me know. |
@Zephilim I mentioned this solution in an above comment: Tunnel the karma config via ng test:
|
@krokofant does your command solve the problem exposed by @jbandi : "running the test from the green triangles in webstorm next to the test code" |
Thanks krokofant, I guess I didn't really get what you meant by tunnel. I actually discovered (by accident) another way of running the coverage and that is simply "ng test --code-coverage", just not very well documented. |
For me updating webstorm it helped |
doesn't help if you want to use @angular-devkit/build-angular without @angular/cli |
The original issue as the author has stated is that upgrading to Angular 6 has broken the ability to do: This by itself has nothing to do with Webstorm, and many of us don't use that IDE. Is there any resolution to this problem as stated? |
@krokofant Tunneling it via I'm really disappointed that there is no option to go without @angular/cli. We've ejected our Angular project two years ago and now after long and painful upgrade to Angular 6 (there is almost no documentation for upgrading ejected projects) we are left with @angular/cli@1.7.4. |
I fixed this problem by removing and re-enabling the This will tell karma to use |
Well, we have found a workaround: We ditched Karma and replaced it with Jest. I just wonder why ejected and non-cli solutions are left behind with many issues and no documentation. :( |
Having the same issue, really don't want to have to start over with another testing framework, any fixes? We don't use the Angular CLI and we have a hybrid AngularJS/Angular 6 app, reason which we are not using the CLI, the project is too big and too costly for an immediate migration. |
This is just going to encourage developers to ignore tests and they are so difficult to set up and there is so much information out there that is just plain wrong. I wanted some html reports for our build server, been at it hours now and still nothing? Really lost, this is so easy in JAVA with JUNIT, why so difficult using Angular 6 ??? Edit: - This might be useful so I have added it here. https://medium.com/welldone-software/an-overview-of-javascript-testing-in-2018-f68950900bc3
And this will help you get started with Jest. |
@peter-snr this issue doesn't seem to be related to your problems. This isn't stack exchange, but karma-jasmine-html-reporter doesn't do what you think it does. It provides a nice interface to show in the browser while your test are running, not a final HTML report. Given your JUnit comment, you might be interested in karma-junit-reporter (remember to also add it to the reporters array). |
Did anyone encountered |
When you go to Run/Debug Configurations, make sure the Config file is set to your src/karma.conf.js and your Karma Package is pointed at your node_modules/@angular/cli ... |
@cport1 . I think I've setup all of theese. This is my IDE configuration: And this is the output:
As you can see, even if I set my |
@jcwolf Node might be running out of memory; this started happening to me and I added
to the Node options in the debug configuration. It could also mean a type error. WebStorm occasionally swallows these, so make sure your tests can compile 'ng test --watch=false' from a terminal. |
@avoerman The tests are running fine from terminal (when I run inside the docker container) but In WebsStorm/PHPStorm it fails with the same error. Maybe I have to set something similar to |
In the CLI we want to provide a well encapsulated build; invoking the tests manually with karma breaks this encapsulation. I'd recommend you to use the solution from this comment #10703 (comment). If I've missed something or misunderstood your use case, please open a new issue with details. |
@mgechev Problem is when that encapsulated build has issues. See #11672. The tight coupling here isn't making angular robust. Really don't want to be without test coverage reporting even though I let my tests drive implementation. And yes, I should look more into the issue myself and help fix it but right at this moment, I don't have the time. I'm also sure there are a billion other use cases where you don't want to be forced to use |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Windows 10
Repro steps
Run karma start karma.conf.js
Observed behavior
Desired behavior
Be able to run test directly with karma as before version 6
This became a problem after upgrading to version 6.
The text was updated successfully, but these errors were encountered: