Nuxt/test/basic.fail.generate.test.js

24 lines
593 B
JavaScript
Raw Normal View History

2016-12-21 19:51:43 +00:00
import test from 'ava'
import { resolve } from 'path'
2017-06-18 17:33:23 +00:00
import { Nuxt, Builder, Generator } from '../index.js'
2016-12-21 19:51:43 +00:00
test('Fail with routes() which throw an error', async t => {
2016-12-21 19:51:43 +00:00
const options = {
rootDir: resolve(__dirname, 'fixtures/basic'),
dev: false,
2017-06-14 18:51:14 +00:00
runBuild: true,
2016-12-21 19:51:43 +00:00
generate: {
2017-06-13 22:09:03 +00:00
async routes () {
throw new Error('Not today!')
2016-12-21 19:51:43 +00:00
}
}
}
const nuxt = new Nuxt(options)
2017-06-18 17:33:23 +00:00
const builder = new Builder(nuxt)
const generator = new Generator(nuxt, builder)
return generator.generate()
2016-12-21 19:51:43 +00:00
.catch((e) => {
2017-03-20 16:52:35 +00:00
t.true(e.message === 'Not today!')
2016-12-21 19:51:43 +00:00
})
})