diff --git a/test/WarnHandlersTest.js b/test/WarnHandlersTest.js
index ea0b09a..c2753c0 100644
--- a/test/WarnHandlersTest.js
+++ b/test/WarnHandlersTest.js
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-if ( typeof console === 'undefined' ) console = undefined;
+try { void console } catch ( e ) { console = undefined; }
require( 'common' ).testCase(
{
diff --git a/test/WarnTest.js b/test/WarnTest.js
index 973381c..7206155 100644
--- a/test/WarnTest.js
+++ b/test/WarnTest.js
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-if ( typeof console === 'undefined' ) console = undefined;
+try { void console } catch ( e ) { console = undefined; }
require( 'common' ).testCase(
{