Want to take a look at our new docs? Our new docs are now in beta. Have fun!

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

Example:

const { Nuxt, Builder } = require('nuxt')

const config = require('./nuxt.config.js')
config.dev = false

const nuxt = new Nuxt(config)

nuxt.renderAndGetWindow('http://localhost:3000').then(window => {
  // Display the head `<title>`
  console.log(window.document.title)
})

Contributors

Contribution for this page is now closed. If you would like to contribute please check out our new docs are now in beta. Have fun!

Platinum Sponsors

StoryblokMoovweb Support Us