1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 'use strict'
- const path = require('path')
- const merge = require('webpack-merge')
- const webpack = require('webpack')
- const baseConfig = require('../../.electron-vue/webpack.renderer.config')
- const projectRoot = path.resolve(__dirname, '../../src/renderer')
- // Set BABEL_ENV to use proper preset config
- process.env.BABEL_ENV = 'test'
- let webpackConfig = merge(baseConfig, {
- devtool: '#inline-source-map',
- plugins: [
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': '"testing"'
- })
- ]
- })
- // don't treat dependencies as externals
- delete webpackConfig.entry
- delete webpackConfig.externals
- delete webpackConfig.output.libraryTarget
- // apply vue option to apply isparta-loader on js
- webpackConfig.module.rules
- .find(rule => rule.use.loader === 'vue-loader').use.options.loaders.js = 'babel-loader'
- module.exports = config => {
- config.set({
- browsers: ['visibleElectron'],
- client: {
- useIframe: false
- },
- coverageReporter: {
- dir: './coverage',
- reporters: [
- { type: 'lcov', subdir: '.' },
- { type: 'text-summary' }
- ]
- },
- customLaunchers: {
- 'visibleElectron': {
- base: 'Electron',
- flags: ['--show']
- }
- },
- frameworks: ['mocha', 'chai'],
- files: ['./index.js'],
- preprocessors: {
- './index.js': ['webpack', 'sourcemap']
- },
- reporters: ['spec', 'coverage'],
- singleRun: true,
- webpack: webpackConfig,
- webpackMiddleware: {
- noInfo: true
- }
- })
- }
|