By not telling them, you rob them of the choice to exercise their free will. Their reality is not theirs to see anymore. This is a betrayal potentially worse than the cheating itself. Their reality is now dictated by someone else without their consent.
Dishonesty is now a foundation of the relationship which has rippling effects.
Don’t neglect telling them because they don’t deserve the pain, tell them because you no longer deserve them.
Sometimes this isn’t the case and people cheat for understandable reasons, like the other partner being impossible to work with and constantly ignoring their needs — but in that case, leaving is probably the better option.