In the script I'm developing, I check to see if a variable is instanceof HTMLAudioElement
. When I run QUnit via a grunt task, it fails with
>> Message: Died on test #1 at file:///path/test/lib/qunit.js:425
>> at file:///path/test/all.js:24: Can't find variable: HTMLAudioElement
>> ReferenceError: Can't find variable: HTMLAudioElement
all.js
doesn't actually reference HTMLAudioElement
itself, it just calls some code in my main script that would use it.
All the tests pass when I open all.html
in Firefox, Chrome, or Safari.
Is this expected behavior? Is it using some sort of browser emulation that doesn't have that constructor? Does this mean that my code will fail in some browser, or is this just misconfiguration that doesn't tell me anything useful? How do I fix it?