If the defendant admits the facts charged in the bill or petition and relied upon as the ground for a divorce, or the bill is taken for confessed, the court shall, nevertheless, before decreeing a divorce, except a divorce on the ground of irreconcilable differences, hear proof of the facts alleged as aforementioned, and either dismiss the bill or petition or grant a divorce, as the justice of the case may require.