We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
process
1 parent 76cb73d commit 3786efbCopy full SHA for 3786efb
src/pretty-dom.js
@@ -7,7 +7,8 @@ import {getConfig} from './config'
7
const shouldHighlight = () => {
8
// Try to safely parse env COLORS: We will default behavior if any step fails.
9
try {
10
- const colors = process?.env?.COLORS
+ const colors =
11
+ typeof process !== 'undefined' ? process?.env?.COLORS : undefined
12
if (colors) {
13
const b = JSON.parse(colors)
14
if (typeof b === 'boolean') return b
@@ -18,7 +19,7 @@ const shouldHighlight = () => {
18
19
20
// In all other cases, whether COLORS was a weird type, or the attempt threw:
21
// Fall back to colorizing if we are running in node.
- return !!process?.versions?.node
22
+ return typeof process !== 'undefined' && !!process.versions?.node
23
}
24
25
const {DOMCollection} = prettyFormat.plugins
0 commit comments