feat: update with-ava example

This commit is contained in:
Clark Du 2017-10-20 14:41:06 +08:00 committed by Pooya Parsa
parent 50ade95694
commit d2a57bc329
2 changed files with 4 additions and 7 deletions

View File

@ -11,6 +11,6 @@
"jsdom": "^11.0.0"
},
"dependencies": {
"nuxt": "^1.0.0-alpha2"
"nuxt": "latest"
}
}

View File

@ -1,11 +1,10 @@
import test from 'ava'
import Nuxt from 'nuxt'
import { Nuxt, Builder } from 'nuxt'
import { resolve } from 'path'
// We keep the nuxt and server instance
// So we can close them at the end of the test
let nuxt = null
let server = null
// Init Nuxt.js and create a server listening on localhost:4000
test.before('Init Nuxt.js', async t => {
@ -15,9 +14,8 @@ test.before('Init Nuxt.js', async t => {
config.rootDir = rootDir // project folder
config.dev = false // production build
nuxt = new Nuxt(config)
await nuxt.build()
server = new nuxt.Server(nuxt)
server.listen(4000, 'localhost')
await new Builder(nuxt).build()
await nuxt.listen(4000, 'localhost')
})
// Example of testing only generated html
@ -39,6 +37,5 @@ test('Route / exits and render HTML with CSS applied', async t => {
// Close server and ask nuxt to stop listening to file changes
test.after('Closing server and nuxt.js', t => {
server.close()
nuxt.close()
})