Skip to content

Conversation

jhefferman-sfdc
Copy link
Contributor

@jhefferman-sfdc jhefferman-sfdc commented Aug 14, 2025

Details

Optional chaining on process.env fails tests due to rollup transformations which do not match. The optional checks are redundant given the preceding typeof check.

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.

GUS work item

W-19309489

@jhefferman-sfdc jhefferman-sfdc requested a review from a team as a code owner August 14, 2025 18:41
@jhefferman-sfdc jhefferman-sfdc requested a review from wjhsf August 14, 2025 18:41
@@ -62,6 +62,6 @@ export function registerLwcStyleComponent() {
}

// Only used in LWC's Karma tests
if (typeof process !== 'undefined' && process?.env?.NODE_ENV === 'test-karma-lwc') {
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'test-karma-lwc') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'test-karma-lwc') {
if (typeof process === 'object' && typeof process?.env === 'object' && process.env && process.env.NODE_ENV === 'test-karma-lwc') {

I forget who, but someone runs LWC in an environment with process but not process.env, so we need to be extra verbose in this check. (This also bit us in #5281).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got you, thanks. Switched it to use the same check as that PR.

@jhefferman-sfdc jhefferman-sfdc requested a review from wjhsf August 14, 2025 19:22
@jhefferman-sfdc jhefferman-sfdc merged commit 6ce708a into master Aug 15, 2025
6 checks passed
@jhefferman-sfdc jhefferman-sfdc deleted the jhefferman/fix-integration-tests branch August 15, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants