Skip to content

Commit bd58642

Browse files
committed
Add --warnings CLI switch to print renderer warnings
See #166
1 parent 2fa95c1 commit bd58642

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/run.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ exports.builder = yargs => {
8585
implies: 'renderer',
8686
type: 'string',
8787
requiresArg: true
88+
},
89+
warnings: {
90+
alias: 'W',
91+
describe: 'Print renderer warnings to console',
92+
group: 'Electron',
93+
type: 'boolean',
94+
default: false
8895
}
8996
})
9097
.check(argv => {
@@ -190,7 +197,11 @@ exports.handler = async argv => {
190197
})
191198
ipc.on('mocha-warn', (_, warning) => warn(warning))
192199

193-
ipc.on('console-call', print)
200+
ipc.on('console-call', (_, method, args) => {
201+
if (method !== 'warn' || argv.warnings) {
202+
print(method, args)
203+
}
204+
})
194205

195206
// Undocumented call in electron-window
196207
win._loadURLWithArgs(
@@ -231,7 +242,7 @@ const warn = warning => {
231242
console.warn(ansi.yellow(`Warning: ${warning.message}`))
232243
}
233244

234-
const print = (_, method, args) => {
245+
const print = (method, args) => {
235246
const output = util.format.apply(null, args)
236247
console[method](output)
237248
}

0 commit comments

Comments
 (0)