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

Make the code testable #41

Open
2 tasks
mlazowik opened this issue Jun 3, 2017 · 1 comment
Open
2 tasks

Make the code testable #41

mlazowik opened this issue Jun 3, 2017 · 1 comment

Comments

@mlazowik
Copy link
Contributor

mlazowik commented Jun 3, 2017

Most of the existing tests are slow and rely heavily on running shell processes. Source itself also relies on shell, for example for git. This makes testing hard, especially when you'd want to mock something like git push.

In current tests git push always fails and it's ignored. There is no positive test for --post-success. I need to add a regression test for --post-success failing, for now I'll add a --mock-push option, because any other way requires significant changes, like:

  • use nodegit
  • make it possible to call the whole program from js instead of doing shell.exec (this will make mocking components possible)
@leonardoanalista
Copy link
Owner

Hi Michal, thanks for your input. You are right. All unit tests are actually integration. They test against a real git repo. It is very hard (impossible) to test and mock post success as it will never succeed. Our friend Brett U added post success flag not too long ago. It was in the latest release.
I had a quick look at nodegit. It looks good. As far as I remember, semantic-release use to use it too.
This is a refactoring for sure. Regarding to the behaviour changes you suggested, we can discuss in the previous issue you created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants