Skip to content

Commit 2642529

Browse files
committed
chore: remove extra spacing on some comments
1 parent 2b3aebd commit 2642529

File tree

10 files changed

+142
-128
lines changed

10 files changed

+142
-128
lines changed

__tests__/build.helper.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ const portfinder = require('portfinder')
55
const checkLogs = require('./checkLogs.helper.js')
66

77
portfinder.basePort = 9515
8-
const runTests = async useTS => {
8+
const runTests = async (useTS) => {
99
const { project, projectName } = await create('build', useTS)
1010

1111
const isWin = process.platform === 'win32'
12-
const projectPath = p =>
12+
const projectPath = (p) =>
1313
path.join(process.cwd(), '__tests__/projects/' + projectName, p)
1414

1515
await project.run('vue-cli-service electron:build --x64 --dir')
16-
// Ensure /dist is not modified
16+
// Ensure /dist is not modified
1717
expect(project.has('dist')).toBe(false)
18-
// Ensure build successfully outputted files
18+
// Ensure build successfully outputted files
1919
expect(project.has('dist_electron/bundled/index.html')).toBe(true)
2020
expect(project.has('dist_electron/bundled/favicon.ico')).toBe(true)
2121
expect(project.has('dist_electron/bundled/js')).toBe(true)
@@ -30,7 +30,7 @@ const runTests = async useTS => {
3030
true
3131
)
3232
}
33-
// Ensure that setup files were not created
33+
// Ensure that setup files were not created
3434
expect(project.has(`dist_electron/${projectName} Setup 0.1.0.exe`)).toBe(
3535
false
3636
)
@@ -41,9 +41,9 @@ const runTests = async useTS => {
4141
// Launch app with spectron
4242
const app = new Application({
4343
path: `./__tests__/projects/${projectName}/dist_electron/${
44-
isWin ? 'win' : 'linux'
45-
}-unpacked/${projectName}${isWin ? '.exe' : ''}`,
46-
// Make sure tests do not interfere with each other
44+
isWin ? 'win' : 'linux'
45+
}-unpacked/${projectName}${isWin ? '.exe' : ''}`,
46+
// Make sure tests do not interfere with each other
4747
port: await portfinder.getPortPromise(),
4848
// Increase wait timeout for parallel testing
4949
waitTimeout: 10000
@@ -56,24 +56,24 @@ const runTests = async useTS => {
5656
// Check that proper info was logged
5757
await checkLogs({ client, projectName, projectPath, mode: 'build' })
5858

59-
// Window was created
59+
// Window was created
6060
expect(await client.getWindowCount()).toBe(1)
61-
// It is not minimized
61+
// It is not minimized
6262
expect(await win.isMinimized()).toBe(false)
63-
// Dev tools is not open
63+
// Dev tools is not open
6464
expect(await win.isDevToolsOpened()).toBe(false)
65-
// Window is visible
65+
// Window is visible
6666
expect(await win.isVisible()).toBe(true)
67-
// Size is correct
67+
// Size is correct
6868
const { width, height } = await win.getBounds()
6969
expect(width).toBeGreaterThan(0)
7070
expect(height).toBeGreaterThan(0)
7171
// Load was successful
7272
expect(await app.webContents.isLoading()).toBe(false)
73-
// App is loaded properly
73+
// App is loaded properly
7474
expect(
7575
(await client.getHTML('#app')).indexOf(
76-
`Welcome to Your Vue.js ${useTS ? '+ TypeScript ' : ''}App`
76+
`Welcome to Your Vue.js ${useTS ? '+ TypeScript ' : ''}App`
7777
)
7878
).not.toBe(-1)
7979

__tests__/checkLogs.helper.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
77
`dist_electron/${isWin ? 'win' : 'linux'}-unpacked/resources/app.asar`
88
)
99

10-
await client.getRenderProcessLogs().then(logs => {
11-
logs.forEach(log => {
12-
// Make sure there are no fatal errors
10+
await client.getRenderProcessLogs().then((logs) => {
11+
logs.forEach((log) => {
12+
// Make sure there are no fatal errors
1313
expect(log.level).not.toBe('SEVERE')
1414
})
1515
let appBaseUrl = logs
16-
// Find BASE_URL log
17-
.find(v => v.message.indexOf('process.env.BASE_URL=') !== -1)
16+
// Find BASE_URL log
17+
.find((v) => v.message.indexOf('process.env.BASE_URL=') !== -1)
1818
// Get just the value
1919
.message.split('=')[1]
2020
// Remove any quotes
2121
appBaseUrl = appBaseUrl.replace('"', '')
22-
// Base url should be root of server or packaged asar
22+
// Base url should be root of server or packaged asar
2323
expect(path.normalize(appBaseUrl)).toBe(
2424
isBuild ? outputPath : path.sep /* Server root */
2525
)
2626

2727
let appStatic = logs
28-
// Find __static log
29-
.find(v => v.message.indexOf('__static=') !== -1)
28+
// Find __static log
29+
.find((v) => v.message.indexOf('__static=') !== -1)
3030
// Get just the value
3131
.message.split('=')[1]
3232
// Remove any quotes
3333
appStatic = appStatic.replace('"', '')
34-
// __static should point to public folder or packaged asar
34+
// __static should point to public folder or packaged asar
3535
expect(path.normalize(appStatic)).toBe(
3636
isBuild ? outputPath : projectPath('public')
3737
)
3838

3939
let vuePath = logs
40-
// Find vuePath log
41-
.find(v => v.message.indexOf('vuePath=') !== -1)
40+
// Find vuePath log
41+
.find((v) => v.message.indexOf('vuePath=') !== -1)
4242
// Get just the value
4343
.message.split('=')[1]
4444
// Remove any quotes
@@ -51,8 +51,8 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
5151
}
5252

5353
let mockExternalPath = logs
54-
// Find externalModulePath log
55-
.find(v => v.message.indexOf('mockExternalPath=') !== -1)
54+
// Find externalModulePath log
55+
.find((v) => v.message.indexOf('mockExternalPath=') !== -1)
5656
// Get just the value
5757
.message.split('=')[1]
5858
// Remove any quotes
@@ -63,22 +63,22 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
6363
}
6464
})
6565

66-
await client.getMainProcessLogs().then(logs => {
66+
await client.getMainProcessLogs().then((logs) => {
6767
let appStatic = logs
68-
// Find __static log
69-
.find(m => m.indexOf('__static=') !== -1)
68+
// Find __static log
69+
.find((m) => m.indexOf('__static=') !== -1)
7070
// Get just the value
7171
.split('=')[1]
7272
// Remove any quotes
7373
appStatic = appStatic.replace('"', '').split(',')[0]
74-
// __static should point to public folder or packaged asar
74+
// __static should point to public folder or packaged asar
7575
expect(path.normalize(appStatic)).toBe(
7676
isBuild ? outputPath : projectPath('public')
7777
)
7878

7979
let mockExternalPath = logs
80-
// Find externalModulePath log
81-
.find(v => v.indexOf('mockExternalPath=') !== -1)
80+
// Find externalModulePath log
81+
.find((v) => v.indexOf('mockExternalPath=') !== -1)
8282
// Get just the value
8383
.split('=')[1]
8484
// Remove any quotes

__tests__/commands.spec.js

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ console.log = jest.fn()
7171
beforeEach(() => {
7272
jest.clearAllMocks()
7373
})
74-
chokidar.watch.mockImplementation(file => {
74+
chokidar.watch.mockImplementation((file) => {
7575
return {
7676
on: (type, cb) => {}
7777
}
@@ -84,14 +84,14 @@ const runCommand = async (command, options = {}, args = {}, rawArgs = []) => {
8484
if (!args._) args._ = []
8585
const commands = {}
8686
const api = {
87-
// Make app think typescript plugin is installed
87+
// Make app think typescript plugin is installed
8888
hasPlugin: jest.fn().mockReturnValue(true),
8989
registerCommand: jest.fn().mockImplementation((name, options, command) => {
9090
// Save registered commands
9191
commands[name] = command
9292
}),
9393
// So we can ensure that files were resolved properly
94-
resolve: jest.fn(path => 'projectPath/' + path),
94+
resolve: jest.fn((path) => 'projectPath/' + path),
9595
chainWebpack: jest.fn(),
9696
service: {
9797
// Mock api.service.run('build/serve')
@@ -120,13 +120,13 @@ describe('electron:build', () => {
120120
})
121121

122122
const mainConfig = webpack.mock.calls[0][0]
123-
// Typescript rule is not added
123+
// Typescript rule is not added
124124
expect(Object.keys(mainConfig)).not.toContain('module')
125-
// Ts files are not resolved
125+
// Ts files are not resolved
126126
expect(
127127
mainConfig.resolve.extensions ? mainConfig.resolve.extensions : []
128128
).not.toContain('ts')
129-
// Proper entry file is used
129+
// Proper entry file is used
130130
expect(mainConfig.entry.background[0]).toBe('projectPath/src/background.js')
131131
})
132132

@@ -140,7 +140,7 @@ describe('electron:build', () => {
140140
})
141141

142142
const mainConfig = webpack.mock.calls[0][0]
143-
// Proper entry file is used
143+
// Proper entry file is used
144144
expect(mainConfig.entry.background[0]).toBe(
145145
'projectPath/customBackground.js'
146146
)
@@ -156,11 +156,11 @@ describe('electron:build', () => {
156156
})
157157

158158
const mainConfig = webpack.mock.calls[0][0]
159-
// Main config output is correct
159+
// Main config output is correct
160160
expect(mainConfig.output.path).toBe('projectPath/output/bundled')
161161
// cli-service build output is correct
162162
expect(serviceRun.mock.calls[0][1].dest).toBe(`output${path.sep}bundled`)
163-
// Electron-builder output is correct
163+
// Electron-builder output is correct
164164
expect(builder.build.mock.calls[0][0].config.directories.output).toBe(
165165
'output'
166166
)
@@ -170,11 +170,11 @@ describe('electron:build', () => {
170170
await runCommand('electron:build', {}, { dest: 'output' })
171171

172172
const mainConfig = webpack.mock.calls[0][0]
173-
// Main config output is correct
173+
// Main config output is correct
174174
expect(mainConfig.output.path).toBe('projectPath/output/bundled')
175175
// cli-service build output is correct
176176
expect(serviceRun.mock.calls[0][1].dest).toBe(`output${path.sep}bundled`)
177-
// Electron-builder output is correct
177+
// Electron-builder output is correct
178178
expect(builder.build.mock.calls[0][0].config.directories.output).toBe(
179179
'output'
180180
)
@@ -184,7 +184,7 @@ describe('electron:build', () => {
184184
await runCommand('electron:build', {
185185
pluginOptions: {
186186
electronBuilder: {
187-
chainWebpackMainProcess: config => {
187+
chainWebpackMainProcess: (config) => {
188188
config.node.set('shouldBe', 'expected')
189189
return config
190190
}
@@ -269,7 +269,7 @@ describe('electron:build', () => {
269269

270270
test.each(['report', 'report-json'])(
271271
'--%s arg is passed to renderer build',
272-
async argName => {
272+
async (argName) => {
273273
const args = {}
274274
args[argName] = true
275275
await runCommand('electron:build', {}, args)
@@ -339,7 +339,7 @@ describe('electron:build', () => {
339339

340340
test.each(['string config', 'object config'])(
341341
'Adds mock legacy assets file for each page (%s)',
342-
async configType => {
342+
async (configType) => {
343343
const stringConfig = configType === 'string config'
344344
await runCommand('electron:build', {
345345
pages: {
@@ -408,7 +408,9 @@ describe('electron:build', () => {
408408
expect(webpack).toBeCalledTimes(2)
409409
const preloadWebpackCall = webpack.mock.calls[1][0]
410410
expect(preloadWebpackCall.target).toBe('electron-preload')
411-
expect(preloadWebpackCall.entry).toEqual({ preload: ['projectPath/preloadFile'] })
411+
expect(preloadWebpackCall.entry).toEqual({
412+
preload: ['projectPath/preloadFile']
413+
})
412414
// Make sure preload bundle has been run
413415
expect(mockRun).toHaveBeenCalledTimes(2)
414416
webpack.mockClear()
@@ -454,13 +456,13 @@ describe('electron:serve', () => {
454456
})
455457

456458
const mainConfig = webpack.mock.calls[0][0]
457-
// Typescript rule is not added
459+
// Typescript rule is not added
458460
expect(Object.keys(mainConfig)).not.toContain('module')
459-
// Ts files are not resolved
461+
// Ts files are not resolved
460462
expect(
461463
mainConfig.resolve.extensions ? mainConfig.resolve.extensions : []
462464
).not.toContain('ts')
463-
// Proper entry file is used
465+
// Proper entry file is used
464466
expect(mainConfig.entry.index[0]).toBe('projectPath/src/background.js')
465467
})
466468

@@ -474,7 +476,7 @@ describe('electron:serve', () => {
474476
})
475477

476478
const mainConfig = webpack.mock.calls[0][0]
477-
// Proper entry file is used
479+
// Proper entry file is used
478480
expect(mainConfig.entry.index[0]).toBe('projectPath/customBackground.js')
479481
})
480482

@@ -488,15 +490,15 @@ describe('electron:serve', () => {
488490
})
489491

490492
const mainConfig = webpack.mock.calls[0][0]
491-
// Main config output is correct
493+
// Main config output is correct
492494
expect(mainConfig.output.path).toBe('projectPath/output')
493495
})
494496

495497
test('Custom main process webpack config is used if provided', async () => {
496498
await runCommand('electron:serve', {
497499
pluginOptions: {
498500
electronBuilder: {
499-
chainWebpackMainProcess: config => {
501+
chainWebpackMainProcess: (config) => {
500502
config.node.set('shouldBe', 'expected')
501503
return config
502504
}
@@ -565,7 +567,7 @@ describe('electron:serve', () => {
565567
// UglifyJS plugin does not exist
566568
expect(
567569
mainConfig.plugins.find(
568-
p => p.__pluginConstructorName === 'UglifyJsPlugin'
570+
(p) => p.__pluginConstructorName === 'UglifyJsPlugin'
569571
)
570572
).toBeUndefined()
571573
// Source maps are enabled
@@ -604,7 +606,9 @@ describe('electron:serve', () => {
604606
})
605607

606608
// Proper file is watched
607-
expect(chokidar.watch.mock.calls[0][0]).toEqual(['projectPath/customBackground'])
609+
expect(chokidar.watch.mock.calls[0][0]).toEqual([
610+
'projectPath/customBackground'
611+
])
608612
// Child has not yet been killed or unwatched
609613
expect(mockExeca.send).not.toBeCalled()
610614
expect(mockExeca.kill).not.toBeCalled()
@@ -643,10 +647,10 @@ describe('electron:serve', () => {
643647
// So we can make sure it wasn't called
644648
jest.spyOn(process, 'exit')
645649
const watchCb = {}
646-
chokidar.watch.mockImplementation(files => {
650+
chokidar.watch.mockImplementation((files) => {
647651
return {
648652
on: (type, cb) => {
649-
files.forEach(file => {
653+
files.forEach((file) => {
650654
// Set callback to be called later
651655
watchCb[file] = cb
652656
})
@@ -665,7 +669,10 @@ describe('electron:serve', () => {
665669
})
666670

667671
// Proper file is watched
668-
expect(chokidar.watch.mock.calls[0][0]).toEqual(['projectPath/customBackground', 'projectPath/listFile'])
672+
expect(chokidar.watch.mock.calls[0][0]).toEqual([
673+
'projectPath/customBackground',
674+
'projectPath/listFile'
675+
])
669676
// Child has not yet been killed or unwatched
670677
expect(mockExeca.send).not.toBeCalled()
671678
expect(mockExeca.kill).not.toBeCalled()
@@ -864,7 +871,9 @@ describe('electron:serve', () => {
864871
expect(webpack).toBeCalledTimes(2)
865872
const preloadWebpackCall = webpack.mock.calls[1][0]
866873
expect(preloadWebpackCall.target).toBe('electron-preload')
867-
expect(preloadWebpackCall.entry).toEqual({ preload: ['projectPath/preloadFile'] })
874+
expect(preloadWebpackCall.entry).toEqual({
875+
preload: ['projectPath/preloadFile']
876+
})
868877
// Make sure preload bundle has been run
869878
expect(mockRun).toHaveBeenCalledTimes(2)
870879
webpack.mockClear()

0 commit comments

Comments
 (0)