Skip to content

Commit a341e7b

Browse files
Update JS-commons. Add tests for localhost mode
1 parent 63d7f66 commit a341e7b

File tree

5 files changed

+41
-24
lines changed

5 files changed

+41
-24
lines changed

CHANGES.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
10.26.1 (June XX, 2024)
2-
- Updated the internal imports of 'os' and 'ioredis' modules for NodeJS to use EcmaScript 'import' rather than CommonJS 'require' for the ES modules build, avoiding runtime errors when bundling or importing the SDK in a .mjs file.
3-
- Updated @splitsoftware/splitio-commons package to version 1.15.1 that includes updates on input validation logs.
1+
10.26.1 (June 13, 2024)
2+
- Updated the internal imports of 'os' and 'ioredis' modules for NodeJS, to use EcmaScript 'import' rather than CommonJS 'require' for the ES modules build. This avoids runtime errors on some scenarios when bundling the SDK into a .mjs file or importing it from a .mjs file.
3+
- Updated @splitsoftware/splitio-commons package to version 1.16.0 that includes some vulnerability and bug fixes.
4+
- Bugfixing - Restored some input validation error logs that were removed in version 10.24.0. The logs inform the user when the `getTreatment(s)` methods are called with an invalid value as feature flag name or flag set name.
5+
- Bugfixing - Fixed localhost mode to emit SDK_UPDATE when mocked feature flags are updated in the `features` object map of the config object (Related to issue https://github.com/splitio/javascript-browser-client/issues/119).
46

57
10.26.0 (May 6, 2024)
68
- Updated @splitsoftware/splitio-commons package to version 1.14.0 that includes minor updates:

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio",
3-
"version": "10.26.1-rc.2",
3+
"version": "10.26.1-rc.3",
44
"description": "Split SDK",
55
"files": [
66
"README.md",
@@ -40,7 +40,7 @@
4040
"node": ">=6"
4141
},
4242
"dependencies": {
43-
"@splitsoftware/splitio-commons": "1.15.1-rc.2",
43+
"@splitsoftware/splitio-commons": "1.15.1-rc.3",
4444
"@types/google.analytics": "0.0.40",
4545
"@types/ioredis": "^4.28.0",
4646
"bloom-filters": "^3.0.0",

src/__tests__/offline/browser.spec.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ tape('Browser offline mode', function (assert) {
8888
});
8989

9090
// Multiple factories must handle their own `features` mock, even if instantiated with the same config.
91-
const factories = [
92-
SplitFactory(config),
93-
SplitFactory({ ...config }),
94-
SplitFactory({ ...config, features: { ...config.features }, storage: { type: 'INVALID TYPE' } }),
95-
SplitFactory({ ...config, storage: { type: 'LOCALSTORAGE' } })
91+
const configs = [
92+
{ ...config, features: { ...config.features }, storage: { type: 'INVALID TYPE' } },
93+
{ ...config, storage: { type: 'LOCALSTORAGE' } },
94+
{ ...config },
95+
config,
9696
];
97+
const factories = configs.map(config => SplitFactory(config));
98+
9799
let readyCount = 0, updateCount = 0, readyFromCacheCount = 0;
98100

99101
for (let i = 0; i < factories.length; i++) {
@@ -105,7 +107,7 @@ tape('Browser offline mode', function (assert) {
105107
readyCount++;
106108
});
107109
client.on(client.Event.SDK_UPDATE, () => {
108-
assert.deepEqual(manager.names(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
110+
assert.deepEqual(manager.names().sort(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
109111
assert.equal(client.getTreatment('testing_split_with_config'), 'nope');
110112
updateCount++;
111113
});
@@ -211,7 +213,7 @@ tape('Browser offline mode', function (assert) {
211213
});
212214

213215
setTimeout(() => {
214-
// Update the features
216+
// Update features reference in settings
215217
factory.settings.features = {
216218
testing_split: 'on',
217219
testing_split_2: 'off',
@@ -221,10 +223,23 @@ tape('Browser offline mode', function (assert) {
221223
config: null
222224
}
223225
};
224-
// Update the features in all factories except the last one
225-
for (let i = 0; i < factories.length - 1; i++) {
226+
227+
// Update features properties in config
228+
configs[0].features['testing_split'] = 'on';
229+
configs[0].features['testing_split_2'] = 'off';
230+
configs[0].features['testing_split_3'] = 'custom_treatment';
231+
configs[0].features['testing_split_with_config'] = {
232+
treatment: 'nope',
233+
config: null
234+
};
235+
236+
// Update the features in all remaining factories except the last one
237+
for (let i = 1; i < factories.length - 1; i++) {
226238
factories[i].settings.features = factory.settings.features;
227239
}
240+
241+
// Assigning a new object to the features property in the config doesn't trigger an update
242+
configs[configs.length - 1].features = { ...factory.settings.features };
228243
}, 1000);
229244

230245
setTimeout(() => { factory.settings.features = originalFeaturesMap; }, 200);

src/settings/defaults/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const packageVersion = '10.26.1-rc.2';
1+
export const packageVersion = '10.26.1-rc.3';

0 commit comments

Comments
 (0)