diff --git a/packages/core/client.js b/packages/core/client.js index b899aaa6e7..ed48d40b34 100644 --- a/packages/core/client.js +++ b/packages/core/client.js @@ -242,7 +242,7 @@ class Client { } // exit early if events should not be sent on the current releaseStage - if (this._config.enabledReleaseStages.length > 0 && !includes(this._config.enabledReleaseStages, this._config.releaseStage)) { + if (this._config.enabledReleaseStages !== null && !includes(this._config.enabledReleaseStages, this._config.releaseStage)) { this._logger.warn('Event not sent due to releaseStage/enabledReleaseStages configuration') return cb(null, event) } diff --git a/packages/core/config.js b/packages/core/config.js index 46dec61da2..9aade2ab63 100644 --- a/packages/core/config.js +++ b/packages/core/config.js @@ -66,9 +66,9 @@ module.exports.schema = { validate: val => val === true || val === false }, enabledReleaseStages: { - defaultValue: () => [], + defaultValue: () => null, message: 'should be an array of strings', - validate: value => isArray(value) && filter(value, f => typeof f === 'string').length === value.length + validate: value => value === null || (isArray(value) && filter(value, f => typeof f === 'string').length === value.length) }, releaseStage: { defaultValue: () => 'production', diff --git a/packages/plugin-browser-session/session.js b/packages/plugin-browser-session/session.js index 5654d25724..a9170162af 100644 --- a/packages/plugin-browser-session/session.js +++ b/packages/plugin-browser-session/session.js @@ -11,7 +11,7 @@ const sessionDelegate = { sessionClient._pausedSession = null // exit early if the current releaseStage is not enabled - if (sessionClient._config.enabledReleaseStages.length > 0 && !includes(sessionClient._config.enabledReleaseStages, sessionClient._config.releaseStage)) { + if (sessionClient._config.enabledReleaseStages !== null && !includes(sessionClient._config.enabledReleaseStages, sessionClient._config.releaseStage)) { sessionClient._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration') return sessionClient } diff --git a/packages/plugin-server-session/session.js b/packages/plugin-server-session/session.js index 500467ae2f..5016a7dfc0 100644 --- a/packages/plugin-server-session/session.js +++ b/packages/plugin-server-session/session.js @@ -44,7 +44,7 @@ module.exports = { const sendSessionSummary = client => sessionCounts => { // exit early if the current releaseStage is not enabled - if (client._config.enabledReleaseStages.length > 0 && !includes(client._config.enabledReleaseStages, client._config.releaseStage)) { + if (client._config.enabledReleaseStages !== null && !includes(client._config.enabledReleaseStages, client._config.releaseStage)) { client._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration') return } diff --git a/test/browser/features/fixtures/release_stage/script/e.html b/test/browser/features/fixtures/release_stage/script/e.html new file mode 100644 index 0000000000..9790e91673 --- /dev/null +++ b/test/browser/features/fixtures/release_stage/script/e.html @@ -0,0 +1,22 @@ + + +
+ + + + + + + + diff --git a/test/browser/features/fixtures/release_stage/script/f.html b/test/browser/features/fixtures/release_stage/script/f.html new file mode 100644 index 0000000000..fa9e74b772 --- /dev/null +++ b/test/browser/features/fixtures/release_stage/script/f.html @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/test/browser/features/release_stage.feature b/test/browser/features/release_stage.feature index f9c5e5373d..d3e611aac7 100644 --- a/test/browser/features/release_stage.feature +++ b/test/browser/features/release_stage.feature @@ -23,3 +23,14 @@ Scenario: setting releaseStage=staging enabledReleaseStages=[production,staging] Then I wait to receive a request And the request is a valid browser payload for the error reporting API And the event "app.releaseStage" equals "staging" + +Scenario: setting releaseStage=development enabledReleaseStages=null + When I navigate to the URL "/release_stage/script/e.html" + Then I wait to receive a request + And the request is a valid browser payload for the error reporting API + And the event "app.releaseStage" equals "development" + +Scenario: setting enabledReleaseStages=[] + When I navigate to the URL "/release_stage/script/f.html" + And I wait for 2 seconds + Then I should receive no requests