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

21 lines
511 B
JavaScript
Raw Normal View History

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
})
const nuxt = new Nuxt(options)
2018-03-18 23:41:14 +00:00
const generator = new Generator(nuxt)
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
})