Skip to content

Commit 6ce708a

Browse files
fix: remove redundant optional chaining on process.env which is breaking testing (#5459)
* fix: remove redundant optional chaining on process.env which is breaking tests * fix: remove redundant optional chaining on process.env which is breaking tests
1 parent a38cbcb commit 6ce708a

File tree

1 file changed

+7
-1
lines changed
  • packages/@lwc/ssr-client-utils/src

1 file changed

+7
-1
lines changed

packages/@lwc/ssr-client-utils/src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ export function registerLwcStyleComponent() {
6262
}
6363

6464
// Only used in LWC's Karma tests
65-
if (typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test-karma-lwc') {
65+
// See PR-5281 for precedence on extra guards
66+
if (
67+
typeof process === 'object' &&
68+
typeof process?.env === 'object' &&
69+
process.env &&
70+
process.env.NODE_ENV === 'test-karma-lwc'
71+
) {
6672
(window as any).__lwcClearStylesheetCache = () => stylesheetCache.clear();
6773
}

0 commit comments

Comments
 (0)