Skip to content

Commit 4bce3b3

Browse files
committed
[skip ci] fix spectron being launched twice in serve tests
1 parent 66e24bf commit 4bce3b3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

__tests__/serve.helper.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ const portfinder = require('portfinder')
77
portfinder.basePort = 9515
88
const serve = (project, notifyUpdate) =>
99
new Promise((resolve, reject) => {
10-
const child = project.run('vue-cli-service serve:electron')
10+
// --debug to prevent Electron from being launched
11+
const child = project.run('vue-cli-service serve:electron --debug')
1112
let log = ''
1213
child.stdout.on('data', async data => {
1314
data = data.toString()
1415
log += data
1516
try {
16-
if (data.match(/Launching Electron\.\.\./)) {
17+
if (
18+
data.match(
19+
// Dev server is finished and background.js is created
20+
/Not launching electron as debug argument was passed\. You must launch electron though your debugger\./
21+
)
22+
) {
1723
resolve({
1824
stdout: log,
1925
stopServe: () => {
@@ -37,8 +43,6 @@ const runTests = useTS =>
3743
const { project, projectName } = await create('serve', useTS)
3844
const projectPath = p =>
3945
path.join(process.cwd(), '__tests__/projects/' + projectName, p)
40-
// Prevent electron from being launched
41-
jest.mock('execa')
4246
// Wait for dev server to start
4347
const { stopServe } = await serve(project)
4448
expect(project.has('dist_electron/background.js')).toBe(true)

0 commit comments

Comments
 (0)