Refactor window wrapper for node testing
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
function makeWindow() {
|
||||
var win = {
|
||||
location: {},
|
||||
history: {},
|
||||
@@ -5,6 +6,10 @@ var win = {
|
||||
close: () => {}
|
||||
}
|
||||
|
||||
if(typeof window === "undefined") {
|
||||
return win
|
||||
}
|
||||
|
||||
try {
|
||||
win = window
|
||||
var props = ["File", "Blob", "FormData"]
|
||||
@@ -17,4 +22,7 @@ try {
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
export default win
|
||||
return win
|
||||
}
|
||||
|
||||
module.exports = makeWindow()
|
||||
|
||||
Reference in New Issue
Block a user