Skip to content

Commit

Permalink
fix: ensure 'process' is available before using (#431)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Westbrook authored and Kent C. Dodds committed Jan 28, 2020
1 parent a2c3472 commit 905f4b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pretty-dom.js
Expand Up @@ -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

Expand Down

0 comments on commit 905f4b3

Please sign in to comment.