I’m using Angular 16.2 and karma / jasmine for unit tests
"jasmine-core": "~4.6.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
I found out that when a test fails with the well known error
Error: NG0304: 'app-sub-component' is not a known element
due to a missing declaration in the TestBed.configureTestingModule, running all test suites succeed although one of them fails.
I want the whole test run to fail when one of them fails.
I got it by adding
errorOnUnknownElements: true,
in the TestBed.configureTestingModule. As I have many tests I’d like to set it up globally for all test suites.
Another track was to add stopOnSpecFailure in karma.conf file
client: {
jasmine: {
random: false,
stopOnSpecFailure:true,
failFast: true
unfortunately with no success.
Any idea ?