jsdom hashchange event

On a jsdom document:

document = require('jsdom').jsdom("<html><head></head><body></body></html>");
window   = document.createWindow();

Changing its hash:

document.location.href = '#bang';

doesn't trigger any 'hashchange' event on window

Does anyone aware of a workaround for this?

Thank you

Check out the jsdom docs

Try this before the rest of your code:

require('jsdom').defaultDocumentFeatures = {
  FetchExternalResources   : ['script'], 
  ProcessExternalResources : ['script'],
  MutationEvents           : '2.0',
  QuerySelector            : false
}

var window = jsdom.jsdom(body).createWindow();