This commit is contained in:
Pooya Parsa 2017-06-20 17:42:33 +04:30
parent 8aaadfae79
commit 2c12b37bf6
3 changed files with 7 additions and 1 deletions

View File

@ -324,6 +324,7 @@ export default class Builder extends Tapable {
} else {
// --- Production Build ---
compiler.run((err, stats) => {
/* istanbul ignore if */
if (err) {
return reject(err)
}

View File

@ -47,6 +47,7 @@ export default class Nuxt extends Tapable {
listen (port = 3000, host = 'localhost') {
return new Promise((resolve, reject) => {
const server = this.renderer.app.listen({ port, host, exclusive: false }, err => {
/* istanbul ignore if */
if (err) {
return reject(err)
}
@ -61,6 +62,7 @@ export default class Nuxt extends Tapable {
// Destroy server by forcing every connection to be closed
server.destroy(err => {
debug('server closed')
/* istanbul ignore if */
if (err) {
return reject(err)
}
@ -93,6 +95,7 @@ export default class Nuxt extends Tapable {
async close (callback) {
await this.applyPluginsAsync('close')
/* istanbul ignore if */
if (typeof callback === 'function') {
await callback()
}

View File

@ -132,6 +132,7 @@ export default class Renderer extends Tapable {
basedir: this.options.rootDir
}, this.options.render.ssr, this.options.build.ssr))
/* istanbul ignore if */
if (this.options.build.ssr) {
// eslint-disable-next-line no-console
console.warn('[nuxt] `build.ssr` is deprecated and will be removed in 1.0 release, please use `renderer.ssr` instead!')
@ -176,7 +177,8 @@ export default class Renderer extends Tapable {
if (this.options.router.base !== '/' && req.url.indexOf(this.options.router.base) === 0) {
req.url = req.url.replace(this.options.router.base, '/')
}
// Prevent access to SSR resources
// Prevent access to SSR resources (TODO: write tests)
/* istanbul ignore if */
if (ssrResourceRegex.test(req.url)) {
res.statusCode = 404
return res.end()