mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
update tests
This commit is contained in:
parent
a1b9296776
commit
0eb3fc4a05
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -63,6 +63,7 @@ export function sequence (tasks, fn) {
|
||||
}
|
||||
|
||||
export function chainFn (base, fn) {
|
||||
/* istanbul ignore if */
|
||||
if (!(fn instanceof Function)) {
|
||||
return
|
||||
}
|
||||
|
15
test/fixtures/module/modules/basic/index.js
vendored
15
test/fixtures/module/modules/basic/index.js
vendored
@ -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()
|
||||
}
|
||||
|
@ -8,5 +8,11 @@ module.exports = function middlewareModule (options) {
|
||||
res.end('It works!')
|
||||
}
|
||||
})
|
||||
// Add plain middleware
|
||||
this.addServerMiddleware((req, res, next) => {
|
||||
next()
|
||||
})
|
||||
// Resolve
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user