mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-18 02:07:14 +00:00
fffe741986
Add stdout/stderr to console helpers Remove separate nosubfolders test file in favor of inclusion in basic.generate Add build.stats to silence webpack output Add .always to after hooks: (1) fixes issue with basic.dev test that watch.js is empty when one of the test fails and (2) fixes that sometimes when running multiple tests that failed after eachother the port is still used as the server did not automatically get killed Change all init nuxt before test to serial tests and add tests for DONE and OPEN logs
33 lines
856 B
JavaScript
33 lines
856 B
JavaScript
import test from 'ava'
|
|
import { resolve } from 'path'
|
|
import { Nuxt, Builder, Generator } from '..'
|
|
import { intercept } from './helpers/console'
|
|
|
|
test('Fail with routes() which throw an error', async t => {
|
|
const options = {
|
|
rootDir: resolve(__dirname, 'fixtures/basic'),
|
|
buildDir: '.nuxt-fail',
|
|
dev: false,
|
|
build: {
|
|
stats: false
|
|
},
|
|
generate: {
|
|
async routes() {
|
|
throw new Error('Not today!')
|
|
}
|
|
}
|
|
}
|
|
const spies = await intercept(async () => {
|
|
const nuxt = new Nuxt(options)
|
|
const builder = new Builder(nuxt)
|
|
const generator = new Generator(nuxt, builder)
|
|
|
|
return generator.generate()
|
|
.catch((e) => {
|
|
t.true(e.message === 'Not today!')
|
|
})
|
|
})
|
|
t.true(spies.log.calledWithMatch('DONE'))
|
|
t.true(spies.error.withArgs('Could not resolve routes').calledOnce)
|
|
})
|