Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

fix 'location is not defined' error

Jake Marshb8ed82c70c99
diff --git a/lib/utils.js b/lib/utils.js
index c1393a9c..95623c21 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -647,7 +647,7 @@ exports.stackTraceFilter = function() {
: { browser: true }
, cwd = is.node
? process.cwd() + slash
- : location.href.replace(/\/[^\/]*$/, '/');
+ : (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');
function isNodeModule (line) {
return (~line.indexOf('node_modules'));