delete window.propertyName doesn't work
Closed this issue · 4 comments
eugeneglova commented
Run into a problem using mocha tests with jsdom, delete window.propertyName;
doesn't work. So after this command window.propertyName
is still defined. So my tests failed. I have workaround use window.propertyName = undefined;
which works fine, but I expected to use delete
keyword.
rstacruz commented
This is an issue with jsdom. window
comes from jsdom's document.defaultView
. Unfortunately I can't help you with this :\
You can replicate this issue by:
var jsdom = require('jsdom')
var html = '<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>'
var document = jsdom.jsdom(html)
var window = document.defaultView
window.lol = 2
delete window.lol
console.log(window.lol) // => 2
eugeneglova commented
@rstacruz thanks, I agree, going to close this one and open another one on jsdom repo.
eugeneglova commented
actually it's already there jsdom/jsdom#1622
rstacruz commented
cheers @eugeneglova, good luck!