code coverage

This commit is contained in:
Pooya Parsa 2017-06-16 17:53:34 +04:30
parent 8f2945111a
commit 0453308e5e
5 changed files with 18 additions and 2 deletions

View File

@ -42,6 +42,11 @@
"bin": { "bin": {
"nuxt": "./bin/nuxt" "nuxt": "./bin/nuxt"
}, },
"nyc": {
"exclude": [
"/index.js"
]
},
"scripts": { "scripts": {
"test": "npm run lint && nyc ava --verbose --serial test/", "test": "npm run lint && nyc ava --verbose --serial test/",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",

View File

@ -292,7 +292,10 @@ export default class Builder extends Tapable {
return parallel(this.compiler.compilers, compiler => new Promise((resolve, reject) => { return parallel(this.compiler.compilers, compiler => new Promise((resolve, reject) => {
let _resolved = false let _resolved = false
const handler = (err, stats) => { const handler = (err, stats) => {
if (_resolved) return /* istanbul ignore if */
if (_resolved) {
return
}
_resolved = true _resolved = true
if (err) { if (err) {
return reject(err) return reject(err)

View File

@ -235,6 +235,7 @@ export default class Renderer extends Tapable {
res.end(html, 'utf8') res.end(html, 'utf8')
return html return html
} catch (err) { } catch (err) {
/* istanbul ignore if */
if (context.redirected) { if (context.redirected) {
console.error(err) // eslint-disable-line no-console console.error(err) // eslint-disable-line no-console
return err return err
@ -306,6 +307,7 @@ export default class Renderer extends Tapable {
try { try {
jsdom = require('jsdom') jsdom = require('jsdom')
} catch (e) { } catch (e) {
// istanbul ignore next
console.error('Fail when calling nuxt.renderAndGetWindow(url)') // eslint-disable-line no-console console.error('Fail when calling nuxt.renderAndGetWindow(url)') // eslint-disable-line no-console
console.error('jsdom module is not installed') // eslint-disable-line no-console console.error('jsdom module is not installed') // eslint-disable-line no-console
console.error('Please install jsdom with: npm install --save-dev jsdom') // eslint-disable-line no-console console.error('Please install jsdom with: npm install --save-dev jsdom') // eslint-disable-line no-console

View File

@ -1,4 +1,7 @@
module.exports = function middlewareModule (options) { module.exports = function middlewareModule (options) {
// Empty module // Empty module
} }
module.exports.meta = {
name: 'Empty Module!'
}

View File

@ -39,6 +39,9 @@ module.exports = {
{ src: '~/assets/app.css' } { src: '~/assets/app.css' }
], ],
render: { render: {
http2: {
push: true
},
static: { static: {
maxAge: '1y' maxAge: '1y'
} }