Nuxt/test/deprecate.test.js

35 lines
972 B
JavaScript
Raw Normal View History

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