Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1f08e89
rename files like in JS SDK
EmilianoSanchez Jul 28, 2022
bfc21e9
polishing and renames
EmilianoSanchez Jul 28, 2022
630d969
rename settingsValidator to settingsFactory
EmilianoSanchez Jul 29, 2022
b2bde23
update on destroy test
EmilianoSanchez Jul 29, 2022
ae9c6a0
formatting
EmilianoSanchez Aug 3, 2022
80815db
Merge pull request #57 from splitio/e2e_tests_refactor
EmilianoSanchez Aug 3, 2022
4a381c1
Add sonar to ci-cd pipeline
LucianoCaravajal Aug 4, 2022
6903c1f
Moved sonar to a different workflow
LucianoCaravajal Aug 4, 2022
5f22d72
Rename sonar workflow
LucianoCaravajal Aug 4, 2022
220499c
Removed not required permissions
LucianoCaravajal Aug 4, 2022
e2f499d
Update sonar github version
LucianoCaravajal Aug 4, 2022
4e63fef
Merge pull request #59 from splitio/aut-542
LucianoCaravajal Aug 4, 2022
9078e33
update e2e tests to assert telemetry with pluggable storage
EmilianoSanchez Sep 14, 2022
f82e255
upgrade js-commons and tests to support NONE impressions mode
EmilianoSanchez Sep 19, 2022
0044091
updated e2e tests for consumer mode with pluggable storage
EmilianoSanchez Sep 19, 2022
82c20f2
updated e2e tests for partial consumer mode with pluggable storage to…
EmilianoSanchez Sep 19, 2022
8c24daf
rc
EmilianoSanchez Sep 19, 2022
8f75cc4
rc
EmilianoSanchez Sep 28, 2022
dd52383
upgrade js-commons and prepare rc
EmilianoSanchez Sep 29, 2022
fd9caed
fix e2e test
EmilianoSanchez Sep 29, 2022
6acac87
update type definitions comment regarding new NONE impression mode op…
EmilianoSanchez Sep 30, 2022
8253d0d
update changelog and js-commons version for stable release
EmilianoSanchez Oct 4, 2022
2235bc8
Merge pull request #63 from splitio/pluggable_storage_mtk_producer_api
EmilianoSanchez Oct 4, 2022
d72885f
Merge pull request #62 from splitio/telemetry_cache_pluggable
EmilianoSanchez Oct 4, 2022
f6baed6
prepare release v0.9.0
EmilianoSanchez Oct 5, 2022
ca9bb82
re-run ci-cd workflow
EmilianoSanchez Oct 5, 2022
4b85710
update test to reduce flakiness
EmilianoSanchez Oct 5, 2022
3097389
Merge pull request #65 from splitio/release_0.9.0
EmilianoSanchez Oct 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"keyword-spacing": "error",
"comma-style": "error"
"comma-style": "error",
"no-trailing-spaces": "error"
},

