ci: make console.warn work in tests (#18771)

This commit is contained in:
Jeremy Apthorp 2019-06-13 15:56:58 -07:00 committed by GitHub
parent 390e7f5719
commit 29decbdd4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 10 deletions

View file

@ -39,11 +39,14 @@
// Rediret all output to browser.
if (isCi) {
global.__defineGetter__('console', function () {
return {
log: (...args) => ipcRenderer.send('console.log', args),
error: (...args) => ipcRenderer.send('console.error', args)
const fakeConsole = {}
for (const k in console) {
if (console.hasOwnProperty(k) && k !== 'assert') {
fakeConsole[k] = (...args) => ipcRenderer.send('console-call', k, args)
}
}
global.__defineGetter__('console', function () {
return fakeConsole
})
}