Last active
March 27, 2017 22:46
-
-
Save matrunchyk/a79accea739f586074e005e0542200ea to your computer and use it in GitHub Desktop.
Laravel + VueJS + Karma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpackConfig = require('../../../../../node_modules/laravel-mix/setup/webpack.config'); | |
// const path = require('path'); | |
// safari >=4 | |
// no need for app entry during tests | |
delete webpackConfig.entry; | |
module.exports = (config) => { | |
// noinspection ES6ConvertVarToLetConst | |
var browsers = ['Chrome', 'PhantomJS']; // eslint-disable-line | |
config.set({ | |
// start these browsers | |
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | |
browsers: browsers, // eslint-disable-line | |
// Continuous Integration mode | |
// if true, Karma captures browsers, runs the tests and exits | |
singleRun: true, | |
// enable / disable watching file and executing tests whenever any file changes | |
autoWatch: true, | |
// frameworks to use | |
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
frameworks: ['mocha', 'sinon-chai'], | |
// test results reporter to use | |
// possible values: 'dots', 'progress' | |
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | |
// reporters: ['progress', 'spec', 'coverage', 'coverage-istanbul'], | |
reporters: ['spec'], | |
coverageReporter: { | |
dir: './coverage', | |
reporters: [ | |
{ type: 'lcov', subdir: '.' }, | |
{ type: 'text-summary' }, | |
] | |
}, | |
// List of files / patterns to load in the browser | |
files: [ | |
'./index.js', // This is an entry point (for GLOBBED files) | |
{ | |
pattern: '../../../../../node_modules/jquery/dist/jquery.min.js', | |
requirejs: { | |
name: 'jquery', | |
} | |
}, | |
{ | |
pattern: '../../../../../node_modules/tether/dist/js/tether.js', | |
requirejs: { | |
name: 'tether', | |
} | |
}, | |
{ | |
pattern: '../../../../../node_modules/bootstrap/dist/js/bootstrap.js', | |
requirejs: { | |
name: 'bootstrap', | |
} | |
}, | |
], | |
// preprocess matching files before serving them to the browser | |
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | |
preprocessors: { | |
'./index.js': ['webpack', 'sourcemap'], | |
}, | |
webpack: webpackConfig, | |
webpackMiddleware: { | |
noInfo: true, | |
}, | |
// level of logging | |
// possible values: | |
// config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || | |
// config.LOG_INFO || config.LOG_DEBUG | |
logLevel: config.LOG_INFO, | |
client: { | |
mocha: { | |
bail: true, | |
}, | |
}, | |
// web server port | |
port: 9876, | |
// enable / disable colors in the output (reporters and logs) | |
colors: true, | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment