From 6b0ff473ad271a4d752d735f75bee4df8e4e4881 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 17 Feb 2021 10:51:31 -0800 Subject: [PATCH 1/2] test: Add package.json script for running Karma tests locally using Chrome --- .../karma.local_chrome.bs.conf.js | 29 ++++++++++++++++++ .../karma.local_chrome.umd.conf.js | 30 +++++++++++++++++++ packages/optimizely-sdk/package.json | 1 + 3 files changed, 60 insertions(+) create mode 100644 packages/optimizely-sdk/karma.local_chrome.bs.conf.js create mode 100644 packages/optimizely-sdk/karma.local_chrome.umd.conf.js diff --git a/packages/optimizely-sdk/karma.local_chrome.bs.conf.js b/packages/optimizely-sdk/karma.local_chrome.bs.conf.js new file mode 100644 index 000000000..7b6fc0b8a --- /dev/null +++ b/packages/optimizely-sdk/karma.local_chrome.bs.conf.js @@ -0,0 +1,29 @@ +/** + * Copyright 2021 Optimizely + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const baseConfig = require('./karma.base.conf'); + +module.exports = function(config) { + config.set({ + ...baseConfig, + plugins: ['karma-mocha', 'karma-webpack', 'karma-chrome-launcher'], + browserStack: null, + browsers: ['Chrome'], + files: [ + './node_modules/promise-polyfill/dist/polyfill.min.js', + './lib/index.browser.tests.js' + ], + }); +} diff --git a/packages/optimizely-sdk/karma.local_chrome.umd.conf.js b/packages/optimizely-sdk/karma.local_chrome.umd.conf.js new file mode 100644 index 000000000..9c5da74c2 --- /dev/null +++ b/packages/optimizely-sdk/karma.local_chrome.umd.conf.js @@ -0,0 +1,30 @@ +/** + * Copyright 2021 Optimizely + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const baseConfig = require('./karma.base.conf'); + +module.exports = function(config) { + config.set({ + ...baseConfig, + plugins: ['karma-mocha', 'karma-webpack', 'karma-chrome-launcher'], + browserStack: null, + browsers: ['Chrome'], + files: [ + './node_modules/promise-polyfill/dist/polyfill.min.js', + './dist/optimizely.browser.umd.min.js', + './lib/index.browser.umdtests.js' + ], + }); +} diff --git a/packages/optimizely-sdk/package.json b/packages/optimizely-sdk/package.json index 3f881a230..95003b7a3 100644 --- a/packages/optimizely-sdk/package.json +++ b/packages/optimizely-sdk/package.json @@ -15,6 +15,7 @@ "test-ci": "npm run test-xbrowser && npm run test-umdbrowser", "test-xbrowser": "karma start karma.bs.conf.js --single-run", "test-umdbrowser": "npm run build-browser-umd && karma start karma.umd.conf.js --single-run", + "test-karma-local": "karma start karma.local_chrome.bs.conf.js && npm run build-browser-umd && karma start karma.local_chrome.umd.conf.js", "prebuild": "npm run clean", "build": "rollup -c", "build-browser-umd": "rollup -c --config-umd", From 6cd504772f94c2f9cbb3bdaa8e03f52e9c060b14 Mon Sep 17 00:00:00 2001 From: Zeeshan Ashraf Date: Wed, 9 Feb 2022 10:18:41 -0800 Subject: [PATCH 2/2] updated changelog --- packages/optimizely-sdk/CHANGELOG.MD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/optimizely-sdk/CHANGELOG.MD b/packages/optimizely-sdk/CHANGELOG.MD index 4095c1799..0fc8b8d25 100644 --- a/packages/optimizely-sdk/CHANGELOG.MD +++ b/packages/optimizely-sdk/CHANGELOG.MD @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed +- Add package.json script for running Karma tests locally using Chrome ([#651](https://github.com/optimizely/javascript-sdk/pull/651)). + ## [4.9.1] - January 18, 2022 ### Bug fixes