2018-03-06 15:06:23 +08:00
|
|
|
import puppeteer from 'puppeteer'
|
2017-09-12 16:08:03 +08:00
|
|
|
|
2017-09-10 19:41:34 +08:00
|
|
|
import { jsConfig } from './webpack.config.base'
|
2017-09-03 09:09:58 +08:00
|
|
|
|
2018-03-06 15:06:23 +08:00
|
|
|
process.env.CHROME_BIN = puppeteer.executablePath()
|
2017-09-12 16:08:03 +08:00
|
|
|
|
2017-09-09 21:47:21 +08:00
|
|
|
const webpackConfig = jsConfig()
|
2017-09-03 09:50:25 +08:00
|
|
|
|
2017-09-10 21:23:04 +08:00
|
|
|
export default function (config) {
|
2017-04-11 22:14:25 +08:00
|
|
|
config.set({
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
2017-04-11 22:14:25 +08:00
|
|
|
basePath: '.',
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// frameworks to use
|
|
|
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
2017-04-18 23:20:38 +08:00
|
|
|
frameworks: ['jasmine'],
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// list of files / patterns to load in the browser
|
2017-04-11 22:14:25 +08:00
|
|
|
files: [
|
2017-09-12 15:50:58 +08:00
|
|
|
'./src/**/*.spec.js'
|
2017-04-11 22:14:25 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
preprocessors: {
|
2017-09-12 16:08:03 +08:00
|
|
|
'src/**/*.spec.js': ['webpack', 'sourcemap']
|
2017-04-11 22:14:25 +08:00
|
|
|
},
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-18 23:20:38 +08:00
|
|
|
webpack: {
|
2018-03-06 14:37:27 +08:00
|
|
|
mode: 'development',
|
2017-09-11 23:06:34 +08:00
|
|
|
node: webpackConfig.node,
|
2017-09-12 16:08:03 +08:00
|
|
|
module: webpackConfig.module,
|
|
|
|
devtool: 'inline-source-map'
|
2017-04-11 22:14:25 +08:00
|
|
|
},
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// test results reporter to use
|
|
|
|
// possible values: 'dots', 'progress'
|
|
|
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
2017-04-11 22:14:25 +08:00
|
|
|
reporters: ['dots'],
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// web server port
|
2017-04-11 22:14:25 +08:00
|
|
|
port: 9876,
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// enable / disable colors in the output (reporters and logs)
|
2017-04-11 22:14:25 +08:00
|
|
|
colors: true,
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// level of logging
|
|
|
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
2017-04-11 22:14:25 +08:00
|
|
|
logLevel: config.LOG_INFO,
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// enable / disable watching file and executing tests whenever any file changes
|
2017-04-11 22:14:25 +08:00
|
|
|
autoWatch: true,
|
2014-11-04 07:50:58 +01:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// start these browsers
|
|
|
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
2018-03-06 15:06:23 +08:00
|
|
|
browsers: ['ChromeHeadless'],
|
2017-09-12 15:50:58 +08:00
|
|
|
|
2017-04-17 00:12:30 +08:00
|
|
|
// Continuous Integration mode
|
|
|
|
// if true, Karma captures browsers, runs the tests and exits
|
2018-03-06 14:37:27 +08:00
|
|
|
singleRun: true
|
2017-04-11 22:14:25 +08:00
|
|
|
})
|
|
|
|
}
|