I want to test the state data passed from server to client.
This resolve this by adding a hook to get context.nuxt
.
↓
const serializedSession = `window.__NUXT__=${serialize(context.nuxt, {
isJSON: true
})};`
await this.nuxt.callHook('render:passingData', context.nuxt)
const cspScriptSrcHashes = []
if (this.options.render.csp && this.options.render.csp.enabled) {
const { Nuxt, Builder } = require('nuxt')
const config = require('./nuxt.config.js')
config.dev = false
const nuxt = new Nuxt(config)
nuxt.hook('render:passingData', (passingData) => {console.dir(passingData)})
new Builder(nuxt)
.build()
.then(() => nuxt.renderRoute('/'))
.then(({ html, error, redirected }) => {
})
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c7015">#c7015</a>)</em></sub></div>