Add tests to avoid StackOverflow error when there is a dependencies cycle between tasks