Allow setting maxDepth and test that it will give up