Skip to content

Commit 3a930cd

Browse files
authored
Merge pull request #168 from nsthorat/master
Set up browserstack.
2 parents 3f699b2 + 1296842 commit 3a930cd

File tree

12 files changed

+34
-9993
lines changed

12 files changed

+34
-9993
lines changed

β€Ž.gitignoreβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ website/node_modules
1818

1919
website/i18n/*
2020
!website/i18n/en.json
21+
22+
yarn-error.log

β€Ž.travis.ymlβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ node_js:
55
git:
66
depth: 5
77
script:
8-
- yarn build
8+
- yarn build
9+
- yarn test-travis

β€Žkarma.conf.jsβ€Ž

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,46 @@
1-
// Karma configuration
2-
// Generated on Thu Mar 29 2018 11:50:44 GMT-0400 (EDT)
3-
41
module.exports = (config) => {
52
config.set({
6-
// base path that will be used to resolve all patterns (eg. files, exclude)
7-
basePath: '',
8-
// frameworks to use
9-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
103
frameworks: ['jasmine'],
11-
// list of files / patterns to load in the browser
124
files: [
13-
'src/*/*.test.js',
14-
'src/images/*.jpg',
5+
'src/**/*_test.js',
156
],
16-
// list of files / patterns to exclude
17-
exclude: [],
18-
// preprocess matching files before serving them to the browser
19-
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
207
preprocessors: {
21-
// add webpack as preprocessor
22-
'src/*/*.test.js': ['webpack'],
8+
'src/**/*_test.js': ['webpack'],
239
},
2410
webpack: {
2511
// karma watches the test entry points
2612
// (you don't need to specify the entry option)
2713
// webpack watches dependencies
2814

2915
// webpack configuration
30-
3116
},
3217
webpackMiddleware: {
33-
// webpack-dev-middleware configuration
34-
// i. e.
18+
noInfo: true,
3519
stats: 'errors-only',
3620
},
37-
// test results reporter to use
38-
// possible values: 'dots', 'progress'
39-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
21+
browserStack: {
22+
username: process.env.BROWSERSTACK_USERNAME,
23+
accessKey: process.env.BROWSERSTACK_ACCESS_KEY
24+
},
25+
captureTimeout: 120000,
26+
reportSlowerThan: 500,
27+
browserNoActivityTimeout: 180000,
28+
customLaunchers: {
29+
bs_chrome_mac: {
30+
base: 'BrowserStack',
31+
browser: 'chrome',
32+
browser_version: 'latest',
33+
os: 'OS X',
34+
os_version: 'High Sierra'
35+
},
36+
},
4037
reporters: ['progress'],
41-
// web server port
4238
port: 9876,
43-
// enable / disable colors in the output (reporters and logs)
4439
colors: true,
45-
// level of logging
46-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
4740
logLevel: config.LOG_INFO,
48-
// enable / disable watching file and executing tests whenever any file changes
4941
autoWatch: true,
50-
// start these browsers
51-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
52-
// browsers: ['Chrome', 'Firefox', 'Safari'],
5342
browsers: ['Chrome'],
54-
// Continuous Integration mode
55-
// if true, Karma captures browsers, runs the tests and exits
5643
singleRun: false,
57-
// Concurrency level
58-
// how many browser should be started simultaneous
59-
concurrency: Infinity,
44+
concurrency: Infinity
6045
});
6146
};

β€Žpackage.jsonβ€Ž

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"prebuild": "rimraf dist",
1313
"start": "webpack-dev-server --open --config webpack.dev.babel.js",
1414
"build": "webpack --config webpack.prod.babel.js",
15-
"test:dev": "./node_modules/karma/bin/karma start karma.conf.js",
16-
"test": "./node_modules/karma/bin/karma start karma.conf.js --no-auto-watch --single-run"
15+
"test": "./node_modules/karma/bin/karma start karma.conf.js",
16+
"test-travis": "./scripts/test-travis.sh"
1717
},
1818
"repository": {
1919
"type": "git",
@@ -48,10 +48,9 @@
4848
"html-webpack-plugin": "^3.0.7",
4949
"jasmine-core": "3.1.0",
5050
"karma": "2.0.0",
51+
"karma-browserstack-launcher": "~1.3.0",
5152
"karma-chrome-launcher": "2.2.0",
52-
"karma-firefox-launcher": "1.1.0",
5353
"karma-jasmine": "1.1.1",
54-
"karma-safari-launcher": "1.0.0",
5554
"karma-webpack": "3.0.0",
5655
"npm-run-all": "4.1.2",
5756
"regenerator-runtime": "0.11.1",

β€Žscripts/test-travis.shβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ $(node -v) = *v10* ]]; then
4+
karma start \
5+
--browsers='bs_chrome_mac' \
6+
--singleRun --reporters='dots,progress,BrowserStack'
7+
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
Β (0)