Fix test result wrapping in web runner

This is the proposed fix for #1030.