From 87df57a241a289dae7ada8501ecfec84f8fcf141 Mon Sep 17 00:00:00 2001 From: Westbrook Johnson Date: Mon, 27 Jan 2020 09:13:36 -0500 Subject: [PATCH] Ensure 'process' is available before using refs #413 refs #161 Not all environments (particularly the browser, where testing via tools like Karma occurs) have access to the `process` variable. There is already checking to ensure that its member properties have fallbacks, and this ensures that if it is simply unavailable the same fallback occurs. --- src/pretty-dom.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pretty-dom.js b/src/pretty-dom.js index 9f065c03..9bfe0a58 100644 --- a/src/pretty-dom.js +++ b/src/pretty-dom.js @@ -16,7 +16,9 @@ const inNode = () => process.versions.node !== undefined const getMaxLength = dom => - inCypress(dom) ? 0 : process.env.DEBUG_PRINT_LIMIT || 7000 + inCypress(dom) + ? 0 + : typeof process !== 'undefined' && process.env.DEBUG_PRINT_LIMIT || 7000 const {DOMElement, DOMCollection} = prettyFormat.plugins