http/test/_utils.js

30 lines
540 B
JavaScript
Raw Normal View History

2019-03-18 21:21:48 +00:00
const { Nuxt, Builder } = require('nuxt-edge')
const defaultConfig = require('./fixture/nuxt.config')
jest.setTimeout(60000)
async function setupNuxt(config) {
const nuxt = new Nuxt({
...defaultConfig,
...config
})
// Spy addTemplate
nuxt.moduleContainer.addTemplate = jest.fn(nuxt.moduleContainer.addTemplate)
2019-03-24 11:59:15 +00:00
const builder = new Builder(nuxt)
2019-03-18 21:21:48 +00:00
2019-03-24 11:59:15 +00:00
await builder.validatePages()
await builder.generateRoutesAndFiles()
nuxt.builder = builder
2019-03-18 21:21:48 +00:00
2019-03-24 12:39:48 +00:00
await nuxt.ready()
2019-03-18 21:21:48 +00:00
return nuxt
}
module.exports = {
setupNuxt
}