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 f10218fCopy full SHA for f10218f
src/pretty-dom.js
@@ -7,7 +7,7 @@ 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 = typeof process !== 'undefined' ? process?.env?.COLORS : undefined
11
if (colors) {
12
const b = JSON.parse(colors)
13
if (typeof b === 'boolean') return b
@@ -18,7 +18,7 @@ const shouldHighlight = () => {
18
19
// In all other cases, whether COLORS was a weird type, or the attempt threw:
20
// Fall back to colorizing if we are running in node.
21
- return !!process?.versions?.node
+ return typeof process !== 'undefined' && !!process.versions?.node
22
}
23
24
const {DOMCollection} = prettyFormat.plugins
0 commit comments