From af9be12a0882d98723e699342f687d6a1275d53c Mon Sep 17 00:00:00 2001 From: "Fabien \"egg\" O'Carroll" Date: Fri, 1 Sep 2023 11:45:56 +0700 Subject: [PATCH] Fixed @tryghost/domain-events relying on NODE_ENV When using this package without setting a NODE_ENV environment variable it would completely crash. --- ghost/domain-events/lib/DomainEvents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/domain-events/lib/DomainEvents.js b/ghost/domain-events/lib/DomainEvents.js index 6910bfa7b6..60adb3c5ec 100644 --- a/ghost/domain-events/lib/DomainEvents.js +++ b/ghost/domain-events/lib/DomainEvents.js @@ -69,7 +69,7 @@ class DomainEvents { static #awaitQueue = []; static #dispatchCount = 0; static #processedCount = 0; - static #trackingEnabled = process.env.NODE_ENV.startsWith('test'); + static #trackingEnabled = process.env.NODE_ENV?.startsWith('test'); /** * Waits for all the events in the queue to be dispatched and fully processed (async).