electron reported an error when running the unit test, but the specific cause of the error was not seen. What is the solution?
karma configuration:
"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"
process.env.NODE_ENV = "test"
let webpackConfig = merge(baseConfig, {
devtool: "-sharpinline-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 => {
return !Array.isArray(rule) && rule.use instanceof Object && 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
},
port: 9988,
listenAddress: "127.0.0.1",
})
}
error result: