Sorry friend, but according to their website, PhantomJS does not support the HTML5 audio
or video
elements, thus the HTMLAudioElement
constructor will not exist.
You can get your tests to pass by having a condition around that code checking for compatibility with unsupported browsers, maybe using something like Modernizr?