Commit 0d17513f by lxyang

feat:运行报错兜底处理

parent d0c88dca
{ {
"name": "istanbul-middleware-ry", "name": "istanbul-middleware-ry",
"description": "Connect middleware for Istanbul to handle server-side as well as browser coverage use-cases for node apps", "description": "Connect middleware for Istanbul to handle server-side as well as browser coverage use-cases for node apps",
"version": "0.0.6", "version": "0.0.7",
"main": "lib/index.js", "main": "lib/index.js",
"files": [ "files": [
"lib" "lib"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
"mkdirp": "*", "mkdirp": "*",
"pm2": "^5.2.0", "pm2": "^5.2.0",
"rimraf": "*", "rimraf": "*",
"ry-istanbul-web": "^0.0.6", "ry-istanbul-web": "^0.0.7",
"yui-lint": "*" "yui-lint": "*"
}, },
"engines": { "engines": {
......
...@@ -297,6 +297,7 @@ function mergeClientCoverage(obj) { ...@@ -297,6 +297,7 @@ function mergeClientCoverage(obj) {
return return
} }
var coverage = getCoverageObject() var coverage = getCoverageObject()
if (Object.keys(obj) && Object.keys(obj).length) {
Object.keys(obj).forEach(function (filePath) { Object.keys(obj).forEach(function (filePath) {
var original = coverage[filePath], var original = coverage[filePath],
added = obj[filePath], added = obj[filePath],
...@@ -308,6 +309,7 @@ function mergeClientCoverage(obj) { ...@@ -308,6 +309,7 @@ function mergeClientCoverage(obj) {
} }
coverage[filePath] = result coverage[filePath] = result
}) })
}
} }
module.exports = { module.exports = {
getCoverageObject: getCoverageObject, getCoverageObject: getCoverageObject,
......
...@@ -11,13 +11,14 @@ const ASSETS_DIR = istanbul.assetsDir ...@@ -11,13 +11,14 @@ const ASSETS_DIR = istanbul.assetsDir
const existsSync = fs.existsSync || path.existsSync const existsSync = fs.existsSync || path.existsSync
const url = require('url') const url = require('url')
const express = require('express') const express = require('express')
var bodyParser = require('body-parser');
const JS_RE = /\.js$/ const JS_RE = /\.js$/
const getPitchingPiles = core.getPitchingPile() const getPitchingPiles = core.getPitchingPile()
/** /**
* Set default max limit to 100mb for incoming JSON and urlencoded * Set default max limit to 100mb for incoming JSON and urlencoded
* @type {String} * @type {String}
*/ */
var fileSizeMaximum = '1024mb' var fileSizeMaximum = '10240mb'
var isExtended = true var isExtended = true
function createHandler(opts, isAll) { function createHandler(opts, isAll) {
...@@ -30,6 +31,8 @@ function createHandler(opts, isAll) { ...@@ -30,6 +31,8 @@ function createHandler(opts, isAll) {
res.header('Access-Control-Allow-Headers', 'Content-Type') res.header('Access-Control-Allow-Headers', 'Content-Type')
next() next()
}) })
app.use(bodyParser.json({limit: '5000mb'}))
app.use(bodyParser.urlencoded({limit: '5000mb', extended: true}))
// using separete options objects to maintain readability as the objects are getting more complex // using separete options objects to maintain readability as the objects are getting more complex
var urlOptions = { extended: isExtended, limit: fileSizeMaximum } var urlOptions = { extended: isExtended, limit: fileSizeMaximum }
var jsonOptions = { limit: fileSizeMaximum } var jsonOptions = { limit: fileSizeMaximum }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment