Nuxt/test/basic.fail.generate.test.js
2018-03-18 23:01:32 +03:30

29 lines
701 B
JavaScript

import { resolve } from 'path'
import { Nuxt, Builder, Generator } from '..'
describe('basic fail generate', () => {
test('Fail with routes() which throw an error', async () => {
const options = {
rootDir: resolve(__dirname, 'fixtures/basic'),
buildDir: '.nuxt-fail',
dev: false,
build: {
stats: false
},
generate: {
async routes() {
throw new Error('Not today!')
}
}
}
const nuxt = new Nuxt(options)
const builder = new Builder(nuxt)
const generator = new Generator(nuxt, builder)
await generator.generate().catch(e => {
expect(e.message === 'Not today!').toBe(true)
})
}, 30000)
})