Skip to content

Commit b65b6e1

Browse files
authored
test: Add package.json script for running Karma tests locally using Chrome (#651)
## Summary Make it easy to run the Karma tests locally, not via Browserstack. ## Test plan Run tests
1 parent f8b878b commit b65b6e1

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

packages/optimizely-sdk/CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Changed
11+
- Add package.json script for running Karma tests locally using Chrome ([#651](https://github.com/optimizely/javascript-sdk/pull/651)).
12+
1013
## [4.9.1] - January 18, 2022
1114

1215
### Bug fixes
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright 2021 Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
const baseConfig = require('./karma.base.conf');
17+
18+
module.exports = function(config) {
19+
config.set({
20+
...baseConfig,
21+
plugins: ['karma-mocha', 'karma-webpack', 'karma-chrome-launcher'],
22+
browserStack: null,
23+
browsers: ['Chrome'],
24+
files: [
25+
'./node_modules/promise-polyfill/dist/polyfill.min.js',
26+
'./lib/index.browser.tests.js'
27+
],
28+
});
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright 2021 Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
const baseConfig = require('./karma.base.conf');
17+
18+
module.exports = function(config) {
19+
config.set({
20+
...baseConfig,
21+
plugins: ['karma-mocha', 'karma-webpack', 'karma-chrome-launcher'],
22+
browserStack: null,
23+
browsers: ['Chrome'],
24+
files: [
25+
'./node_modules/promise-polyfill/dist/polyfill.min.js',
26+
'./dist/optimizely.browser.umd.min.js',
27+
'./lib/index.browser.umdtests.js'
28+
],
29+
});
30+
}

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"test-ci": "npm run test-xbrowser && npm run test-umdbrowser",
1616
"test-xbrowser": "karma start karma.bs.conf.js --single-run",
1717
"test-umdbrowser": "npm run build-browser-umd && karma start karma.umd.conf.js --single-run",
18+
"test-karma-local": "karma start karma.local_chrome.bs.conf.js && npm run build-browser-umd && karma start karma.local_chrome.umd.conf.js",
1819
"prebuild": "npm run clean",
1920
"build": "rollup -c",
2021
"build-browser-umd": "rollup -c --config-umd",

0 commit comments

Comments
 (0)