-
Notifications
You must be signed in to change notification settings - Fork 12k
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
ng test not working after upgrade to 6.0.0 #10485
Comments
.angular.json
|
fixed after rc.8, but ng new still not work. |
Also tried
|
I also tried to replace, karma, tsconfigs, edited angular.json, replaced angular.json with one from a new project........ |
I'm running into a similar issue on @angular/cli 6.0.0. For me, the error line looks like |
I've done some more investigation. My Karma entrypoint file (which I had renamed from I confirmed that my I confirmed that my My suspicion is still that something is going wrong with the execution of my Karma main entrypoint file, since like I mentioned, any |
I got this same issue when using ng upgrade when upgrading to angular 6 on a cli project. |
I have the same issue. I've managed to get it to work simply by removing and adding the tests again. It worked without changing any configuration. In my case, I've pinpointed the tests down to 3, as soon as I turn any of them on again it throws the dreaded My guess is that there's some problem in the CLI that it doesn't surface errors and fails silently. |
I've got the same problem. Karma is running but no tests are executed. It looks like test.ts is not loaded |
I've managed to reproduce the bug with a clean Steps:Create a new project
Add the modules
Add this code to the app.component.spec.ts
Note:If I run Jest instead of Karma I get the following error:
Version:
|
Could be related to angular/angularfire#1597 Downgrading firebase and angularfire2 fixes it:
|
In my project all specs which tests components with jquery are affected. When deleting them it works. With angular 5.2 and cli 1.7 they worked. JQuery is defined in polyfills.ts. Still need to find out how to fix them. The specs not working cause of JQuery could be fixed by not using an import for JQuery:
my polyfills.ts looks like this:
Only one test left which fails because the component I use seems not to be Angular 6 ready. |
I just ran into this as well (
and my tests started executing again. It definitely seems like an error message is getting swallowed somewhere. |
I've checked code generated by jasmine. All specs are present but none of them are loaded. |
I'm facing the same issue mentioned above. It seems test.ts file is never executed |
I am experiencing the same issue, and I am ground completely to a halt for the time being :( |
Thanks to @herkulano for the mention that Jest ran and gave a real error message; as a workaround I dropped in Jest using a couple of the steps from here, and was able to execute my tests and see one failing and fix it... Except now all my tests pass with ¯\(ツ)/¯ |
After upgrading to jest I realized the issue was my version of angular fire 2. I downgraded angular fire to 5.0.0-rc.5-next and it started working again. The main issue is that the error is not being shown to the user. |
Same here, it seems after upgrading some tests were broken so I fixed them with Jest. However, karma is still failing. FYI: I'm not using firebase in my project. |
In my case problem was caused by rxjs. After removing old operators (and some refactoring to made it work) tests started to work again |
I have tried many different options, updated
Jest does run but requires many tests to be updated in our application which is not at option at the moment. Any guidance or tips appreciated! 🙏 |
I'm also experiencing this problem. I've also moved some tests from my existing app to the clean project and with some work they do run without any problems. Before upgrading to Angular 6 all tests were working fine. Jest is also not an option for our project since almost all tests need to be updated. I can confirm that the spec files are bundled by webpack and served to karma. However, inspecting the source tab in Chrome shows that there is indeed a part of the application missing. |
If that might help, for our configuration it was the presence of
where
|
@WilliamChelman this method did expose an issue with my paths which are defined in
The only change seems to be an addition of a
I am surprised no one from the team have weighed in on this as yet, not even to merely label the issue 😐 |
In my situation I had one spec file that silently failed the whole test run. After commenting out this spec, I was able to run tests again. To find the specific test, I ran Subsequently, I was able to find autogenerated service test, that caused the error. I am pretty sure, that the error was in beforeEach part, however I can't figure out the exact reason. Hope my comment helps someone. |
@AndriiKobzar Thanks for your Tip. I've used adjusted it a litte to walk through the components in the |
I also did several tests and modifications but still get the message If i create a new project it works without any problems. It's just not finding any tests in my existing project. |
#11011 Just some additional testing, rxjs-compat seems to be the culprit for me too. |
Holy moly this is an incredibly annoying issue. Using @AndriiKobzar method, came across a totally blank test file that ended in s.spec.ts. Looks like we have no other test that ended with that format, so running ONLY tests from Putting:
in the ONE blank test file allows it to run with one successful test. Not sure if this helps anyone, but my current plan is to just start slowly adding to this test till it breaks. |
My problem was with |
I'd like to look at this but really need a repro to investigate. Can someone put up a repro in github please? Then I can clone it and look into the problem. |
@filipesilva you can do reproduce it with these simple steps: |
@herkulano thank you for directing me to the repro, will look at it. |
@filipesilva to make it simpler I've created a repro with the problem: https://github.com/herkulano/ng-cli-issue-10485 |
@filipesilva Also really simple to reproduce like this:
|
Hey all, thanks for the reports. I think I know what was happening. It was two things together:
The first problem was fixed in angular/angularfire#1599 and released in @herkulano I got your repro to work by manually applying the changes in my PR and updating to If you want to try this yourself, open
with
@Ristaaf your repro seems to work fine if I add |
Greak work @filipesilva chunks: (chunk) => chunk.name !== "polyfills" fixed it!! Can't wait for update to update to angular 6 :) |
@filipesilva thank you, but you're missing the point. The solution is not fixing everyone's code. It's not having silent errors so that we can fix it ourselves. I already knew this was a problem with AngularFire, but the CLI or Karma gave me no pointers on where or why it was failing. I ended up moving to Jest, which had no problems showing exactly what was going on. |
@herkulano it gave you no pointers because of the problem I am fixing in angular/devkit#993.
|
@filipesilva cool, thank you! didn't understand you were actually fixing the underlying problem. |
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. |
After upgrading the cli the unit tests doesn't start anymore.
Previous behaviour was that the unit tests were found and executed. Now it does not find the unit tests and says 0 of 0 executed.
Versions
Repro steps
Observed behavior
The text was updated successfully, but these errors were encountered: