-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
One failing test causes other async tests to fail in the Karma DEBUG RUNNER #2811
One failing test causes other async tests to fail in the Karma DEBUG RUNNER #2811
Comments
Use console.error to log errors to the console instead of throwing an error. This makes sure that errors are scoped properly for asynchronous tests, instead of showing up as uncaught errors on all asynchronous tests. Fixes #2811
Use console.error to log errors to the console instead of throwing an error. This makes sure that errors are scoped properly for asynchronous tests, instead of showing up as uncaught errors on all asynchronous tests. Fixes karma-runner#2811
@daanstolp I think this has resurfaced. Using Angular CLI 6.0.6 (karam ^2.0.4). If a component throws an error (in our case we have a validator that throws an error if it's used incorrectly), the next test will fail. Running the tests in isolation will return a success. In our case, we have a custom validator that matches two fields, but if the selected field does not exist the validator with throw an error. This causes the next it() test to fail. |
@michael-letcher I'm encountering this with such code:
If I test in isolation, it works, if I run all tests, the second one fails. |
Consider the following tests (in Jasmine), where the first is synchronous and the second is asynchronous:
Expected behaviour
Actual behaviour
Environment Details
karma --version
): 1.7.0karma.config.js
file is default out of the box, configured to load '*.js' files.Steps to reproduce the behaviour
npm init
npm install karma karma-jasmine jasmine-core karma-chrome-launcher --save-dev
test.spec.js
and add the test code that is listed above.karma init
and accept all defaults. Enter*.js
and*.spec.js
as files location."test": "karma start"
to the package.jsonscripts
section.npm run test
Debug
button to open the Karma DEBUG RUNNER.The text was updated successfully, but these errors were encountered: