by usr1106 · 5y ago · 0 comments
However, it's in contradiction to TDD. If you have a bug (in master) the first thing you are supposed to do is to create a test that fails because of the bug. This is a self-contained commit, but it will not build (assuming your test are run during the build as they should). The next commit is fixing the bug and now it builds again.
So the commit with the new test should be marked as unsuitable for bisecting. How to do that easily in away that bisecting remains easy I have yet to work out.
In that case, you can have a merge request with a commit to add a test and then another commit to fix it. As long as both commits build, bisect will still work.
I agree with having CI enforce both passing tests and working builds, but why would you want the build step to require passing tests?
(ETA: It's easy to forget that the I in CI stands for "integration" and was always focused on merges of changes more than specific changes.)
If you want to work like that though one way to do it is to work in a branch/PR - building out your commit that fails, then your iterative commits - and then squash the branch into a single commit onto main layer on.
If anyone want to see your TDD tiny commits process later they can go and see it in the PR.