mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-11 19:28:05 +00:00
Add virtualConsole option
This commit is contained in:
parent
ba3fd95f14
commit
f3719add05
@ -97,7 +97,7 @@ export function renderRoute (url, context = {}) {
|
|||||||
|
|
||||||
// Function used to do dom checking via jsdom
|
// Function used to do dom checking via jsdom
|
||||||
let jsdom = null
|
let jsdom = null
|
||||||
export function renderAndGetWindow (url) {
|
export function renderAndGetWindow (url, opts = {}) {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (!jsdom) {
|
if (!jsdom) {
|
||||||
try {
|
try {
|
||||||
@ -109,7 +109,10 @@ export function renderAndGetWindow (url) {
|
|||||||
process.exit(1)
|
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'
|
url = url || 'http://localhost:3000'
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
jsdom.env({
|
jsdom.env({
|
||||||
|
Loading…
Reference in New Issue
Block a user