You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@filipesilva The results are different now, but still not correct.
Even though it's a standard cli application, I created a repo to base the discussion on. I recreated the application from scratch with the CLI 1.0.0 and Anuglar 4.0.0 version, to be sure I'm not encountering any bugs because of mismatching version when updating.
Now when I run ng test the first time, everything work. As it did before.
Then changing the code in app.component.ts behaves as expected. For example changing 'test' to 1 fails. Great so far. :)
If I keep 'test' in AppComponent, and instead change the type property in common.d.ts from string to number, it successes. Not good.
If I keep the type change and stop and restart ng test it still succeeds, which it shouldn't...
Then changing 'test' i AppComponent to 1 succeeds (as it now should), BUT when changing 1 back to 'test' it falis (as it should).
This is very confusing to me, especially when the behavior isn't consistent. My guess is some sort of type caching not updating correctly...
Hope you could follow my steps here, and am able to reproduce this issue. Otherwise it must be something in my platform. The fact the I can now run my tests without single-run as long as I don't change my typings is i big step forward and a time saver.
I'm experiencing a similar issue as well. I'm on cli, 1.0.0-rc.2 but our ng version is at 2.4.9. Karma is 1.5, typescript is 2.1.6. Running a test the first time works as expected, make a simple change to kick off another test run and the build will randomly fail with some random typescript error, such as 'HTMLInputElement' not found, for what appears to be a problem with the typings get lost. This doesn't appear to be an issue that occurs every time, seems to be a bit random. I've been noticing this off and on for about a week. Not sure the root cause, but the above sounds like a match.
@bialad ah, that exist exists but it's a different one! #5634 seems to be related to interfaces and probably all .d.ts files instead. We're tracking it there instead.
@boldwade unfortunately to fix this you really need to update to 1.0.0, that's when the fix landed.
Activity
tmansson commentedon Mar 9, 2017
After fiddling some more with this I notice that the typing error actually stops the rebuild, and runs the test again with the previous build.
This make it look like the test succeeds even though the typing fails, but it's just showing a result from a previous build.
To be able to run tests that actually tests my current code, I need to use
ng test --single-run true.fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
1 remaining item
fix(@angular/cli): fix test typings
fix(@angular/cli): fix test typings
tmansson commentedon Mar 21, 2017
I'm sorry to say that it still doesn't work with the application I created for this issue. I updated to rc4 as shown here:
The change I see is that the test no longer succeeds, which is certainly an improvement. :)
Am I doing something wrong by adding a d.ts file like this.
ng serveandng buildworks fine with this setup, just like before.filipesilva commentedon Mar 24, 2017
@bialad it should be working now... can you show me your
src/tsconfig.spec.json?As part of the changes in that PR, we modified the default unit test tsconfig to actually include
.d.tsfiles, which it didn't before.We added it to https://github.com/angular/angular-cli/wiki/stories-1.0-update but I should have come back here to tell you that.
If you do this change, does it work?
tmansson commentedon Mar 25, 2017
@filipesilva The results are different now, but still not correct.
Even though it's a standard cli application, I created a
repoto base the discussion on. I recreated the application from scratch with the CLI 1.0.0 and Anuglar 4.0.0 version, to be sure I'm not encountering any bugs because of mismatching version when updating.Now when I run
ng testthe first time, everything work. As it did before.Then changing the code in app.component.ts behaves as expected. For example changing
'test'to1fails. Great so far. :)If I keep
'test'in AppComponent, and instead change the type property in common.d.ts fromstringtonumber, it successes. Not good.If I keep the type change and stop and restart
ng testit still succeeds, which it shouldn't...Then changing
'test'i AppComponent to1succeeds (as it now should), BUT when changing1back to'test'it falis (as it should).This is very confusing to me, especially when the behavior isn't consistent. My guess is some sort of type caching not updating correctly...
Hope you could follow my steps here, and am able to reproduce this issue. Otherwise it must be something in my platform. The fact the I can now run my tests without
single-runas long as I don't change my typings is i big step forward and a time saver.boldwade commentedon Mar 26, 2017
I'm experiencing a similar issue as well. I'm on cli, 1.0.0-rc.2 but our ng version is at 2.4.9. Karma is 1.5, typescript is 2.1.6. Running a test the first time works as expected, make a simple change to kick off another test run and the build will randomly fail with some random typescript error, such as 'HTMLInputElement' not found, for what appears to be a problem with the typings get lost. This doesn't appear to be an issue that occurs every time, seems to be a bit random. I've been noticing this off and on for about a week. Not sure the root cause, but the above sounds like a match.
filipesilva commentedon Mar 26, 2017
@bialad ah, that exist exists but it's a different one! #5634 seems to be related to interfaces and probably all
.d.tsfiles instead. We're tracking it there instead.@boldwade unfortunately to fix this you really need to update to
1.0.0, that's when the fix landed.angular-automatic-lock-bot commentedon Sep 6, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
fix(@angular/cli): fix test typings