Miscarriage and pregnancy test

How far after a miscarriage will you test positive for pregnancy?