Robust distances for outlier-free goodness-of-fit testing