From 64be5c84ad2e1f50924fba012162ea5896b922cb Mon Sep 17 00:00:00 2001 From: Roland Warmerdam Date: Wed, 9 May 2018 15:04:13 -0700 Subject: [PATCH 1/2] Fix the tracking plan when load options are specified --- lib/analytics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/analytics.js b/lib/analytics.js index 793b2a49..b44a911e 100644 --- a/lib/analytics.js +++ b/lib/analytics.js @@ -785,7 +785,7 @@ Analytics.prototype._mergeInitializeAndPlanIntegrations = function(planIntegrati // Allow the tracking plan to disable integrations that were explicitly // enabled on initialization if (planIntegrations.All === false) { - integrations = {}; + integrations = { All: false }; } for (integrationName in planIntegrations) { From 87adeb010fbfb1021583c00d4d7ee88aa6bd1a9f Mon Sep 17 00:00:00 2001 From: Roland Warmerdam Date: Wed, 9 May 2018 15:14:11 -0700 Subject: [PATCH 2/2] Improve test to catch the bug --- test/analytics.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/analytics.test.js b/test/analytics.test.js index 80cb97fa..f0c629ff 100644 --- a/test/analytics.test.js +++ b/test/analytics.test.js @@ -1351,6 +1351,7 @@ describe('Analytics', function() { it('should allow tracking plan to disable integrations explicitly enabled via initialize .integrations option', function() { analytics.initialize(settings, { integrations: { + All: false, Test: true }, plan: { @@ -1370,7 +1371,7 @@ describe('Analytics', function() { analytics.track('event2', { prop: true }); var track2 = analytics._invoke.args[1][1]; - assert.deepEqual(track2.obj.integrations, { Test: false }); + assert.deepEqual(track2.obj.integrations, { All: false, Test: false }); }); it('should prevent tracking plan from enabling integrations disabled via initialize .integrations option', function() {