refactor: ava test

This commit is contained in:
Clark Du 2018-04-08 20:16:20 +08:00
parent 98fd8637ff
commit 7a7239d35d
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9

View File

@ -9,16 +9,12 @@ let nuxt = null
// Init Nuxt.js and create a server listening on localhost:4000
test.before(async () => {
const rootDir = resolve(__dirname, '..')
let config = {}
try {
config = require(resolve(rootDir, 'nuxt.config.js'))
} catch (e) {
const config = {
dev: false,
rootDir: resolve(__dirname, '..')
}
config.rootDir = rootDir // project folder
config.dev = false // production build
nuxt = new Nuxt(config)
new Builder(nuxt).build()
await new Builder(nuxt).build()
await nuxt.listen(4000, 'localhost')
}, 30000)