let jsdom = require ( 'jsdom' ) ; ( < any > global ) . document = jsdom . jsdom ( '<body></body>' ) ; ( < any > global ) . window = document . defaultView ; ( < any > global ) . navigator = window . navigator ; ( < any > global ) . window . jQuery = require ( 'jquery/dist/jquery.js' ) ; ( < any > global ) . $ = ( < any > global ) . window . jQuery ; ( < any > global ) . window . Event = { } ; Object . keys ( document . defaultView ) . forEach ( property => { if ( typeof global [ property ] === 'undefined' ) { global [ property ] = document . defaultView [ property ] ; } } ) ; class MockStorage implements Storage { public length : number ; private items = { } ; [ index ] : string ; public clear ( ) { this . items = { } ; } public getItem ( key ) { return < string > this . items [ key ] ; } public key ( index ) { return this [ index ] ; } public removeItem ( key ) { this . items [ key ] = undefined ; } public setItem ( key , data ) { this . items [ key ] = data ; } } ( < any > global ) . localStorage = new MockStorage ( ) ; ( < any > global ) . sessionStorage = new MockStorage ( ) ;