Shim for JavaScript environments where `window` may not exist (using jsdom)