Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const runSpectron = async (spectronOptions, launchOptions = {}) => {
let sendData
execa.mockReturnValueOnce({
on: jest.fn(),
stdout: {
on: (event, callback) => {
if (event === 'data') {
// Save callback to be called later
sendData = callback
}
}
}
})
const testPromise = testWithSpectron(spectronOptions)
// Mock console.log from electron:serve
if (launchOptions.customLog) await sendData(launchOptions.customLog)
await sendData(`$outputDir=${launchOptions.outputDir || 'dist_electron'}`)
await sendData(
`$WEBPACK_DEV_SERVER_URL=${launchOptions.url || 'http://localhost:8080/'}`