Skip to content
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

Unit tests produce errors and warnings but do not fail #1509

Closed
faboweb opened this issue Nov 1, 2018 · 6 comments · Fixed by #1542
Closed

Unit tests produce errors and warnings but do not fail #1509

faboweb opened this issue Nov 1, 2018 · 6 comments · Fixed by #1542
Assignees
Labels
bug 🐛 issues related to unhandled errors in the code that need to be fixed

Comments

@faboweb
Copy link
Collaborator

faboweb commented Nov 1, 2018

Warnings and errors should produce an exit code 1 to show the tests have failed.

@faboweb faboweb added the bug 🐛 issues related to unhandled errors in the code that need to be fixed label Nov 1, 2018
@NodeGuy
Copy link
Contributor

NodeGuy commented Nov 1, 2018

Can you provide any examples?

@faboweb
Copy link
Collaborator Author

faboweb commented Nov 1, 2018

i.e.

 PASS  test/unit/specs/store/store.spec.js
  ● Console

    console.error app/src/renderer/vuex/store.js:87
      Encrypting the state failed, removing cached state.
     [vue-router] missing param for named route "validator": Expected "validator" to be defined
    console.warn node_modules/vue-router/dist/vue-router.common.js:18

@NodeGuy
Copy link
Contributor

NodeGuy commented Nov 2, 2018

Your first example (Encrypting the state failed, removing cached state.) is a result of expected behavior from a passing test. The test is deliberately provoking the error message.

@faboweb
Copy link
Collaborator Author

faboweb commented Nov 2, 2018

Shouldn't then the console.error function be mocked out?

@NodeGuy
Copy link
Contributor

NodeGuy commented Nov 3, 2018

That would be one way to approach it, yes. I think a better design would be to throw an exception and let higher-level code decide how to report it.

@faboweb
Copy link
Collaborator Author

faboweb commented Nov 3, 2018

Also a good strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 issues related to unhandled errors in the code that need to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants