2018-03-27 22:28:17 +00:00
|
|
|
import { loadFixture, Nuxt, Generator } from '../utils'
|
2018-03-16 19:52:17 +00:00
|
|
|
|
2018-03-18 19:31:32 +00:00
|
|
|
describe('basic fail generate', () => {
|
|
|
|
test('Fail with routes() which throw an error', async () => {
|
2018-03-18 23:41:14 +00:00
|
|
|
const options = loadFixture('basic', {
|
2018-03-18 19:31:32 +00:00
|
|
|
generate: {
|
|
|
|
async routes() {
|
|
|
|
throw new Error('Not today!')
|
|
|
|
}
|
2016-12-21 19:51:43 +00:00
|
|
|
}
|
2018-03-18 23:41:14 +00:00
|
|
|
})
|
|
|
|
|
2017-12-17 19:30:26 +00:00
|
|
|
const nuxt = new Nuxt(options)
|
2018-03-18 23:41:14 +00:00
|
|
|
const generator = new Generator(nuxt)
|
2017-12-17 19:30:26 +00:00
|
|
|
|
2018-08-06 00:12:44 +00:00
|
|
|
await generator.generate({ build: false }).catch((e) => {
|
2018-03-18 23:41:14 +00:00
|
|
|
expect(e.message).toBe('Not today!')
|
2018-01-13 05:22:11 +00:00
|
|
|
})
|
2018-03-18 23:41:14 +00:00
|
|
|
})
|
2016-12-21 19:51:43 +00:00
|
|
|
})
|