typeof console === undefined is need, not sure about the console.* tests