|
1 |
| -// Karma configuration |
2 |
| -// Generated on Thu Mar 29 2018 11:50:44 GMT-0400 (EDT) |
3 |
| - |
4 | 1 | module.exports = (config) => {
|
5 | 2 | 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 |
10 | 3 | frameworks: ['jasmine'],
|
11 |
| - // list of files / patterns to load in the browser |
12 | 4 | files: [
|
13 |
| - 'src/*/*.test.js', |
14 |
| - 'src/images/*.jpg', |
| 5 | + 'src/index.js', |
| 6 | + 'src/**/*_test.js', |
15 | 7 | ],
|
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 |
20 | 8 | preprocessors: {
|
21 |
| - // add webpack as preprocessor |
22 |
| - 'src/*/*.test.js': ['webpack'], |
| 9 | + 'src/index.js': ['webpack'], |
23 | 10 | },
|
24 | 11 | webpack: {
|
25 |
| - // karma watches the test entry points |
26 |
| - // (you don't need to specify the entry option) |
27 |
| - // webpack watches dependencies |
28 |
| - |
29 |
| - // webpack configuration |
30 |
| - |
| 12 | + // TODO: This is duplication of the webpack.common.babel.js file, but they |
| 13 | + // use different import syntaxes so it's not easy to just require it here. |
| 14 | + // Maybe this could be put into a JSON file, but the include in the module |
| 15 | + // rules is dynamic. |
| 16 | + entry: ['babel-polyfill', './src/index.js'], |
| 17 | + output: { |
| 18 | + libraryTarget: 'umd', |
| 19 | + filename: 'ml5.js', |
| 20 | + library: 'ml5', |
| 21 | + }, |
| 22 | + module: { |
| 23 | + rules: [ |
| 24 | + { |
| 25 | + enforce: 'pre', |
| 26 | + test: /\.js$/, |
| 27 | + exclude: /node_modules/, |
| 28 | + loader: 'eslint-loader', |
| 29 | + }, |
| 30 | + { |
| 31 | + test: /\.js$/, |
| 32 | + loader: 'babel-loader', |
| 33 | + include: require('path').resolve(__dirname, 'src'), |
| 34 | + }, |
| 35 | + ], |
| 36 | + }, |
| 37 | + // Don't minify the webpack build for better stack traces |
| 38 | + optimization: { |
| 39 | + minimize: false, |
| 40 | + }, |
31 | 41 | },
|
32 | 42 | webpackMiddleware: {
|
33 |
| - // webpack-dev-middleware configuration |
34 |
| - // i. e. |
| 43 | + noInfo: true, |
35 | 44 | stats: 'errors-only',
|
36 | 45 | },
|
37 |
| - // test results reporter to use |
38 |
| - // possible values: 'dots', 'progress' |
39 |
| - // available reporters: https://npmjs.org/browse/keyword/karma-reporter |
| 46 | + browserStack: { |
| 47 | + username: process.env.BROWSERSTACK_USERNAME, |
| 48 | + accessKey: process.env.BROWSERSTACK_ACCESS_KEY |
| 49 | + }, |
| 50 | + captureTimeout: 120000, |
| 51 | + reportSlowerThan: 500, |
| 52 | + browserNoActivityTimeout: 180000, |
| 53 | + customLaunchers: { |
| 54 | + bs_chrome_mac: { |
| 55 | + base: 'BrowserStack', |
| 56 | + browser: 'chrome', |
| 57 | + browser_version: 'latest', |
| 58 | + os: 'OS X', |
| 59 | + os_version: 'High Sierra' |
| 60 | + }, |
| 61 | + }, |
40 | 62 | reporters: ['progress'],
|
41 |
| - // web server port |
42 | 63 | port: 9876,
|
43 |
| - // enable / disable colors in the output (reporters and logs) |
44 | 64 | colors: true,
|
45 |
| - // level of logging |
46 |
| - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
47 | 65 | logLevel: config.LOG_INFO,
|
48 |
| - // enable / disable watching file and executing tests whenever any file changes |
49 | 66 | autoWatch: true,
|
50 |
| - // start these browsers |
51 |
| - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
52 |
| - // browsers: ['Chrome', 'Firefox', 'Safari'], |
53 | 67 | browsers: ['Chrome'],
|
54 |
| - // Continuous Integration mode |
55 |
| - // if true, Karma captures browsers, runs the tests and exits |
56 | 68 | singleRun: false,
|
57 |
| - // Concurrency level |
58 |
| - // how many browser should be started simultaneous |
59 |
| - concurrency: Infinity, |
| 69 | + concurrency: Infinity |
60 | 70 | });
|
61 | 71 | };
|
0 commit comments