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).