Skip to content

Commit e01691e

Browse files
Merge pull request #231 from splitio/development
Development
2 parents 4a5306f + c416ce9 commit e01691e

46 files changed

Lines changed: 4045 additions & 529 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/update-license-year.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
git commit -m "Updated License Year" -a
3939
4040
- name: Create Pull Request
41-
uses: peter-evans/create-pull-request@v7
41+
uses: peter-evans/create-pull-request@v8
4242
with:
4343
token: ${{ secrets.GITHUB_TOKEN }}
4444
title: Update License Year

.jest/setEnvVars.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ jest.mock('../sdk', () => ({
1414
getSplitFactory: jest.fn((settings) => {
1515
const { __dirname } = require('../utils/utils');
1616
const path = require('path');
17-
const { apiKeyMocksMap } = require('../utils/mocks')
18-
17+
const { apiKeyMocksMap } = require('../utils/mocks');
18+
const { syncManagerOfflineFactory } = require('@splitsoftware/splitio-commons/cjs/sync/offline/syncManagerOffline');
19+
const { splitsParserFromFileFactory } = require('../sdk/sync/splitsParserFromFile');
1920
// Clients are configured in localhost mode if there is a features file maped to the authorizationKey value in mocksMap
2021

2122
let features = '';
@@ -61,7 +62,16 @@ jest.mock('../sdk', () => ({
6162
};
6263

6364
let sdk = jest.requireActual('../sdk');
64-
const { factory, impressionsMode } = sdk.getSplitFactory(configForMock);
65+
66+
const moduleOverrider = (modules) => {
67+
if (features) {
68+
modules.splitApiFactory = undefined;
69+
modules.syncManagerFactory = syncManagerOfflineFactory(splitsParserFromFileFactory)
70+
modules.SignalListener = undefined;
71+
}
72+
};
73+
74+
const { factory, impressionsMode } = sdk.getSplitFactory(configForMock, moduleOverrider);
6575

6676
const mockedTelemetry = {
6777
splits: {

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.13.1
1+
v24.12

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.9.0 (Dec 16, 2025)
2+
- Updated base image to node:24.12.0-alpine3.22
3+
- Updated @splitsoftware/splitio library, using @splitsoftware/splitio-commons:2.10.0 instead that includes
4+
- Added property `impressionsDisabled` in getTreatment(s) `evaluationOptions` parameter, to disable impressions per evaluations.
5+
16
2.8.1 (Oct 13, 2025)
27
- Updated base image to node:24.10.0-alpine3.22
38

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Builder stage
2-
FROM node:24.10.0-alpine3.22 AS builder
2+
FROM node:24.12.0-alpine3.22 AS builder
33

44
WORKDIR /usr/src/split-evaluator
55

@@ -8,7 +8,7 @@ COPY package.json package-lock.json ./
88
RUN npm install --only=production
99

1010
# Runner stage
11-
FROM node:24.10.0-alpine3.22 AS runner
11+
FROM node:24.12.0-alpine3.22 AS runner
1212

1313
WORKDIR /usr/src/split-evaluator
1414

admin/__tests__/machine.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const os = require('os');
2-
const ip = require('@splitsoftware/splitio/cjs/utils/ip');
2+
const ip = require('../../sdk/utils/ip');
33
const request = require('supertest');
44
const app = require('../../app');
55
const { expectError } = require('../../utils/testWrapper/index');

admin/admin.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const os = require('os');
2-
const ip = require('@splitsoftware/splitio/cjs/utils/ip');
2+
const ip = require('../sdk/utils/ip');
33

44
const utils = require('../utils/utils');
55
const environmentManager = require('../environmentManager').getInstance();

client/__tests__/allTreatments.test.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ describe('get-all-treatments', () => {
227227
'other-experiment-2': {
228228
treatment: 'on',
229229
},
230+
'other-experiment-4': {
231+
treatment: 'on',
232+
},
230233
},
231234
};
232235
const response = await request(app)
@@ -242,6 +245,9 @@ describe('get-all-treatments', () => {
242245
'my-experiment': {
243246
treatment: 'on',
244247
},
248+
'other-experiment-4': {
249+
treatment: 'on',
250+
},
245251
'other-experiment-3': {
246252
treatment: 'off',
247253
},
@@ -277,6 +283,42 @@ describe('get-all-treatments', () => {
277283
expect(response.status).toBe(200);
278284
});
279285

286+
test('should be 200 if impressionsDisabled parameter is valid (GET)', async () => {
287+
const response = await request(app)
288+
.get('/client/get-all-treatments?keys=[{"matchingKey":"test","trafficType":"localhost"}]&properties={"foo": {"bar": 1}}&impressions-disabled=true')
289+
.set('Authorization', 'test');
290+
expect(response.status).toBe(200);
291+
});
292+
293+
test('should be 200 if impressionsDisabled parameter is valid (POST)', async () => {
294+
const response = await request(app)
295+
.post('/client/get-all-treatments?keys=[{"matchingKey":"test","trafficType":"localhost"}]')
296+
.send({
297+
properties: { package: 'premium', admin: true, discount: 50 },
298+
impressionsDisabled: true,
299+
})
300+
.set('Authorization', 'test');
301+
expect(response.status).toBe(200);
302+
});
303+
304+
test('should be 200 if impressionsDisabled parameter is invalid (GET)', async () => {
305+
const response = await request(app)
306+
.get('/client/get-all-treatments?keys=[{"matchingKey":"test","trafficType":"localhost"}]&properties={"foo": {"bar": 1}}&impressions-disabled={"a":1}')
307+
.set('Authorization', 'test');
308+
expect(response.status).toBe(200);
309+
});
310+
311+
test('should be 200 if impressionsDisabled parameter is invalid (POST)', async () => {
312+
const response = await request(app)
313+
.post('/client/get-all-treatments?keys=[{"matchingKey":"test","trafficType":"localhost"}]')
314+
.send({
315+
properties: { package: 'premium', admin: true, discount: 50 },
316+
impressionsDisabled: { a: 1 },
317+
})
318+
.set('Authorization', 'test');
319+
expect(response.status).toBe(200);
320+
});
321+
280322
test('should be 200 if properties is invalid (GET)', async () => {
281323
const response = await request(app)
282324
.get('/client/get-all-treatments?keys=[{"matchingKey":"test","trafficType":"localhost"}]&properties={"foo": {"bar": 1}}')

client/__tests__/allTreatmentsWithConfig.test.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ describe('get-all-treatments-with-config', () => {
231231
treatment: 'on',
232232
config: null,
233233
},
234+
'other-experiment-4': {
235+
treatment: 'on',
236+
config: null,
237+
},
234238
},
235239
};
236240
const response = await request(app)
@@ -259,6 +263,10 @@ describe('get-all-treatments-with-config', () => {
259263
treatment: 'on',
260264
config: null,
261265
},
266+
'other-experiment-4': {
267+
treatment: 'on',
268+
config: null,
269+
},
262270
},
263271
account: {},
264272
};
@@ -285,6 +293,43 @@ describe('get-all-treatments-with-config', () => {
285293
expect(response.status).toBe(200);
286294
});
287295

296+
test('should be 200 if impressionsDisabled parameter is valid (GET)', async () => {
297+
const response = await request(app)
298+
.get('/client/get-all-treatments-with-config?keys=[{"matchingKey":"test","trafficType":"localhost"}]&properties={"foo": {"bar": 1}}&impressions-disabled=true')
299+
.set('Authorization', 'test');
300+
expect(response.status).toBe(200);
301+
});
302+
303+
test('should be 200 if impressionsDisabled parameter is valid (POST)', async () => {
304+
const response = await request(app)
305+
.post('/client/get-all-treatments-with-config?keys=[{"matchingKey":"test","trafficType":"localhost"}]')
306+
.send({
307+
properties: { foo: { bar: 1 } },
308+
impressionsDisabled: true,
309+
})
310+
.set('Authorization', 'test');
311+
expect(response.status).toBe(200);
312+
});
313+
314+
test('should be 200 if impressionsDisabled parameter is invalid (GET)', async () => {
315+
const response = await request(app)
316+
.get('/client/get-all-treatments-with-config?keys=[{"matchingKey":"test","trafficType":"localhost"}]&properties={"foo": {"bar": 1}}&impressions-disabled={"a":1}')
317+
.set('Authorization', 'test');
318+
expect(response.status).toBe(200);
319+
});
320+
321+
test('should be 200 if impressionsDisabled parameter is invalid (POST)', async () => {
322+
const response = await request(app)
323+
.post('/client/get-all-treatments-with-config?keys=[{"matchingKey":"test","trafficType":"localhost"}]')
324+
.send({
325+
properties: { foo: { bar: 1 } },
326+
impressionsDisabled: { a: 1 },
327+
})
328+
.set('Authorization', 'test');
329+
expect(response.status).toBe(200);
330+
});
331+
332+
288333
test('should be 200 if properties is invalid (GET)', async () => {
289334
const response = await request(app)
290335
.get('/client/get-all-treatments-with-config?keys=[{"matchingKey":"test","trafficType":"localhost"}]&properties={"foo": {"bar": 1}}')

client/__tests__/treatment.test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,40 @@ describe('get-treatment', () => {
281281
.set('Authorization', 'test');
282282
expectOk(response, 200, 'on', 'my-experiment');
283283
});
284+
285+
test('should be 200 if impressionsDisabled is valid (GET)', async () => {
286+
const response = await request(app)
287+
.get('/client/get-treatment?key=test&split-name=my-experiment&properties={"package":"premium","admin":true,"discount":50}&impressions-disabled=true')
288+
.set('Authorization', 'test');
289+
expectOk(response, 200, 'on', 'my-experiment');
290+
});
291+
292+
test('should be 200 if impressionsDisabled is valid (POST)', async () => {
293+
const response = await request(app)
294+
.post('/client/get-treatment?key=test&split-name=my-experiment&impressions-disabled=true')
295+
.send({
296+
properties: { package: 'premium', admin: true, discount: 50 },
297+
impressionsDisabled: true,
298+
})
299+
.set('Authorization', 'test');
300+
expectOk(response, 200, 'on', 'my-experiment');
301+
});
302+
303+
test('should be 200 if impressionsDisabled is invalid (GET)', async () => {
304+
const response = await request(app)
305+
.get('/client/get-treatment?key=test&split-name=my-experiment&properties={"foo": {"bar": 1}}&impressions-disabled=lalala')
306+
.set('Authorization', 'test');
307+
expectOk(response, 200, 'on', 'my-experiment');
308+
});
309+
310+
test('should be 200 if impressionsDisabled is invalid (POST)', async () => {
311+
const response = await request(app)
312+
.post('/client/get-treatment?key=test&split-name=my-experiment')
313+
.send({
314+
properties: { foo: { bar: 1 } },
315+
impressionsDisabled: 'lalala',
316+
})
317+
.set('Authorization', 'test');
318+
expectOk(response, 200, 'on', 'my-experiment');
319+
});
284320
});

0 commit comments

Comments
 (0)