I am just starting with testing JS modules, and while all the tests go well (I went with Mocha), I have a problem, while this requires some document attributes:
var baseTag = document.getElementsByTagName('base');
it raises the following error:
Mocha 'Uncaught ReferenceError: document is not defined'
my test run command:
mocha -u bdd test.js --reporter spec
now my question is: do I need some PhantomJS (or a simillar tool) for testing, when do I need acces for documents and DOM objects? Or I'm just open to any advice on how this should be allowed.
source
share