Add virtualConsole option

This commit is contained in:
Sébastien Chopin 2017-01-26 15:21:02 +01:00
parent ba3fd95f14
commit f3719add05

View File

@ -97,7 +97,7 @@ export function renderRoute (url, context = {}) {
// Function used to do dom checking via jsdom
let jsdom = null
export function renderAndGetWindow (url) {
export function renderAndGetWindow (url, opts = {}) {
/* istanbul ignore if */
if (!jsdom) {
try {
@ -109,7 +109,10 @@ export function renderAndGetWindow (url) {
process.exit(1)
}
}
const virtualConsole = jsdom.createVirtualConsole().sendTo(console)
let virtualConsole
if (opts.virtualConsole === true) {
virtualConsole = jsdom.createVirtualConsole().sendTo(console)
}
url = url || 'http://localhost:3000'
return new Promise((resolve, reject) => {
jsdom.env({