update tests

This commit is contained in:
Pooya Parsa 2017-05-15 03:31:41 +04:30
parent a1b9296776
commit 0eb3fc4a05
5 changed files with 29 additions and 3 deletions

View File

@ -96,12 +96,12 @@ export default async function () {
if (error) {
errors.push({ type: 'handled', route, error })
}
} catch (err) {
} catch (err) /* istanbul ignore next */ {
errors.push({ type: 'unhandled', route, error: err })
}
try {
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}`)
errors.push({ type: 'unhandled', route, error: minifyErr })
}
@ -122,6 +122,7 @@ export default async function () {
if (errors.length) {
const report = errors.map(({ type, route, error }) => {
/* istanbul ignore if */
if (type === 'unhandled') {
return `Route: '${route}'\n${error.stack}`
} else {

View File

@ -13,6 +13,7 @@ class Module {
}
addVendor (vendor) {
/* istanbul ignore if */
if (!vendor) {
return
}
@ -20,6 +21,7 @@ class Module {
}
addTemplate (template) {
/* istanbul ignore if */
if (!template) {
return
}
@ -74,6 +76,7 @@ class Module {
}
installModule (moduleOpts) {
/* istanbul ignore if */
if (!moduleOpts) {
return
}
@ -91,7 +94,7 @@ class Module {
// eslint-disable-next-line no-eval
module = eval('require')(src)
}
} /* istanbul ignore next */ catch (e) {
} catch (e) /* istanbul ignore next */ {
// eslint-disable-next-line no-console
console.error('[Nuxt] Unable to resolve module', src)
// eslint-disable-next-line no-console

View File

@ -63,6 +63,7 @@ export function sequence (tasks, fn) {
}
export function chainFn (base, fn) {
/* istanbul ignore if */
if (!(fn instanceof Function)) {
return
}

View File

@ -7,5 +7,20 @@ module.exports = function basicModule (options, resolve) {
// Add a plugin
this.addPlugin(path.resolve(__dirname, 'reverse.js'))
// Extend build
this.extendBuild(({isClient, isServer}) => {
// Do nothing!
})
// Extend build again
this.extendBuild(({isClient, isServer}) => {
// Do nothing!
})
// Extend routes
this.extendRoutes((routes, resolve) => {
// Do nothing!
})
resolve()
}

View File

@ -8,5 +8,11 @@ module.exports = function middlewareModule (options) {
res.end('It works!')
}
})
// Add plain middleware
this.addServerMiddleware((req, res, next) => {
next()
})
// Resolve
resolve()
})
}