nuxt.renderAndGetWindow(url, options)

  • Type: Function
  • Argument: String
    1. String: URL to render
    2. Optional, Object: options
    • virtualConsole: Boolean (default: true)
  • Returns: Promise
    • Returns: window

Get the window from a given url of a Nuxt.js application.

This method is made for test purposes.

To use this function, you have to install jsdom:

npm install --save-dev jsdom


const { loadNuxt } = require('nuxt')

async function init() {
  // Assuming you've already built your project
  const nuxt = await loadNuxt({ for: 'start' })
  await nuxt.listen(3000)
  const window = await nuxt.renderAndGetWindow('http://localhost:3000')
  // Display the head `<title>`


Обнаружили ошибку или хотите внести свой вклад в документацию? Отредактировать эту страницу на GitHub!


StrapiShip ShapeGoogle Chrome Support Us