From 5731b7ab471d3aa885b1fdb258b09d8f53124e50 Mon Sep 17 00:00:00 2001 From: juergba Date: Thu, 20 Feb 2020 08:23:43 +0100 Subject: [PATCH] happy coveralls --- lib/utils.js | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index e95da86404..59b250c20e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -843,26 +843,13 @@ exports.defineConstants = function(obj) { * @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha */ exports.supportsEsModules = function() { - if (typeof document !== 'undefined') { - return false; - } - if ( - typeof process !== 'object' || - !process.versions || - !process.versions.node - ) { - return false; - } - var versionFields = process.versions.node.split('.'); - var major = +versionFields[0]; - var minor = +versionFields[1]; + if (!process.browser && process.versions && process.versions.node) { + var versionFields = process.versions.node.split('.'); + var major = +versionFields[0]; + var minor = +versionFields[1]; - if (major >= 13) { - return true; - } - if (major < 12) { - return false; + if (major >= 13 || (major === 12 && minor >= 11)) { + return true; + } } - // major === 12 - return minor >= 11; };