Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Set callback to be called later
watchCb = cb
}
}
})
await runCommand('electron:serve', {
pluginOptions: {
electronBuilder: {
mainProcessFile: 'customBackground',
mainProcessArgs: ['--a-flag', 'a-value']
}
}
})
expect(execa).toHaveBeenCalledTimes(1)
expect(execa.mock.calls[0][1]).toEqual([
'dist_electron',
'--a-flag',
'a-value'
])
// Mock change of background file
watchCb()
expect(mockExeca.removeListener.mock.calls[0][0]).toBe('exit')
expect(execa).toHaveBeenCalledTimes(2)
expect(execa.mock.calls[0][1]).toEqual([
'dist_electron',
'--a-flag',
'a-value'
])
})
test('Electron is launched with arguments', async () => {
await runCommand('electron:serve', {}, {}, ['--expected'])
const args = execa.mock.calls[0][1]
expect(args).toContain('--expected')
})
})
test('docs', () => {
const service = require('../../../lib/docs/service')
const mockExeca = require('execa')
service('/bin/vuepress', { mode: 'build' })
const calls = mockExeca.mock.calls
expect(calls[0][0]).toMatch('/bin/vuepress')
expect(calls[0][1]).toEqual(['build', 'docs'])
expect(calls[0][2]).toEqual({ stdio: 'inherit' })
})