-
Notifications
You must be signed in to change notification settings - Fork 145
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
error was thrown in afterAll with angular 5 #79
Comments
@biaggi I was getting similar error and downgrading the jasmine to 2.99 version solved the issue for me. Try it. |
@varnit-abraham Thank you for your help, but seems that the problem is a different one, the npm list it's already reporting that jasmine's version is 2.99
|
Thank you @varnit-abraham that seems to have fixed my issues, but do you know why this was causing issues? There must be some breaking change with Jasmine 3.0.0 but I'm not sure what library it's conflicting with. |
Same issue here, and the version downgrade also solved the case:
|
You are right... there must be some sort of dependency there that depends directly from [email protected] It works installing such package. Thank you all and I'm sorry for not trying it before |
@biaggi after install [email protected] it show cannot read property has undefined. Thanks in advance |
@biaggi i solved it!! after install [email protected], install jasmine-core@^2.99.0 as well! try it "jasmine": "^2.99.0", |
Looks like might be a problem with karma-jasmine-html-reporter
Reverting back fixes the issue
|
"jasmine": "^2.99.0", Doesn't seem to fix it for me :/ |
@jackrvaughan Make sure you downgrade your Take a look at my PR here: (https://github.com/ionic-team/ionic-unit-testing-example/pull/87)[https://github.com/ionic-team/ionic-unit-testing-example/pull/87] |
EDIT: I had an unrelated issue (one of my tests was broken) that was throwing this same error. Sorry! Thanks for the reply @leifwells ! I just noticed that this was an ionic specific thread. I don't use ionic, webpack, or ts-loader; but am hitting this issue all the same.
|
I was facing the same error. ./package.json
Good luck! |
Facing this issue after doing all: |
I added ts-loader:3.5.0 and typescript: 2.8.4 and it worked for me in Angular 5, ionic 3, Karma 1.71 and jasmine2.99.0 : "devDependencies": { |
Seems like angular/karma/jasmine still have this issue. I was using angular 10, jasmine 3.6, karma 5 and still ran into this issue. I did not write the afterAll anywhere and yet this was failing. The reason was async operations that were returning Observable. Fix was to pass "done" function parameter to all test cases which were expecting aboe async behaviour and calling "done()" at the end of it something like below.
Here, ngOnInit makes ajax call to get some data. Above test case expects to not get any data and instead show some message to user hence the falsy assertion. I had to to this in all of my test cases where Observable was being used. Additionally, there were alot of default generated tests that were not taking care of this. So I cleaned up those to either remove them or fix them like above. And then I fixed all other such cases and now it works everytime in my CICD pipeline. So in general if you are getting this error, chances are some mocking is not right or you are not using done() function. Also, for reference, read @FDIM's comments at https://github.com/angular/angular/issues/33800. |
I've followed the instructions, but when I execute npm run test, I'm receiving the following error:
Result for ionic info is the following one:
My android version is 5 instead of 4 as you can check in the package.json uploaded in the repository https://github.com/biaggi/karma-test-failing. Any hint on what's happening there?
The text was updated successfully, but these errors were encountered: