Skip to content

Commit c8b7ed4

Browse files
committed
use lodash merge instead of ... to support deep merging
1 parent b25613f commit c8b7ed4

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
22
const webpack = require('webpack')
33
const Config = require('webpack-chain')
4+
const merge = require('lodash.merge')
45

56
module.exports = (api, options) => {
67
// If plugin options are provided in vue.config.js, those will be used. Otherwise it is empty object
@@ -163,11 +164,11 @@ module.exports = (api, options) => {
163164
.build({
164165
// Args parsed with yargs
165166
...builderArgs,
166-
config: {
167-
...defaultBuildConfig,
167+
config: merge(
168+
defaultBuildConfig,
168169
// User-defined config overwrites defaults
169-
...userBuildConfig
170-
}
170+
userBuildConfig
171+
)
171172
})
172173
.then(() => {
173174
// handle result
@@ -290,7 +291,7 @@ module.exports = (api, options) => {
290291
if (args.debug) {
291292
// Do not launch electron and provide instructions on launching through debugger
292293
console.log(
293-
'Not launching electron as debug argument was passed. You must launch electron though your debugger.'
294+
'\nNot launching electron as debug argument was passed. You must launch electron though your debugger.'
294295
)
295296
console.log(
296297
`If you are using Spectron, make sure to set the IS_TEST env variable to true.`

lib/testWithSpectron.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const execa = require('execa')
22
const Application = require('spectron').Application
33
const electronPath = require('electron')
4+
const merge = require('lodash.merge')
45
const portfinder = require('portfinder')
56

67
portfinder.basePort = 9515
@@ -32,18 +33,19 @@ module.exports = (options = {}) =>
3233
const url = urlMatch[0].split('=')[1]
3334
let app
3435
if (!options.noSpectron) {
35-
const spectronOptions = {
36-
path: electronPath,
37-
args: [`${outputDir}/background.js`],
38-
env: {
39-
IS_TEST: true
36+
const spectronOptions = merge(
37+
{
38+
path: electronPath,
39+
args: [`${outputDir}/background.js`],
40+
env: {
41+
IS_TEST: true
42+
},
43+
// Make sure tests do not interfere with each other
44+
port: await portfinder.getPortPromise()
4045
},
41-
// Make sure tests do not interfere with each other
42-
port: await portfinder.getPortPromise(),
4346
// Apply user options
44-
...options.spectronOptions
45-
}
46-
47+
options.spectronOptions
48+
)
4749
// Launch app with spectron
4850
app = new Application(spectronOptions)
4951
if (!options.noStart) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"electron-builder": "^20.18.0",
2828
"execa": "^0.10.0",
2929
"fs-extra": "^6.0.1",
30+
"lodash.merge": "^4.6.1",
3031
"spectron": "^3.8.0",
3132
"uglifyjs-webpack-plugin": "^1.2.5",
3233
"webpack": "^4.12.0",

0 commit comments

Comments
 (0)