"overrides": [
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: sonar-scan
on:
pull_request:
branches:
- main
- development
push:
branches:
- main
- development

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up nodejs
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'

- name: npm CI
run: npm ci

- name: npm Check
run: npm run check

- name: npm Build
run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build

- name: SonarQube Scan (Push)
if: github.event_name == 'push'
uses: SonarSource/sonarcloud-github-action@v1.6
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.projectName=${{ github.event.repository.name }}
-Dsonar.projectKey=${{ github.event.repository.name }}
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
- name: SonarQube Scan (Pull Request)
if: github.event_name == 'pull_request'
uses: SonarSource/sonarcloud-github-action@v1.6
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.projectName=${{ github.event.repository.name }}
-Dsonar.projectKey=${{ github.event.repository.name }}
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.9.0 (October 5, 2022)
- Added a new impressions mode for the SDK called NONE, to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
- Updated default value of `scheduler.featuresRefreshRate` config parameter from 30 seconds to 60 seconds.
- Updated @splitsoftware/splitio-commons package to version 1.7.1, that improves the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory, among other improvements.

0.8.0 (July 22, 2022)
- Added `autoRequire` configuration option to the Google Analytics to Split integration, which takes care of requiring the splitTracker plugin on trackers dynamically created by Google tag managers (See https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js).
- Updated browser listener to push remaining impressions and events on 'visibilitychange' and 'pagehide' DOM events, instead of 'unload', which is not reliable in modern mobile and desktop Web browsers.
Expand Down
15 changes: 15 additions & 0 deletions karma/config.debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const merge = require('lodash/merge');

module.exports = merge({}, require('./config'), {
browsers: [
'Chrome'
],
rollupPreprocessor: {
output: {
sourcemap: 'inline',
},
},
singleRun: false
});
6 changes: 3 additions & 3 deletions karma/e2e.consumer.karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module.exports = function(config) {
config.set(assign({}, require('./config'), {
// list of files / patterns to load in the browser
files: [
'__tests__/consumerMode/browser_consumer.spec.js',
'__tests__/consumerMode/browser_consumer_partial.spec.js'
'__tests__/consumer/browser_consumer.spec.js',
'__tests__/consumer/browser_consumer_partial.spec.js'
],
// prepare code for the browser using rollup
preprocessors: {
'__tests__/consumerMode/*.spec.js': ['rollup']
'__tests__/consumer/*.spec.js': ['rollup']
},

// level of logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module.exports = function(config) {
config.set(assign({}, require('./config'), {
// list of files / patterns to load in the browser
files: [
'__tests__/errors/browser.spec.js'
'__tests__/errorCatching/browser.spec.js'
],
// prepare code for the browser using rollup
preprocessors: {
'__tests__/errors/browser.spec.js': ['rollup']
'__tests__/errorCatching/browser.spec.js': ['rollup']
},

// level of logging
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-browserjs",
"version": "0.8.0",
"version": "0.9.0",
"description": "Split SDK for Javascript on Browser",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down Expand Up @@ -30,18 +30,19 @@
"build:ga-to-split-autorequire": "terser ./node_modules/@splitsoftware/splitio-commons/src/integrations/ga/autoRequire.js --mangle --output ./scripts/ga-to-split-autorequire.js",
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "jest",
"test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errors && npm run test:e2e-push && npm run test:e2e-gaintegration && npm run test:e2e-consumer",
"test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errorCatching && npm run test:e2e-push && npm run test:e2e-gaIntegration && npm run test:e2e-consumer",
"test:e2e-logger": "karma start karma/e2e.logger.karma.conf.js",
"test:e2e-offline": "karma start karma/e2e.offline.karma.conf.js",
"test:e2e-online": "karma start karma/e2e.online.karma.conf.js",
"test:e2e-destroy": "karma start karma/e2e.destroy.karma.conf.js",
"test:e2e-errors": "karma start karma/e2e.errors.karma.conf.js",
"test:e2e-errorCatching": "karma start karma/e2e.errorCatching.karma.conf.js",
"test:e2e-push": "karma start karma/e2e.push.karma.conf.js",
"test:e2e-gaintegration": "karma start karma/e2e.gaintegration.karma.conf.js",
"test:e2e-gaIntegration": "karma start karma/e2e.gaIntegration.karma.conf.js",
"test:e2e-consumer": "karma start karma/e2e.consumer.karma.conf.js",
"pretest-ts-decls": "npm run build:esm && npm run build:cjs && npm link",
"test-ts-decls": "./scripts/ts-tests.sh",
"posttest-ts-decls": "npm unlink && npm install",
"all": "npm run check && npm run build && npm run test-ts-decls && npm run test",
"publish:rc": "npm run check && npm run build && npm publish --tag rc",
"publish:stable": "npm run check && npm run build && npm publish"
},
Expand All @@ -63,7 +64,7 @@
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
"dependencies": {
"@splitsoftware/splitio-commons": "1.6.1",
"@splitsoftware/splitio-commons": "1.7.1",
"@types/google.analytics": "0.0.40"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SplitFactory } from '../../index';
import { SplitFactory } from '../../';

const SDK_INSTANCES_TO_TEST = 4;

Expand Down Expand Up @@ -362,7 +362,6 @@ export default function (config, fetchMock, assert) {

};


for (i; i < SDK_INSTANCES_TO_TEST; i++) {
let splitio = SplitFactory(config);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SplitFactory } from '../../index';
import { settingsValidator } from '../../settings';
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import { url } from '../testUtils';

const settings = settingsValidator({
const settings = settingsFactory({
core: {
key: 'asd'
},
Expand Down Expand Up @@ -93,6 +93,7 @@ export function withoutBindingTT(fetchMock, assert) {
assert.notOk(client.track('othertraffictype', 'my.checkout.event', null, 'asd'), 'client.track returns false if an event properties was incorrect and it could not be added to the queue.');
}

// Not for JS Browser SDK, because it doesn't let bind traffic types to clients
export function bindingTT(fetchMock, assert) {
const localSettings = Object.assign({}, baseSettings);
localSettings.core.trafficType = 'binded_tt';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SplitFactory } from '../../index';
import { SplitFactory } from '../../';
import { splitFilters, queryStrings, groupedFilters } from '../mocks/fetchSpecificSplits';

const baseConfig = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SplitFactory } from '../../index';
import { settingsValidator } from '../../settings';
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
import { DEBUG } from '@splitsoftware/splitio-commons/src/utils/constants';
import { url } from '../testUtils';
Expand Down Expand Up @@ -100,7 +100,7 @@ export default function (fetchMock, assert) {
};

// Mock GET endpoints before creating the client
const settings = settingsValidator(config);
const settings = settingsFactory(config);
fetchMock.getOnce(url(settings, '/splitChanges?since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.getOnce(url(settings, '/splitChanges?since=1457552620999'), { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } });
fetchMock.getOnce(url(settings, `/mySegments/${encodeURIComponent(config.core.key)}`), { status: 200, body: { mySegments: [] } });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import sinon from 'sinon';
import { SplitFactory } from '../../index';
import { settingsValidator } from '../../settings';

const settings = settingsValidator({
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';

const settings = settingsFactory({
core: {
key: '<fake id>'
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SplitFactory } from '../../index';
import { settingsValidator } from '../../settings';
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
import splitChangesMock2 from '../mocks/splitchanges.since.1457552620999.json';
import mySegmentsFacundo from '../mocks/mysegments.facundo@split.io.json';
Expand All @@ -11,7 +11,7 @@ const baseUrls = {
events: 'https://events.baseurl/impressionsDebugSuite'
};

const settings = settingsValidator({
const settings = settingsFactory({
core: {
key: 'asd'
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SplitFactory } from '../../index';
import { settingsValidator } from '../../settings';
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
import splitChangesMock2 from '../mocks/splitchanges.since.1457552620999.json';
import mySegmentsFacundo from '../mocks/mysegments.facundo@split.io.json';
Expand All @@ -12,7 +12,7 @@ const baseUrls = {
events: 'https://events.baseurl/impressionsSuite'
};

const settings = settingsValidator({
const settings = settingsFactory({
core: {
key: 'asd'
},
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function (fetchMock, assert) {
fetchMock.postOnce(url(settings, '/testImpressions/count'), (url, opts) => {
const data = JSON.parse(opts.body);

assert.equal(data.pf.length, 2, 'We should generated 2 impressions count.');
assert.equal(data.pf.length, 1, 'We should generate impressions count for one feature.');

// finding these validate the feature names collection too
const dependencyChildImpr = data.pf.filter(e => e.f === 'hierarchical_splits_test')[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SplitFactory } from '../../index';
import { SplitFactory } from '../../';
import splitChangesMockReal from '../mocks/splitchanges.real.json';
import map from 'lodash/map';
import { url } from '../testUtils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
window.EventSource = EventSourceMock;

import { SplitFactory, InLocalStorage } from '../../';
import { settingsValidator } from '../../settings';
import { settingsFactory } from '../../settings';

const userKey = 'nicolas@split.io';

Expand All @@ -27,7 +27,7 @@ const config = {
prefix: 'pushCornerCase'
}),
};
const settings = settingsValidator(config);
const settings = settingsFactory(config);

const MILLIS_SSE_OPEN = 100;
const MILLIS_SPLIT_KILL_EVENT = 200;
Expand Down Expand Up @@ -95,6 +95,6 @@ export function testSplitKillOnReadyFromCache(fetchMock, assert) {
const lapse = Date.now() - start;
assert.true(nearlyEqual(lapse, MILLIS_SPLIT_CHANGES_RESPONSE), 'SDK_READY once split changes arrives');

client.destroy().then(()=> { assert.end();});
client.destroy().then(() => { assert.end(); });
});
}
Loading