Update tests

This commit is contained in:
Sebastien Chopin 2017-05-11 13:37:21 +02:00
parent 64abcc04a8
commit ac836c77de
3 changed files with 7 additions and 2 deletions

View File

@ -104,13 +104,16 @@ export default function () {
errors.push({ type: 'handled', route, error }) errors.push({ type: 'handled', route, error })
} }
} catch (err) { } catch (err) {
/* istanbul ignore next */
errors.push({ type: 'unhandled', route, error: err }) errors.push({ type: 'unhandled', route, error: err })
return return
} }
try { try {
var minifiedHtml = minify(html, self.options.generate.minify) var minifiedHtml = minify(html, self.options.generate.minify)
} catch (err) { } catch (err) {
/* istanbul ignore next */
let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`) let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`)
/* istanbul ignore next */
errors.push({ type: 'unhandled', route, error: minifyErr }) errors.push({ type: 'unhandled', route, error: minifyErr })
return return
} }
@ -137,6 +140,7 @@ export default function () {
if (errors.length) { if (errors.length) {
const report = errors.map(({ type, route, error }) => { const report = errors.map(({ type, route, error }) => {
/* istanbul ignore next */
if (type === 'unhandled') { if (type === 'unhandled') {
return `Route: '${route}'\n${error.stack}` return `Route: '${route}'\n${error.stack}`
} else { } else {

View File

@ -23,6 +23,7 @@ module.exports = {
string: 'Nuxt.js' string: 'Nuxt.js'
}, },
build: { build: {
extractCSS: true,
publicPath: '/orion/', publicPath: '/orion/',
analyze: { analyze: {
analyzerMode: 'disabled', analyzerMode: 'disabled',
@ -33,6 +34,6 @@ module.exports = {
} }
}, },
css: [ css: [
{src: '~/assets/app.css'} { src: '~/assets/app.css' }
] ]
} }

View File

@ -87,7 +87,7 @@ test('/test/about-bis (added with extendRoutes)', async t => {
test('Check stats.json generated by build.analyze', t => { test('Check stats.json generated by build.analyze', t => {
const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json')) const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json'))
t.is(stats.assets.length, 27) t.is(stats.assets.length, 29)
}) })
// Close server and ask nuxt to stop listening to file changes // Close server and ask nuxt to stop listening to file changes