2017-11-20 07:13:53 +00:00
|
|
|
import test from 'ava'
|
2017-12-12 09:42:29 +00:00
|
|
|
import { Nuxt, Builder } from '..'
|
2018-03-15 09:19:36 +00:00
|
|
|
import { intercept } from './helpers/console'
|
2018-03-16 16:12:06 +00:00
|
|
|
import { loadConfig } from './helpers/config'
|
2017-11-20 07:13:53 +00:00
|
|
|
|
|
|
|
const port = 4010
|
|
|
|
|
|
|
|
let nuxt = null
|
|
|
|
let builder = null
|
2017-12-17 19:30:26 +00:00
|
|
|
let buildSpies = null
|
2017-11-20 07:13:53 +00:00
|
|
|
|
|
|
|
// Init nuxt.js and create server listening on localhost:4000
|
2017-12-17 19:30:26 +00:00
|
|
|
test.serial('Init Nuxt.js', async t => {
|
2018-03-16 16:12:06 +00:00
|
|
|
const config = loadConfig('deprecate', { dev: false })
|
2017-11-20 07:13:53 +00:00
|
|
|
|
2017-12-17 19:30:26 +00:00
|
|
|
buildSpies = await intercept(async () => {
|
|
|
|
nuxt = new Nuxt(config)
|
|
|
|
builder = await new Builder(nuxt)
|
|
|
|
await builder.build()
|
|
|
|
await nuxt.listen(port, 'localhost')
|
|
|
|
})
|
2017-11-20 07:13:53 +00:00
|
|
|
|
2017-12-17 19:30:26 +00:00
|
|
|
t.true(buildSpies.log.calledWithMatch('DONE'))
|
|
|
|
t.true(buildSpies.log.calledWithMatch('OPEN'))
|
2017-11-20 07:13:53 +00:00
|
|
|
})
|
|
|
|
|
2018-03-15 08:29:33 +00:00
|
|
|
test.serial('Deprecated: module.addVendor()', async t => {
|
|
|
|
t.true(buildSpies.warn.calledWithMatch('module: addVendor is no longer necessary'))
|
|
|
|
})
|
|
|
|
|
2017-11-20 07:13:53 +00:00
|
|
|
// Close server and ask nuxt to stop listening to file changes
|
2017-12-17 19:30:26 +00:00
|
|
|
test.after.always('Closing server and nuxt.js', async t => {
|
|
|
|
await nuxt.close()
|
2017-11-20 07:13:53 +00:00
|
|
|
})
|