The Merlin engine in question, which was intended for a Falcon 9 launch later next year, was undergoing a 'qualification test' when it exploded. Obviously, any sort of unexpected combustion is worth preventing, especially for a company that has lost rockets (and the multimillion-dollar payloads they were carrying). Better on a test bed than on a loaded launch vehicle, though, especially while SpaceX is having its best year ever with 16 successful missions (double its total in 2016) -- with three more Falcon 9 launches scheduled, according to The Washington Post.
It's unclear if this issue is with a singular engine or with the Merlin propulsion system in general. The Falcon 9 uses nine of them in its first stage, while the Falcon Heavy, which is scheduled to have its first launch this month, fields 27 in its first stage. For the record, Musk and company plan to use a new engine design, the Raptor, for its BFR launch vehicle headed to Mars.