Closed PiyushGirdhar closed 4 years ago
"An Error was thrown in afterAll"
This message means that an error was thrown outside of any test. For example you could have a statement at file level which has a TypeError or an async event that failed and threw.
Use --noSingleRun
then open devtools on the browser. You will see the error in the console.
Hi, Thanks for your reply.
Console log didn't print the error unfortunately. I've 655 test cases in my code. When I run 655 test cases, all of them run perfectly fine and just after that the error pops up and my build fails. Also, I tried running only one test case, the error still appeared.
So It won't be right to say that "Any test failed and threw this error". I was using Karma Jasmine 1.1.2 as suggested by Angular and it never threw such an error until I upgraded to its latest version. And, the only reason was to increase Jasmine.Default_Timeout_Interval which is only supporeted in >2 version.
Please see if you can help. Thanks in Advance.
This kind of message is a new feature, which explains why we see the problem when you upgrade. I bet the problem always existed but you did not see it.
We made this change because sometimes application errors went undetected, but the error does not mean the tests or apps are actually broken. This could be a side effect of how app code is used in tests.
In the debugger you can find the statement that emits the message and perhaps that will guide you to find the issue.
Nope. Finally made it. There was no error in my code. Had to upgrade "jasmine-core" to 3.5.0 to make it work.
Thanks :)
And there are no unit test cases named afterAll and all of the test cases passed. Once all the specs ran succesfully, then "An Error was thrown in afterAll" appears. Can you please help, what's wrong? "devDependencies": { "@angular/cli": "^1.4.10", "@angular/compiler-cli": "^4.2.4", "@angular/language-service": "^4.2.4", "@types/echarts": "^4.1.9", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "~3.2.0", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "^1.7.1", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "^3.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "puppeteer": "^1.20.0", "ts-node": "~3.2.0", "tslint": "~5.7.0", "typescript": "~2.3.3" }
Tried changing jasmine-core and karma versions but nothing worked.